From fa11f41ae960dc20f442eee2ee540ae8c618b0ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Jastrze=CC=A8bski?= Date: Mon, 14 Aug 2023 13:13:12 +0200 Subject: [PATCH] chore: apply UserEvent clear to examples/basic --- examples/basic/__tests__/App.test.tsx | 11 +++-------- examples/basic/package.json | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/examples/basic/__tests__/App.test.tsx b/examples/basic/__tests__/App.test.tsx index ba4df1cc4..7e09d5a3b 100644 --- a/examples/basic/__tests__/App.test.tsx +++ b/examples/basic/__tests__/App.test.tsx @@ -1,10 +1,5 @@ import * as React from 'react'; -import { - render, - screen, - fireEvent, - userEvent, -} from '@testing-library/react-native'; +import { render, screen, userEvent } from '@testing-library/react-native'; import App from '../App'; jest.useFakeTimers(); @@ -122,8 +117,8 @@ test('User can sign in after incorrect attempt', async () => { 'Incorrect username or password' ); - // Workaround for clearing TextInput, clear() function will be added soon. - fireEvent.changeText(passwordInput, ''); + // Clear password field + await user.clear(passwordInput); await user.type(passwordInput, 'admin1'); await user.press(screen.getByRole('button', { name: 'Sign In' })); diff --git a/examples/basic/package.json b/examples/basic/package.json index ac183b522..9ce549819 100644 --- a/examples/basic/package.json +++ b/examples/basic/package.json @@ -20,7 +20,7 @@ "devDependencies": { "@babel/core": "^7.20.0", "@testing-library/jest-native": "^5.4.2", - "@testing-library/react-native": "^12.2.0", + "@testing-library/react-native": "^12.2.1", "@types/react": "~18.2.14", "jest": "^29.3.0", "react-test-renderer": "18.2.0",