1
1
import { ReactTestInstance } from 'react-test-renderer' ;
2
- import { getConfig } from '../../config ' ;
2
+ import { getHostComponentNames } from '../../helpers/host-component-names ' ;
3
3
import { EventBuilder } from '../event-builder' ;
4
4
import { ErrorWithStack } from '../../helpers/errors' ;
5
5
import { UserEventInstance } from '../setup' ;
@@ -23,7 +23,7 @@ export async function type(
23
23
text : string ,
24
24
options ?: TypeOptions
25
25
) : Promise < void > {
26
- if ( element . type !== getConfig ( ) . hostComponentNames ? .textInput ) {
26
+ if ( element . type !== getHostComponentNames ( ) . textInput ) {
27
27
throw new ErrorWithStack (
28
28
`type() works only with "TextInput" elements. Passed element has type "${ element . type } ".` ,
29
29
type
@@ -32,15 +32,15 @@ export async function type(
32
32
33
33
const keys = parseKeys ( text ) ;
34
34
35
- if ( options ?. skipPress !== true ) {
35
+ if ( ! options ?. skipPress ) {
36
36
await wait ( this . config ) ;
37
37
dispatchOwnHostEvent ( element , 'pressIn' , EventBuilder . Common . touch ( ) ) ;
38
38
}
39
39
40
40
await wait ( this . config ) ;
41
41
dispatchOwnHostEvent ( element , 'focus' , EventBuilder . Common . focus ( ) ) ;
42
42
43
- if ( options ?. skipPress !== true ) {
43
+ if ( ! options ?. skipPress ) {
44
44
dispatchOwnHostEvent ( element , 'pressOut' , EventBuilder . Common . touch ( ) ) ;
45
45
}
46
46
@@ -55,7 +55,7 @@ export async function type(
55
55
56
56
const finalText = element . props . value ?? currentText ;
57
57
58
- if ( options ?. submitEditing === true ) {
58
+ if ( options ?. submitEditing ) {
59
59
await wait ( this . config ) ;
60
60
dispatchOwnHostEvent (
61
61
element ,
0 commit comments