Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.

Commit 8defba6

Browse files
committed
test(fixture): make scoping test case more representative of intended usage
Also, update the description for the same reason.
1 parent 5aef5b8 commit 8defba6

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

test/fixture/fixture.test.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,9 @@ test.describe('lib/fixture.ts', () => {
147147
expect(await $h3.textContent()).toEqual('Hello h3')
148148
})
149149

150-
test('should work with destructuring', async ({page}) => {
151-
const document = await getDocument(page)
152-
const scope = await document.$('#scoped')
153-
150+
test('scoping queries with `within`', async ({queries: {getByTestId}}) => {
154151
// eslint-disable-next-line @typescript-eslint/unbound-method
155-
const {queryByText} = within(scope)
152+
const {queryByText} = within(await getByTestId('scoped'))
156153

157154
expect(await queryByText('Hello h1')).toBeFalsy()
158155
expect(await queryByText('Hello h3')).toBeTruthy()

test/fixtures/page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ <h2 data-id="second-level-header">Hello h2</h2>
99
<input id="label-text-input" type="text" />
1010

1111
<button role="button">getByRole Test</button>
12-
<div id="scoped">
12+
<div id="scoped" data-testid="scoped">
1313
<h3>Hello h3</h3>
1414
</div>
1515

0 commit comments

Comments
 (0)