@@ -23,7 +23,7 @@ const {
23
23
findByRole,
24
24
} = queries
25
25
26
- async function testQueries ( ) {
26
+ export async function testQueries ( ) {
27
27
// element queries
28
28
const element = document . createElement ( 'div' )
29
29
getByText ( element , 'foo' )
@@ -46,7 +46,7 @@ async function testQueries() {
46
46
await screen . findAllByText ( 'bar' , undefined , { timeout : 10 } )
47
47
}
48
48
49
- async function testQueryHelpers ( ) {
49
+ export async function testQueryHelpers ( ) {
50
50
const element = document . createElement ( 'div' )
51
51
const includesAutomationId = ( content : string , automationId : string ) =>
52
52
content . split ( / \s + / ) . some ( id => id === automationId )
@@ -78,16 +78,16 @@ async function testQueryHelpers() {
78
78
queryByAutomationId ( element , 'id' )
79
79
getAllByAutomationId ( element , 'id' )
80
80
getByAutomationId ( element , [ 'id' , 'automationId' ] )
81
- findAllByAutomationId ( element , 'id' , { } , { timeout : 1000 } )
82
- findByAutomationId ( element , 'id' , { } , { timeout : 1000 } )
81
+ await findAllByAutomationId ( element , 'id' , { } , { timeout : 1000 } )
82
+ await findByAutomationId ( element , 'id' , { } , { timeout : 1000 } )
83
83
// test optional params too
84
- findAllByAutomationId ( element , 'id' , { } )
85
- findByAutomationId ( element , 'id' , { } )
86
- findAllByAutomationId ( element , 'id' )
87
- findByAutomationId ( element , 'id' )
84
+ await findAllByAutomationId ( element , 'id' , { } )
85
+ await findByAutomationId ( element , 'id' , { } )
86
+ await findAllByAutomationId ( element , 'id' )
87
+ await findByAutomationId ( element , 'id' )
88
88
}
89
89
90
- async function testByRole ( ) {
90
+ export async function testByRole ( ) {
91
91
const element = document . createElement ( 'button' )
92
92
element . setAttribute ( 'aria-hidden' , 'true' )
93
93
@@ -115,8 +115,7 @@ async function testByRole() {
115
115
console . assert ( queryByRole ( element , 'button' , { name : / ^ L o g / } ) === null )
116
116
console . assert (
117
117
queryByRole ( element , 'button' , {
118
- name : ( name , element ) =>
119
- name === 'Login' && element . hasAttribute ( 'disabled' ) ,
118
+ name : ( name , el ) => name === 'Login' && el . hasAttribute ( 'disabled' ) ,
120
119
} ) === null ,
121
120
)
122
121
@@ -127,12 +126,12 @@ async function testByRole() {
127
126
console . assert ( screen . queryByRole ( / f o o / ) === null )
128
127
}
129
128
130
- function testA11yHelper ( ) {
129
+ export function testA11yHelper ( ) {
131
130
const element = document . createElement ( 'svg' )
132
131
console . assert ( ! isInaccessible ( element ) )
133
132
}
134
133
135
- function eventTest ( ) {
134
+ export function eventTest ( ) {
136
135
fireEvent . popState ( window , {
137
136
location : 'http://www.example.com/?page=1' ,
138
137
state : { page : 1 } ,
@@ -156,7 +155,7 @@ function eventTest() {
156
155
fireEvent ( element , customEvent )
157
156
}
158
157
159
- async function testWaitFors ( ) {
158
+ export async function testWaitFors ( ) {
160
159
const element = document . createElement ( 'div' )
161
160
162
161
await waitFor ( ( ) => getByText ( element , 'apple' ) )
@@ -181,3 +180,8 @@ async function testWaitFors() {
181
180
182
181
await waitFor ( async ( ) => { } )
183
182
}
183
+
184
+ /*
185
+ eslint
186
+ @typescript -eslint/no-unnecessary-condition: "off",
187
+ */
0 commit comments