Skip to content

Commit a529a2d

Browse files
chore: apply UserEvent clear to examples/basic (#1451)
1 parent ee74d84 commit a529a2d

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

examples/basic/__tests__/App.test.tsx

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import * as React from 'react';
2-
import {
3-
render,
4-
screen,
5-
fireEvent,
6-
userEvent,
7-
} from '@testing-library/react-native';
2+
import { render, screen, userEvent } from '@testing-library/react-native';
83
import App from '../App';
94

105
jest.useFakeTimers();
@@ -122,8 +117,8 @@ test('User can sign in after incorrect attempt', async () => {
122117
'Incorrect username or password'
123118
);
124119

125-
// Workaround for clearing TextInput, clear() function will be added soon.
126-
fireEvent.changeText(passwordInput, '');
120+
// Clear password field
121+
await user.clear(passwordInput);
127122

128123
await user.type(passwordInput, 'admin1');
129124
await user.press(screen.getByRole('button', { name: 'Sign In' }));

examples/basic/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"devDependencies": {
2121
"@babel/core": "^7.20.0",
2222
"@testing-library/jest-native": "^5.4.2",
23-
"@testing-library/react-native": "^12.2.0",
23+
"@testing-library/react-native": "^12.2.1",
2424
"@types/react": "~18.2.14",
2525
"jest": "^29.3.0",
2626
"react-test-renderer": "18.2.0",

0 commit comments

Comments
 (0)