Skip to content

Commit

Permalink
[Tests] aria-role: add now-passing test
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Oct 31, 2022
1 parent 79b975a commit 2b133ec
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion __tests__/src/rules/aria-role-test.js
Expand Up @@ -76,9 +76,11 @@ ruleTester.run('aria-role', rule, {
{ code: '<img role="presentation" />', options: ignoreNonDOMSchema },
{
code: '<Div role="button" />',
errors: [errorMessage],
settings: customDivSettings,
},
{
code: '<svg role="graphics-document document" />',
},
].concat(validTests).map(parserOptionsMapper),

invalid: [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -70,7 +70,7 @@
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.19.4",
"aria-query": "^5.1.1",
"aria-query": "^5.1.3",
"array-includes": "^3.1.5",
"ast-types-flow": "^0.0.7",
"axe-core": "^4.5.0",
Expand Down
3 changes: 2 additions & 1 deletion src/rules/aria-role.js
Expand Up @@ -28,6 +28,8 @@ const schema = generateObjSchema({
},
});

const validRoles = new Set([...roles.keys()].filter((role) => roles.get(role).abstract === false));

export default {
meta: {
docs: {
Expand All @@ -41,7 +43,6 @@ export default {
const options = context.options[0] || {};
const ignoreNonDOM = !!options.ignoreNonDOM;
const allowedInvalidRoles = new Set(options.allowedInvalidRoles || []);
const validRoles = new Set([...roles.keys()].filter((role) => roles.get(role).abstract === false));
const elementType = getElementType(context);

return ({
Expand Down

0 comments on commit 2b133ec

Please sign in to comment.