File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {
1010 waitForElementToBeRemoved ,
1111 MatcherOptions ,
1212 BoundFunctions ,
13+ within ,
1314} from '@testing-library/dom'
1415
1516const {
@@ -228,6 +229,18 @@ export async function testWaitFors() {
228229 await waitFor ( async ( ) => { } )
229230}
230231
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+
231244/*
232245eslint
233246 @typescript -eslint/no-unnecessary-condition: "off",
You can’t perform that action at this time.
0 commit comments