From ea6b7983f702b8a56db5b1a3c32ecc625a10e3ad Mon Sep 17 00:00:00 2001 From: miracles1919 <516571350@qq.com> Date: Thu, 29 Jun 2023 10:29:30 +0800 Subject: [PATCH] test: fix failed test --- src/components/passcode-input/tests/passcode-input.test.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/passcode-input/tests/passcode-input.test.tsx b/src/components/passcode-input/tests/passcode-input.test.tsx index ccd8e66020..4562541f3c 100644 --- a/src/components/passcode-input/tests/passcode-input.test.tsx +++ b/src/components/passcode-input/tests/passcode-input.test.tsx @@ -66,6 +66,9 @@ describe('PasscodeInput', () => { }) test('native keyboard should be work', async () => { + const originScrollIntoView = window.HTMLElement.prototype.scrollIntoView + window.HTMLElement.prototype.scrollIntoView = function () {} + render() const input = screen.getByRole('button', { name: '密码输入框' }) fireEvent.focus(input) @@ -73,6 +76,8 @@ describe('PasscodeInput', () => { await userEvent.keyboard('abc') }) expect(input).toHaveTextContent('abc') + + window.HTMLElement.prototype.scrollIntoView = originScrollIntoView }) test('event callbacks should be called', async () => {