-
Notifications
You must be signed in to change notification settings - Fork 47.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change the argument passed to CallbackQueue.getPooled #10101
Changes from 8 commits
0fe933b
b7b079f
5b861d3
49e3f84
61a2eb9
fff4d60
515509e
485c08e
065e59d
6aa6ce6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -844,4 +844,20 @@ describe('ReactTestUtils', () => { | |
); | ||
}); | ||
}); | ||
|
||
it('should call setState with the correct parameters', () => { | ||
let mockArg = 'the wrong value'; | ||
let mockCallback = arg => (mockArg = arg); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe let's assert There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so I tried this but So it seems like checking the first argument is the only way to go that I see There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you see where that |
||
class Component extends React.Component { | ||
componentDidMount() { | ||
this.setState({}, mockCallback); | ||
} | ||
render() { | ||
return false; | ||
} | ||
} | ||
|
||
ReactTestUtils.renderIntoDocument(<Component />); | ||
expect(mockArg).toBeUndefined(); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,4 +108,20 @@ describe('ReactNative', () => { | |
ReactNative.render(<Component chars={after} />, 11); | ||
expect(UIManager.__dumpHierarchyForJestTestsOnly()).toMatchSnapshot(); | ||
}); | ||
|
||
it('calls setState with the correct parameters', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's add a similar test to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
var mockArg = 'the wrong value'; | ||
var mockCallback = arg => (mockArg = arg); | ||
class Component extends React.Component { | ||
componentDidMount() { | ||
this.setState({}, mockCallback); | ||
} | ||
render() { | ||
return false; | ||
} | ||
} | ||
|
||
ReactNative.render(<Component />, 11); | ||
expect(mockArg).toBeUndefined(); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change this to
should call setState callback with no arguments
(and others too)