Skip to content

Commit 491cf79

Browse files
committed
refactor: re-organize waits
1 parent b5564b5 commit 491cf79

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/user-event/type/type.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@ export async function type(
3333
const keys = parseKeys(text);
3434

3535
if (!options?.skipPress) {
36-
await wait(this.config);
3736
dispatchOwnHostEvent(element, 'pressIn', EventBuilder.Common.touch());
3837
}
3938

40-
await wait(this.config);
4139
dispatchOwnHostEvent(element, 'focus', EventBuilder.Common.focus());
4240

4341
if (!options?.skipPress) {
42+
await wait(this.config);
4443
dispatchOwnHostEvent(element, 'pressOut', EventBuilder.Common.touch());
4544
}
4645

@@ -55,21 +54,22 @@ export async function type(
5554

5655
const finalText = element.props.value ?? currentText;
5756

57+
await wait(this.config);
58+
5859
if (options?.submitEditing) {
59-
await wait(this.config);
6060
dispatchOwnHostEvent(
6161
element,
6262
'submitEditing',
6363
EventBuilder.TextInput.submitEditing(finalText)
6464
);
6565
}
6666

67-
await wait(this.config);
6867
dispatchOwnHostEvent(
6968
element,
7069
'endEditing',
7170
EventBuilder.TextInput.endEditing(finalText)
7271
);
72+
7373
dispatchOwnHostEvent(element, 'blur', EventBuilder.Common.blur());
7474
}
7575

0 commit comments

Comments
 (0)