Skip to content

Commit 7bb9eb1

Browse files
committed
fix: type tests
1 parent 95fb415 commit 7bb9eb1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

types/__tests__/type-tests.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,18 @@ export async function testByRole() {
178178
console.assert(queryByRole(element, 'button', {name: /^Log/}) === null)
179179
console.assert(
180180
queryByRole(element, 'button', {
181-
name: (name, el) => name === 'Login' && !!el?.hasAttribute('disabled'),
181+
name: (name, el) => name === 'Login' && el.hasAttribute('disabled'),
182182
}) === null,
183183
)
184+
185+
// @ts-expect-error: allow to query for a role that isn't included in the types
186+
console.assert(queryByRole(element, 'foo') === null)
187+
// @ts-expect-error: allow to query for a role that isn't included in the types
188+
console.assert(queryByRole(element, /foo/) === null)
189+
// @ts-expect-error: allow to query for a role that isn't included in the types
190+
console.assert(screen.queryByRole('foo') === null)
191+
// @ts-expect-error: allow to query for a role that isn't included in the types
192+
console.assert(screen.queryByRole(/foo/) === null)
184193
}
185194

186195
export function testA11yHelper() {

0 commit comments

Comments
 (0)