Skip to content
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

Merged
merged 3 commits into from Apr 17, 2019

Conversation

JaiPe
Copy link
Contributor

@JaiPe JaiPe commented Apr 15, 2019

Fixes popperjs options for onUpdate and onCreate that were being spread over in Popper component

Closes #15262

Fixes popperjs options for onUpdate and onCreate that were being spread over in Popper component
@mui-pr-bot
Copy link

mui-pr-bot commented Apr 15, 2019

Details of bundle changes.

Comparing: 1e86a1c...3c3e56b

bundle parsed diff gzip diff prev parsed current parsed prev gzip current gzip
@material-ui/core +0.02% 🔺 +0.01% 🔺 346,631 346,687 89,712 89,725
@material-ui/core/Paper 0.00% 0.00% 68,376 68,376 20,044 20,044
@material-ui/core/Paper.esm 0.00% 0.00% 60,735 60,735 18,787 18,787
@material-ui/core/Popper +1.56% 🔺 +1.02% 🔺 34,910 35,453 11,907 12,028
@material-ui/core/styles/createMuiTheme 0.00% 0.00% 17,877 17,877 5,962 5,962
@material-ui/core/useMediaQuery 0.00% 0.00% 2,463 2,463 1,044 1,044
@material-ui/lab +0.04% 🔺 +0.04% 🔺 148,063 148,119 43,905 43,924
@material-ui/styles 0.00% 0.00% 53,115 53,115 15,434 15,434
@material-ui/system 0.00% 0.00% 17,132 17,132 4,519 4,519
Button 0.00% 0.00% 88,669 88,669 26,429 26,429
Modal 0.00% 0.00% 82,696 82,696 24,793 24,793
colorManipulator 0.00% 0.00% 3,745 3,745 1,537 1,537
docs.landing 0.00% 0.00% 50,908 50,908 11,210 11,210
docs.main +0.01% 🔺 +0.01% 🔺 649,914 650,006 202,317 202,341
packages/material-ui/build/umd/material-ui.production.min.js +0.01% 🔺 +0.01% 🔺 295,409 295,439 82,680 82,690

Generated by 🚫 dangerJS against 3c3e56b

@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work component: Popper The React component. See <Popup> for the latest version. labels Apr 15, 2019
@oliviertassinari oliviertassinari changed the title [Popper] Fix overidden popperjs lifecycle options (#15262) [Popper] Fix popperOptions prop Apr 15, 2019

it('should correctly pass down lifecycle callbacks to popperjs', () => {
const wrapper = mount(<Popper {...defaultProps} popperOptions={popperProps} />);
const instance = wrapper.find('Popper').instance();
Copy link
Member

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.

Copy link
Member

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

Copy link
Member

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?

Copy link
Contributor Author

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 👍

@JaiPe
Copy link
Contributor Author

JaiPe commented Apr 17, 2019

@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?

Copy link
Member

@eps1lon eps1lon left a 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.

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, much better!

@oliviertassinari
Copy link
Member

@JaiPe It's a great first pull request on Material-UI 👌🏻. Thank you for working on it!

@JaiPe JaiPe deleted the fix/15262-popper-lifecycle branch April 17, 2019 09:15
jztang pushed a commit to nyu-ossd-s19/material-ui that referenced this pull request Apr 21, 2019
* [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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: Popper The React component. See <Popup> for the latest version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Popper] onUpdate / onCreate not handled
5 participants