-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💄(frontend) replace to cunningham Datepicker
Replace the Grommet Datepicker with the Cunningham Datepicker.
- Loading branch information
Showing
14 changed files
with
196 additions
and
106 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { screen } from '@testing-library/react'; | ||
import userEventInit from '@testing-library/user-event'; | ||
import { DateTime } from 'luxon'; | ||
|
||
/** | ||
* To simulate a user typing a date in the Cunningham date picker | ||
* @param startingAt | ||
* @param userEvent | ||
*/ | ||
export const userTypeDatePicker = async ( | ||
startingAt: DateTime, | ||
userEvent?: ReturnType<typeof userEventInit.setup>, | ||
) => { | ||
const localUserEvent = userEvent || userEventInit; | ||
await localUserEvent.click(screen.getByText(/Starting date/i)); | ||
|
||
const [monthSegment, daySegment, yearSegment] = await screen.findAllByRole( | ||
'spinbutton', | ||
); | ||
|
||
await localUserEvent.click(monthSegment); | ||
expect(monthSegment).toHaveFocus(); | ||
await localUserEvent.keyboard(startingAt.toFormat('MM')); | ||
|
||
expect(daySegment).toHaveFocus(); | ||
await localUserEvent.keyboard(startingAt.toFormat('dd')); | ||
|
||
expect(yearSegment).toHaveFocus(); | ||
await localUserEvent.keyboard(startingAt.toFormat('yyyy')); | ||
}; |
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
Oops, something went wrong.