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 20, 2023
1 parent a532ac1 commit 4197a24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/image-viewer/slides.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const Slides = forwardRef<SlidesRef, SlidesType>((props, ref) => {

function swipeTo(index: number, immediate = false) {
const i = bound(index, 0, count - 1)
console.log('i', i)
console.log('i', i, index, count - 1)
props.onIndexChange?.(i)
api.start({
x: i * slideWidth,
Expand Down
3 changes: 3 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,11 +66,14 @@ describe('PasscodeInput', () => {
})

test('native keyboard should be work', async () => {
const originScrollIntoView = window.HTMLElement.prototype.scrollIntoView
window.HTMLElement.prototype.scrollIntoView = vi.fn()
render(<PasscodeInput plain />)
const input = screen.getByRole('button', { name: '密码输入框' })
fireEvent.focus(input)
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 4197a24

Please sign in to comment.