Skip to content

Commit

Permalink
test: fix failed test
Browse files Browse the repository at this point in the history
  • Loading branch information
miracles1919 committed Jun 29, 2023
1 parent 48927a4 commit ea6b798
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/passcode-input/tests/passcode-input.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,18 @@ describe('PasscodeInput', () => {
})

test('native keyboard should be work', async () => {
const originScrollIntoView = window.HTMLElement.prototype.scrollIntoView
window.HTMLElement.prototype.scrollIntoView = function () {}

render(<PasscodeInput plain />)
const input = screen.getByRole('button', { name: '密码输入框' })
fireEvent.focus(input)
await act(async () => {
await userEvent.keyboard('abc')
})
expect(input).toHaveTextContent('abc')

window.HTMLElement.prototype.scrollIntoView = originScrollIntoView
})

test('event callbacks should be called', async () => {
Expand Down

0 comments on commit ea6b798

Please sign in to comment.