Skip to content

Commit 5919767

Browse files
committed
test(template-no-invalid-role): absorb audit-fixture cases, drop audit fixture
Upstream maintainers don't want the per-PR `tests/audit/peer-parity` pattern. Port two cases that pinned distinct behavior: - `role=""` as VALID — documented divergence; we early-return on empty/whitespace role values where jsx-a11y / vue-a11y flag. - `role="datepicker"` as INVALID — common authoring confusion that exercises the unknown-role path with a more likely real-world typo than `role="invalid"`. Other audit cases were already covered by the regular tests.
1 parent 909e56d commit 5919767

2 files changed

Lines changed: 13 additions & 159 deletions

File tree

tests/audit/aria-role/peer-parity.js

Lines changed: 0 additions & 159 deletions
This file was deleted.

tests/lib/rules/template-no-invalid-role.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,22 @@ ruleTester.run('template-no-invalid-role', rule, {
9494
'<template><div role="associationlistitemvalue"></div></template>',
9595
'<template><div role="comment"></div></template>',
9696
'<template><div role="suggestion"></div></template>',
97+
98+
// Documented divergence — empty role string. jsx-a11y / vue-a11y flag
99+
// it; our rule early-returns on empty/whitespace role values, so we
100+
// don't. Pin our current behavior.
101+
'<template><div role=""></div></template>',
97102
],
98103

99104
invalid: [
105+
// Common authoring confusion — `datepicker` looks like it could be a
106+
// role (it's a UI concept) but isn't in the ARIA registry. Same lookup
107+
// path as `role="invalid"`, exercised here for the more likely typo.
108+
{
109+
code: '<template><div role="datepicker"></div></template>',
110+
output: null,
111+
errors: [{ messageId: 'invalid' }],
112+
},
100113
{
101114
code: `<template>
102115
<div role="invalid">Content</div>

0 commit comments

Comments
 (0)