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

[Select] Make internal tests public #17538

Merged
merged 2 commits into from Sep 24, 2019

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Sep 23, 2019

Moves the test suite for SelectInput into Select. It's an internal component and I could not identify tests that required internal unit tests. At least not with the previous extent (most of the tests were targeted at the internal component).

Test suite of Select with this PR
    ✓ should be able to mount the component
    ✓ the trigger is in tab order
    ✓ should accept null child
    ✓ should have an input with [type="hidden"] by default
    ✓ should ignore onBlur the first time the menu is open (38ms)
    ✓ options should have a data-value attribute
    ✓ should open menu when pressed   key on select
    ✓ should open menu when pressed ArrowUp key on select
    ✓ should open menu when pressed ArrowDown key on select
    ✓ should open menu when pressed Enter key on select
    ✓ should pass "name" as part of the event.target for onBlur
    ✓ should call onClose when the backdrop is clicked
    ✓ should focus list if no selection
    ✓ should be able to return the input node via a ref object
    Material-UI component API
      ✓ applies the className to the root component
      ✓ does spread props to the root component
      ✓ should render without errors in ReactTestRenderer
      ref
        ✓ attaches the ref
    prop: inputProps
      ✓ should be able to provide a custom classes property
    prop: onChange
      ✓ should get selected element from arguments (40ms)
    prop: value
      ✓ should select the option based on the number value
      ✓ should select the option based on the string value
      ✓ should select only the option that matches the object
      ✓ should be able to use an object
    SVG icon
      ✓ should not present an SVG icon when native and multiple are specified
      ✓ should present an SVG icon
    accessibility
      ✓ sets aria-expanded="true" when the listbox is displayed
      ✓ aria-expanded is not present if the listbox isnt displayed
      ✓ indicates that activating the button displays a listbox
      ✓ renders an element with listbox behavior
      ✓ the listbox is focusable
      ✓ identifies each selectable element containing an option
      ✓ indicates the selected option
    prop: readOnly
      ✓ should not trigger any event with readOnly
    prop: MenuProps
      ✓ should apply additional props to the Menu component
      ✓ should be able to override PaperProps minWidth
    prop: SelectDisplayProps
      ✓ should apply additional props to trigger element
    prop: displayEmpty
      ✓ should display the selected item even if its value is empty
    prop: renderValue
      ✓ should use the prop to render the value
    prop: open (controlled)
      ✓ should allow to control closing by passing onClose props
      ✓ should be open when initially true
    prop: autoWidth
      ✓ should take the trigger width into account by default
      ✓ should not take the triger width into account when autoWidth is true
    prop: multiple
      ✓ should serialize multiple select value (59ms)
      ✓ selects value based on their stringified equality when theyre not objects (67ms)
      ✓ selects values based on strict equlity if theyre objects
      errors
        ✓ should throw if non array
      prop: onChange
        ✓ should call onChange when clicking an item (49ms)
    prop: autoFocus
      ✓ should focus select after Select did mount
    prop: inputRef
      ✓ should be able to return the input node via a ref object
      ✓ should be able focus the trigger imperatively
    prop: name
      ✓ should have no id when name is not provided
      ✓ should have select-`name` id when name is provided

@eps1lon eps1lon added test component: select This is the name of the generic UI component, not the React module! labels Sep 23, 2019
@mui-pr-bot
Copy link

No bundle size changes comparing cef3287...6a0a531

Generated by 🚫 dangerJS against 6a0a531

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.

+1 for testing public components :)

@oliviertassinari oliviertassinari merged commit f67c201 into mui:master Sep 24, 2019
@eps1lon eps1lon deleted the test/Select/merge-internal-tests branch October 1, 2019 13:14
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

3 participants