Skip to content

Commit

Permalink
docs: improved example in time support
Browse files Browse the repository at this point in the history
  • Loading branch information
gndelia committed Dec 2, 2020
1 parent 32b5dd2 commit 774a030
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ change the state of the checkbox.
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->


- [Installation](#installation)
- [API](#api)
- [`click(element, eventInit, options)`](#clickelement-eventinit-options)
Expand Down Expand Up @@ -251,8 +250,16 @@ import {render, screen} from '@testing-library/react'
import userEvent from '@testing-library/user-event'
test('types into the input', () => {
render(<input type="time" data-testid="time" />)
const input = screen.getByTestId('time')
render(
<>
<label for="time">Enter a time</label>
<input
type="time"
id="time"
/>
</>
)
const input = screen.getByLabelText(/enter a time/i)
userEvent.type(input, '13:58')
expect(input.value).toBe('13:58')
})
Expand Down

0 comments on commit 774a030

Please sign in to comment.