Skip to content

Commit 701362f

Browse files
committed
test(template-no-unsupported-role-attributes): absorb audit-fixture cases, drop audit fixture
Upstream maintainers don't want the per-PR `tests/audit/peer-parity` pattern. Port two unique audit cases into the regular suite: - `<body aria-expanded=...>` — pins our implicit-role resolution ("generic" via aria-query, vs jsx-a11y's "document"); both flag, message differs. - `<a aria-checked />` — acknowledged false-positive vs jsx-a11y; we resolve href-less <a> to implicit role "generic" where aria-checked is unsupported, jsx-a11y treats it as having no role and accepts. All other audit cases were already covered by the regular tests.
1 parent 44182f9 commit 701362f

2 files changed

Lines changed: 24 additions & 213 deletions

File tree

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

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

tests/lib/rules/template-no-unsupported-role-attributes.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,30 @@ const invalidHbs = [
124124
output: '{{foo-component role="button"}}',
125125
errors: [{ message: 'The attribute aria-valuetext is not supported by the role button' }],
126126
},
127+
// Documented divergence with jsx-a11y on implicit role for <body>.
128+
// jsx-a11y resolves <body> to role "document"; aria-query (which our rule
129+
// uses) resolves to "generic". aria-expanded is unsupported by either, so
130+
// both plugins flag — only the role-name in the message differs.
131+
{
132+
code: '<body aria-expanded="true"></body>',
133+
output: '<body></body>',
134+
errors: [
135+
{
136+
message:
137+
'The attribute aria-expanded is not supported by the element body with the implicit role of generic',
138+
},
139+
],
140+
},
141+
// Documented divergence — <a> WITHOUT href, with a non-global aria attr.
142+
// jsx-a11y treats href-less <a> as having no implicit role and accepts the
143+
// attribute under the global aria set (VALID). Our rule resolves the
144+
// implicit role to "generic" via aria-query, where aria-checked is not
145+
// supported, so we flag. Acknowledged false-positive vs jsx-a11y.
146+
{
147+
code: '<a aria-checked />',
148+
output: '<a />',
149+
errors: [{ messageId: 'unsupportedImplicit' }],
150+
},
127151
];
128152

129153
function wrapTemplate(entry) {

0 commit comments

Comments
 (0)