File tree 1 file changed +13
-0
lines changed
1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {
10
10
waitForElementToBeRemoved ,
11
11
MatcherOptions ,
12
12
BoundFunctions ,
13
+ within ,
13
14
} from '@testing-library/dom'
14
15
15
16
const {
@@ -228,6 +229,18 @@ export async function testWaitFors() {
228
229
await waitFor ( async ( ) => { } )
229
230
}
230
231
232
+ export async function testWithin ( ) {
233
+ const container = within ( document . body )
234
+ container . queryAllByLabelText ( 'Some label' )
235
+
236
+ container . getByText ( 'Click me' )
237
+ container . getByText < HTMLButtonElement > ( 'Click me' )
238
+ container . getAllByText < HTMLButtonElement > ( 'Click me' )
239
+
240
+ await container . findByRole ( 'button' , { name : / c l i c k m e / i} )
241
+ container . getByRole < HTMLButtonElement > ( 'button' , { name : / c l i c k m e / i} )
242
+ }
243
+
231
244
/*
232
245
eslint
233
246
@typescript -eslint/no-unnecessary-condition: "off",
You can’t perform that action at this time.
0 commit comments