forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve date parts selection flow (mui#1923)
- Loading branch information
1 parent
e4c2bdd
commit 853e5d2
Showing
47 changed files
with
542 additions
and
396 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import * as React from 'react'; | ||
import { DIALOG_WIDTH } from '../../lib/src/constants/dimensions'; | ||
import { mountPickerWithState, mountStaticPicker } from '../test-utils'; | ||
import { StaticDateTimePicker, MobileDateTimePicker } from '@material-ui/pickers'; | ||
|
||
describe('<DateTimePicker />', () => { | ||
it('Renders and show todays date', () => { | ||
mountStaticPicker(defaultProps => <StaticDateTimePicker {...defaultProps} />); | ||
|
||
cy.contains('2017'); | ||
cy.contains('Oct 7'); | ||
cy.contains('07:36'); | ||
|
||
cy.percySnapshot('<DateTimePicker />', { | ||
widths: [DIALOG_WIDTH], | ||
}); | ||
}); | ||
|
||
it('Proper flow for date & time picking', () => { | ||
mountPickerWithState(defaultProps => <MobileDateTimePicker openTo="year" {...defaultProps} />); | ||
|
||
cy.get('input').click(); | ||
|
||
// Year | ||
cy.findByText('2015').click(); | ||
cy.get('input').should('have.value', '10/07/2015 7:36 PM'); | ||
|
||
// Date | ||
cy.findByLabelText('next month') | ||
.click() | ||
.click(); | ||
cy.findByLabelText('Dec 22, 2015').click(); | ||
cy.get('input').should('have.value', '12/22/2015 7:36 PM'); | ||
|
||
// Hour | ||
cy.findByRole('menu').trigger('mouseup', { buttons: 1, offsetX: 66, offsetY: 157 }); | ||
cy.get('input').should('have.value', '12/22/2015 8:36 PM'); | ||
|
||
// Minute | ||
cy.findByRole('menu').trigger('mouseup', { | ||
buttons: 1, | ||
offsetX: 222, | ||
offsetY: 180, | ||
}); | ||
|
||
cy.get('input').should('have.value', '12/22/2015 8:20 PM'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.