-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Popper] Fix popperOptions prop #15359
Conversation
Fixes popperjs options for onUpdate and onCreate that were being spread over in Popper component
Details of bundle changes.Comparing: 1e86a1c...3c3e56b
|
|
||
it('should correctly pass down lifecycle callbacks to popperjs', () => { | ||
const wrapper = mount(<Popper {...defaultProps} popperOptions={popperProps} />); | ||
const instance = wrapper.find('Popper').instance(); |
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.
We will soon migrate the Popper component to the hook API. We will no longer be able to dive into the private properties of the component. The simplest option is probably not to test it.
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.
I also prefer tests to not call functions directly but through their public APIs i.e. In normal use
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.
@JaiPe Do you have a better idea than removing the test?
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.
I'm happy to remove it - just don't want to impact test coverage 😯! I'll have a look in the morning and see if I can test it another way, or remove the test 👍
@oliviertassinari Updated the test. Not sure if I'm seeing much value in it though, it feels a bit like it's just testing Popper's API. What do you think? Should I just remove it? |
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.
Test is perfect. It's testing it just like you would use it.
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.
Awesome, much better!
@JaiPe It's a great first pull request on Material-UI 👌🏻. Thank you for working on it! |
* [Popper] Fix overidden popperjs lifecycle options (mui#15262) Fixes popperjs options for onUpdate and onCreate that were being spread over in Popper component * fix formatting * update test
Fixes popperjs options for onUpdate and onCreate that were being spread over in Popper component
Closes #15262