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

[BottomNavigationButton] onClick and onChange handler overwritten #9564

Merged
merged 4 commits into from Dec 20, 2017
Merged

[BottomNavigationButton] onClick and onChange handler overwritten #9564

merged 4 commits into from Dec 20, 2017

Conversation

kgregory
Copy link
Member

The handler that invokes onChange and onClick will be overwritten if an onClick prop is provided.

We're not pulling the onClick prop out in the destructure, so when we apply other to ButtonBase, we overwrite the onClick handler. The unit test is evergreen, because it's checking to see if the spy we're passing in is being called when click is simulated, which it is, though not through the handleChange method.

To fix this, I've pulled onClick before destructuring. If onClick is provided, it will be invoked in the handleChange class method. I've also added some tests to get BottomNavigationButton to 100% code coverage (part of the effort for #9527).

Ken Gregory added 2 commits December 20, 2017 01:23
…onClick prop provided

We're not pulling the onClick prop out in the destructure, so when we apply other to ButtonBase, we overwrite the onClick handler.  The unit test is evergreen, because it's checking to see if the spy we're passing in is being called when click is simulated, which it is, though not through the handleChange method.

To fix this, I've pulled onClick before destructuring.  If onClick is provided, it will be invoked in the handleChange class method.

I've also added some tests to get BottomNavigationButton to 100% code coverage (part of the effort for #9527).
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.

Great! I might have break it in the flow removal PR.

@@ -90,14 +90,30 @@ describe('<BottomNavigationButton />', () => {
assert.strictEqual(iconWrapper.is(Icon), true, 'should be an Icon');
});

it('should not render an Icon if icon is not provided', () => {
const wrapper = shallow(<BottomNavigationButton />);
assert.isFalse(wrapper.find(Icon).exists());
Copy link
Member

Choose a reason for hiding this comment

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

strictEqual(, false) ? O:)

@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work component: bottom navigation This is the name of the generic UI component, not the React module! labels Dec 20, 2017
@kgregory
Copy link
Member Author

All set!

@oliviertassinari oliviertassinari self-assigned this Dec 20, 2017
@oliviertassinari oliviertassinari merged commit 6ff311c into mui:v1-beta Dec 20, 2017
@oliviertassinari
Copy link
Member

Good job!

@kgregory kgregory deleted the feature/9527 branch December 22, 2017 16:13
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: bottom navigation This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants