Skip to content

Commit

Permalink
Default cb to undefined so it doesn't count toward functions length
Browse files Browse the repository at this point in the history
  • Loading branch information
alecrobins authored and Alec Robins committed Oct 11, 2016
1 parent 260370a commit 3281333
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/ReactWrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class ReactWrapper {
* @param {Function} cb - callback function
* @returns {ReactWrapper}
*/
setProps(props, cb) {
setProps(props, cb = undefined) {
if (this.root !== this) {
throw new Error('ReactWrapper::setProps() can only be called on the root');
}
Expand All @@ -229,7 +229,7 @@ class ReactWrapper {
* @param {Function} cb - callback function
* @returns {ReactWrapper}
*/
setState(state, cb) {
setState(state, cb = undefined) {
if (this.root !== this) {
throw new Error('ReactWrapper::setState() can only be called on the root');
}
Expand Down
2 changes: 1 addition & 1 deletion src/ReactWrapperComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function createWrapperComponent(node, options = {}) {
};
},

setChildProps(newProps, cb) {
setChildProps(newProps, cb = undefined) {
const props = objectAssign({}, this.state.props, newProps);
this.setState({ props }, cb);
},
Expand Down
2 changes: 1 addition & 1 deletion src/ShallowWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class ShallowWrapper {
* @param {Function} cb - callback function
* @returns {ShallowWrapper}
*/
setState(state, cb) {
setState(state, cb = undefined) {
if (this.root !== this) {
throw new Error('ShallowWrapper::setState() can only be called on the root');
}
Expand Down

0 comments on commit 3281333

Please sign in to comment.