-
Notifications
You must be signed in to change notification settings - Fork 779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(aria-roledescription): keep disabled with { runOnly: 'wcag2a' } #4526
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!doctype html> | ||
<html lang="en" xml:lang="en"> | ||
<head> | ||
<title>axe.configure({ tagExclude }) test</title> | ||
<meta charset="utf8" /> | ||
<link | ||
rel="stylesheet" | ||
type="text/css" | ||
href="/node_modules/mocha/mocha.css" | ||
/> | ||
<script src="/node_modules/mocha/mocha.js"></script> | ||
<script src="/node_modules/chai/chai.js"></script> | ||
<script src="/axe.js"></script> | ||
<script> | ||
mocha.setup({ | ||
timeout: 10000, | ||
ui: 'bdd' | ||
}); | ||
var assert = chai.assert; | ||
</script> | ||
</head> | ||
<body> | ||
<p aria-roledescription="my paragraph" id="deprecated">paragraph</p> | ||
<div role="link" aria-label="OK" id="experimental">Next</div> | ||
|
||
<div id="mocha"></div> | ||
<script src="/test/integration/no-ui-reporter.js"></script> | ||
<script src="/test/testutils.js"></script> | ||
<script src="tag-exclude.js"></script> | ||
<script src="/test/integration/adapter.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
describe('all rules test', () => { | ||
const experimentalRuleId = 'label-content-name-mismatch'; | ||
const deprecatedRuleId = 'aria-roledescription'; | ||
|
||
function joinResults(results) { | ||
return [ | ||
...results.violations, | ||
...results.passes, | ||
...results.incomplete, | ||
...results.inapplicable | ||
]; | ||
} | ||
|
||
it('does not run experimental rules by default', async () => { | ||
const results = await axe.run({ | ||
runOnly: { | ||
type: 'tags', | ||
values: ['wcag2a', 'wcag21a'] | ||
} | ||
}); | ||
|
||
const joinedResults = joinResults(results); | ||
const experimentalResult = joinedResults.find( | ||
result => result.id === experimentalRuleId | ||
); | ||
assert.isUndefined(experimentalResult); | ||
}); | ||
|
||
it('does not run deprecated rules by default', async () => { | ||
const results = await axe.run({ | ||
runOnly: { | ||
type: 'tags', | ||
values: ['wcag2a', 'wcag21a'] | ||
} | ||
}); | ||
|
||
const joinedResults = joinResults(results); | ||
const deprecatedResult = joinedResults.find( | ||
result => result.id === deprecatedRuleId | ||
); | ||
assert.isUndefined(deprecatedResult); | ||
}); | ||
|
||
it('runs tagExclude rules when enabled with { rules }', async () => { | ||
const results = await axe.run({ | ||
runOnly: { | ||
type: 'tags', | ||
values: ['wcag2a', 'wcag21a'] | ||
}, | ||
rules: { | ||
[experimentalRuleId]: { enabled: true }, | ||
[deprecatedRuleId]: { enabled: true } | ||
} | ||
}); | ||
|
||
const joinedResults = joinResults(results); | ||
const experimentalResult = joinedResults.find( | ||
result => result.id === experimentalRuleId | ||
); | ||
const deprecatedResult = joinedResults.find( | ||
result => result.id === experimentalRuleId | ||
); | ||
assert.isDefined(experimentalResult); | ||
assert.isDefined(deprecatedResult); | ||
}); | ||
|
||
it('runs tagExclude rules when enabled with { runOnly: { type: rule } }', async () => { | ||
const results = await axe.run({ | ||
runOnly: { | ||
type: 'rule', | ||
values: [experimentalRuleId, deprecatedRuleId] | ||
} | ||
}); | ||
const joinedResults = joinResults(results); | ||
const experimentalResult = joinedResults.find( | ||
result => result.id === experimentalRuleId | ||
); | ||
const deprecatedResult = joinedResults.find( | ||
result => result.id === experimentalRuleId | ||
); | ||
assert.isDefined(experimentalResult); | ||
assert.isDefined(deprecatedResult); | ||
}); | ||
|
||
it('runs tagExclude rules when enabled with { runOnly: { type: tag } }', async () => { | ||
const results = await axe.run({ | ||
runOnly: { | ||
type: 'tag', | ||
values: ['wcag2a', 'wcag21a', 'experimental', 'deprecated'] | ||
} | ||
}); | ||
const joinedResults = joinResults(results); | ||
const experimentalResult = joinedResults.find( | ||
result => result.id === experimentalRuleId | ||
); | ||
const deprecatedResult = joinedResults.find( | ||
result => result.id === experimentalRuleId | ||
); | ||
assert.isDefined(experimentalResult); | ||
assert.isDefined(deprecatedResult); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This relies on the current state of axe and rules that could be made non-experimental or removed eventually. It would be better to configure axe with custom rules that are experimental and deprecated and test those ones instead.