-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Begin adding specs
- Loading branch information
Showing
3 changed files
with
125 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React from 'react'; | ||
import '@testing-library/jest-dom'; | ||
import userEvent, { render, screen, fireEvent } from '@testing-library/react'; | ||
import { MemorableDate } from './memorable-date'; | ||
|
||
describe('Memorable Date', () => { | ||
const memorableDate = <MemorableDate id="memorable-date" monthId='month' dayId='day' yearId='year' />; | ||
|
||
test('should render', () => { | ||
render(memorableDate); | ||
expect(screen.getByTestId('memorable-date')).toBeTruthy(); | ||
}); | ||
|
||
// it('should set date to Jan 2 2020 using keyboard', async () => { | ||
// const { baseElement } = render(memorableDate); | ||
// const monthInput = baseElement.querySelector(`input[id="month"]`) as HTMLInputElement; | ||
// const dayInput = baseElement.querySelector(`input[id="day"]`) as HTMLInputElement; | ||
// const yearInput = baseElement.querySelector(`input[id="year"]`) as HTMLInputElement; | ||
|
||
// await userEvent.type(monthInput, "1"); | ||
// await userEvent.type(dayInput, "2"); | ||
// await userEvent.type(yearInput, "2020"); | ||
|
||
// // fireEvent.change(monthInput, {target: {value: '1'}}); | ||
// // fireEvent.change(dayInput, {target: {value: '2'}}); | ||
// // fireEvent.change(yearInput, {target: {value: '2020'}}); | ||
|
||
// expect(monthInput.value).toEqual('1'); | ||
// expect(dayInput.value).toEqual('2'); | ||
// expect(yearInput.value).toEqual('2020'); | ||
// }); | ||
}); |
89 changes: 68 additions & 21 deletions
89
packages/warpspeed/src/components/memorable-date/memorable-date.tsx
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