Skip to content

Commit 8b89090

Browse files
committed
Merge branch 'feat/improve-error-message-when-no-window' of github.com:MatanBobi/dom-testing-library into feat/improve-error-message-when-no-window
2 parents 7e82f2f + acfd9b0 commit 8b89090

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

.all-contributorsrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,24 @@
14971497
"contributions": [
14981498
"bug"
14991499
]
1500+
},
1501+
{
1502+
"login": "robcaldecott",
1503+
"name": "Rob Caldecott",
1504+
"avatar_url": "https://avatars.githubusercontent.com/u/796702?v=4",
1505+
"profile": "https://github.com/robcaldecott",
1506+
"contributions": [
1507+
"bug"
1508+
]
1509+
},
1510+
{
1511+
"login": "Dennis273",
1512+
"name": "Dennis273",
1513+
"avatar_url": "https://avatars.githubusercontent.com/u/19815164?v=4",
1514+
"profile": "https://github.com/Dennis273",
1515+
"contributions": [
1516+
"code"
1517+
]
15001518
}
15011519
],
15021520
"repoHost": "https://github.com"

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,10 @@ Thanks goes to these people ([emoji key][emojis]):
327327
<td align="center"><a href="https://github.com/IanVS"><img src="https://avatars.githubusercontent.com/u/4616705?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ian VanSchooten</b></sub></a><br /><a href="https://github.com/testing-library/dom-testing-library/commits?author=IanVS" title="Code">💻</a></td>
328328
<td align="center"><a href="http://supervanya.com"><img src="https://avatars.githubusercontent.com/u/12336038?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vanya Prokopovich</b></sub></a><br /><a href="https://github.com/testing-library/dom-testing-library/issues?q=author%3Asupervanya" title="Bug reports">🐛</a></td>
329329
<td align="center"><a href="https://github.com/jrnail23"><img src="https://avatars.githubusercontent.com/u/392612?v=4?s=100" width="100px;" alt=""/><br /><sub><b>James Nail</b></sub></a><br /><a href="https://github.com/testing-library/dom-testing-library/issues?q=author%3Ajrnail23" title="Bug reports">🐛</a></td>
330+
<td align="center"><a href="https://github.com/robcaldecott"><img src="https://avatars.githubusercontent.com/u/796702?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Rob Caldecott</b></sub></a><br /><a href="https://github.com/testing-library/dom-testing-library/issues?q=author%3Arobcaldecott" title="Bug reports">🐛</a></td>
331+
</tr>
332+
<tr>
333+
<td align="center"><a href="https://github.com/Dennis273"><img src="https://avatars.githubusercontent.com/u/19815164?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dennis273</b></sub></a><br /><a href="https://github.com/testing-library/dom-testing-library/commits?author=Dennis273" title="Code">💻</a></td>
330334
</tr>
331335
</table>
332336

types/__tests__/type-tests.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,12 @@ export async function testWithin() {
254254

255255
await container.findByRole('button', {name: /click me/i})
256256
container.getByRole<HTMLButtonElement>('button', {name: /click me/i})
257+
258+
let withinQueries = within(document.body)
259+
withinQueries = within(document.body)
260+
withinQueries.getByRole<HTMLButtonElement>('button', {name: /click me/i})
261+
withinQueries = within(document.body)
262+
withinQueries.getByRole<HTMLButtonElement>('button', {name: /click me/i})
257263
}
258264

259265
/*

types/get-queries-for-element.d.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ export interface Queries {
175175
[T: string]: Query
176176
}
177177

178-
export function getQueriesForElement<T extends Queries = typeof queries>(
179-
element: HTMLElement,
180-
queriesToBind?: T,
181-
): BoundFunctions<T>
178+
export function getQueriesForElement<
179+
QueriesToBind extends Queries = typeof queries,
180+
// Extra type parameter required for reassignment.
181+
T extends QueriesToBind = QueriesToBind,
182+
>(element: HTMLElement, queriesToBind?: T): BoundFunctions<T>

0 commit comments

Comments
 (0)