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] Move ClockPicker tests to ClockPicker.test #26407

Merged
merged 3 commits into from May 21, 2021

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented May 21, 2021

Noticed in #26400 that MobileTimePicker was mostly responsible for ClockPicker testing. So I moved the tests from MobileTimePicker to ClockPicker to make them easier discoverable.

Used the opportunity to rewrite the tests with a more focused-testing approach.

@eps1lon eps1lon added test component: pickers This is the name of the generic UI component, not the React module! labels May 21, 2021
@mui-pr-bot
Copy link

mui-pr-bot commented May 21, 2021

No bundle size changes (experimental)

Generated by 🚫 dangerJS against 40380a4

expect(handleViewChange.callCount).to.equal(0);
});

it('should not select second when hour is disabled', () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

This was previously worded "should not select disabled second" which is inaccurate. The reason the change wasn't fired was that the hour is disabled. So I used a similar wording from a previous test ("should not select minute when hour is disabled").

Now that I think about it: This wording make it sound like each time part is viewed differently i.e. we're validating each part individually. But we actually check if the full time is within [minTime, maxTime] not just if the selected hour is in [getHour(minTime), getHour(maxTime)].

So

Suggested change
it('should not select second when hour is disabled', () => {
it('should not select second when time is disabled', () => {

sounds less ambigious. At least I was confused about this originally thinking that selecting 30s wouldn't be allowed if we have [12:30:10, 15:45:20] since 30 is not within [10, 20]. But the seconds only matter if the current time was within [minTime, maxTime].

@eps1lon eps1lon marked this pull request as ready for review May 21, 2021 09:23
@eps1lon eps1lon merged commit a1eeb7a into mui:next May 21, 2021
@eps1lon eps1lon deleted the test/pickers/clock-picker-focused-test branch May 21, 2021 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers 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

2 participants