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

[test] Migrate NativeSelectInput to react-testing-library #22910

Merged
merged 4 commits into from Oct 7, 2020
Merged

[test] Migrate NativeSelectInput to react-testing-library #22910

merged 4 commits into from Oct 7, 2020

Conversation

baterson
Copy link
Contributor

@baterson baterson commented Oct 6, 2020

Replaces enzyme for react-testing-library in the <NativeSelectInput/>

#22911

@oliviertassinari oliviertassinari changed the title [test] Migrate more components to react-testing-library [test] Migrate NativeSelectInput to react-testing-library Oct 6, 2020
@baterson
Copy link
Contributor Author

baterson commented Oct 6, 2020

@oliviertassinari
Copy link
Member

TabIndicator already handled in #22906

@baterson
Copy link
Contributor Author

baterson commented Oct 6, 2020

TabIndicator already handled in #22906

Ok. So I'm gonna remove it from this PR

@mui-pr-bot
Copy link

mui-pr-bot commented Oct 6, 2020

No bundle size changes comparing d9d60e6...e43681e

Generated by 🚫 dangerJS against e43681e

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.

If we can remove both shallow and mount enzyme tests, it would be ideal.

@baterson
Copy link
Contributor Author

baterson commented Oct 6, 2020

@oliviertassinari I tried to replace mount with render but it doesn't work. target.value has a null value for some reason.
Maybe you know what caused the problem?

 it('should respond to update event', () => {
    const handleChange = spy();
    const { container } = render(
       <NativeSelectInput {...defaultProps} onChange={handleChange}>
             <option value={10}>Ten</option>
             <option value={20}>Twenty</option>
             <option value={30}>Thirty</option>
       </NativeSelectInput>,
  );

    fireEvent.change(container.firstChild, { target: { value: 20 } });
    expect(handleChange.callCount).to.equal(1);
    // target.value has a null value for some reason
    expect(handleChange.args[0][0].target.value).to.equal(20);
 });

baterson and others added 2 commits October 6, 2020 21:00
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
@eps1lon eps1lon merged commit 81aba1c into mui:next Oct 7, 2020
@eps1lon
Copy link
Member

eps1lon commented Oct 7, 2020

@baterson Thanks!

@oliviertassinari oliviertassinari added the component: select This is the name of the generic UI component, not the React module! label Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: select This is the name of the generic UI component, not the React module! test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants