Skip to content

Commit 9747614

Browse files
committed
feat: remove 'textInput'
1 parent 430213f commit 9747614

File tree

6 files changed

+1
-92
lines changed

6 files changed

+1
-92
lines changed

src/user-event/__tests__/__snapshots__/clear.test.tsx.snap

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -331,30 +331,6 @@ How are you?" multiline: true, 1`] = `
331331
"timeStamp": 0,
332332
},
333333
},
334-
{
335-
"name": "textInput",
336-
"payload": {
337-
"currentTarget": {},
338-
"isDefaultPrevented": [Function],
339-
"isPersistent": [Function],
340-
"isPropagationStopped": [Function],
341-
"nativeEvent": {
342-
"previousText": "Hello World!
343-
How are you?",
344-
"range": {
345-
"end": 0,
346-
"start": 0,
347-
},
348-
"target": 0,
349-
"text": "",
350-
},
351-
"persist": [Function],
352-
"preventDefault": [Function],
353-
"stopPropagation": [Function],
354-
"target": {},
355-
"timeStamp": 0,
356-
},
357-
},
358334
{
359335
"name": "change",
360336
"payload": {

src/user-event/__tests__/clear.test.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ function renderTextInputWithToolkit(props: TextInputProps = {}) {
2020
onChange={logEvent('change')}
2121
onChangeText={logEvent('changeText')}
2222
onKeyPress={logEvent('keyPress')}
23-
/** @ts-expect-error property typedef removed in RN 0.75 */
24-
onTextInput={logEvent('textInput')}
2523
onSelectionChange={logEvent('selectionChange')}
2624
onSubmitEditing={logEvent('submitEditing')}
2725
onEndEditing={logEvent('endEditing')}
@@ -142,7 +140,6 @@ describe('clear()', () => {
142140
'focus',
143141
'selectionChange',
144142
'keyPress',
145-
'textInput',
146143
'change',
147144
'changeText',
148145
'selectionChange',

src/user-event/type/__tests__/__snapshots__/type.test.tsx.snap

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -843,30 +843,6 @@ exports[`type() supports multiline: input: "{Enter}\\n", multiline: true 1`] = `
843843
"timeStamp": 0,
844844
},
845845
},
846-
{
847-
"name": "textInput",
848-
"payload": {
849-
"currentTarget": {},
850-
"isDefaultPrevented": [Function],
851-
"isPersistent": [Function],
852-
"isPropagationStopped": [Function],
853-
"nativeEvent": {
854-
"previousText": "",
855-
"range": {
856-
"end": 1,
857-
"start": 1,
858-
},
859-
"target": 0,
860-
"text": "
861-
",
862-
},
863-
"persist": [Function],
864-
"preventDefault": [Function],
865-
"stopPropagation": [Function],
866-
"target": {},
867-
"timeStamp": 0,
868-
},
869-
},
870846
{
871847
"name": "change",
872848
"payload": {
@@ -950,32 +926,6 @@ exports[`type() supports multiline: input: "{Enter}\\n", multiline: true 1`] = `
950926
"timeStamp": 0,
951927
},
952928
},
953-
{
954-
"name": "textInput",
955-
"payload": {
956-
"currentTarget": {},
957-
"isDefaultPrevented": [Function],
958-
"isPersistent": [Function],
959-
"isPropagationStopped": [Function],
960-
"nativeEvent": {
961-
"previousText": "
962-
",
963-
"range": {
964-
"end": 2,
965-
"start": 2,
966-
},
967-
"target": 0,
968-
"text": "
969-
970-
",
971-
},
972-
"persist": [Function],
973-
"preventDefault": [Function],
974-
"stopPropagation": [Function],
975-
"target": {},
976-
"timeStamp": 0,
977-
},
978-
},
979929
{
980930
"name": "change",
981931
"payload": {

src/user-event/type/__tests__/type-managed.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ function ManagedTextInput({
3838
onPressOut={logEvent('pressOut')}
3939
onChange={logEvent('change')}
4040
onKeyPress={logEvent('keyPress')}
41-
/** @ts-expect-error property typedef removed in RN 0.75 */
42-
onTextInput={logEvent('textInput')}
4341
onSelectionChange={logEvent('selectionChange')}
4442
onSubmitEditing={logEvent('submitEditing')}
4543
onEndEditing={logEvent('endEditing')}

src/user-event/type/__tests__/type.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ function renderTextInputWithToolkit(props: TextInputProps = {}) {
2121
onChange={logEvent('change')}
2222
onChangeText={logEvent('changeText')}
2323
onKeyPress={logEvent('keyPress')}
24-
/** @ts-expect-error property typedef removed in RN 0.75 */
25-
onTextInput={logEvent('textInput')}
2624
onSelectionChange={logEvent('selectionChange')}
2725
onSubmitEditing={logEvent('submitEditing')}
2826
onEndEditing={logEvent('endEditing')}
@@ -173,13 +171,11 @@ describe('type()', () => {
173171
'focus',
174172
'pressOut',
175173
'keyPress',
176-
'textInput',
177174
'change',
178175
'changeText',
179176
'selectionChange',
180177
'contentSizeChange',
181178
'keyPress',
182-
'textInput',
183179
'change',
184180
'changeText',
185181
'selectionChange',

src/user-event/type/type.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export async function type(
5555
config: this.config,
5656
key,
5757
text: currentText,
58-
previousText,
5958
isAccepted,
6059
});
6160
}
@@ -76,13 +75,12 @@ type EmitTypingEventsContext = {
7675
config: UserEventConfig;
7776
key: string;
7877
text: string;
79-
previousText: string;
8078
isAccepted?: boolean;
8179
};
8280

8381
export async function emitTypingEvents(
8482
element: ReactTestInstance,
85-
{ config, key, text, previousText, isAccepted }: EmitTypingEventsContext,
83+
{ config, key, text, isAccepted }: EmitTypingEventsContext,
8684
) {
8785
const isMultiline = element.props.multiline === true;
8886

@@ -96,12 +94,6 @@ export async function emitTypingEvents(
9694
return;
9795
}
9896

99-
// According to the docs only multiline TextInput emits textInput event
100-
// @see: https://github.com/facebook/react-native/blob/42a2898617da1d7a98ef574a5b9e500681c8f738/packages/react-native/Libraries/Components/TextInput/TextInput.d.ts#L754
101-
if (isMultiline) {
102-
dispatchEvent(element, 'textInput', EventBuilder.TextInput.textInput(text, previousText));
103-
}
104-
10597
dispatchEvent(element, 'change', EventBuilder.TextInput.change(text));
10698
dispatchEvent(element, 'changeText', text);
10799

0 commit comments

Comments
 (0)