Skip to content

Commit

Permalink
fix(no-autoplay-audio): add reviewOnFail and update tests (#3557)
Browse files Browse the repository at this point in the history
* fix(no-autoplay-audio): add reviewOnFail and update tests

* fix(no-autoplay-audio): add incomplete example to isolated-env test
  • Loading branch information
pschwendy authored Aug 2, 2022
1 parent 7843ff9 commit 60ec997
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 34 deletions.
22 changes: 11 additions & 11 deletions doc/rule-descriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
| [marquee](https://dequeuniversity.com/rules/axe/4.4/marquee?application=RuleDescription) | Ensures <marquee> elements are not used | Serious | cat.parsing, wcag2a, wcag222 | failure | |
| [meta-refresh](https://dequeuniversity.com/rules/axe/4.4/meta-refresh?application=RuleDescription) | Ensures <meta http-equiv="refresh"> is not used for delayed refresh | Critical | cat.time-and-media, wcag2a, wcag221, wcag224, wcag325 | failure | [bc659a](https://act-rules.github.io/rules/bc659a) |
| [nested-interactive](https://dequeuniversity.com/rules/axe/4.4/nested-interactive?application=RuleDescription) | Ensures interactive controls are not nested as they are not always announced by screen readers or can cause focus problems for assistive technologies | Serious | cat.keyboard, wcag2a, wcag412 | failure, needs review | [307n5z](https://act-rules.github.io/rules/307n5z) |
| [no-autoplay-audio](https://dequeuniversity.com/rules/axe/4.4/no-autoplay-audio?application=RuleDescription) | Ensures <video> or <audio> elements do not autoplay audio for more than 3 seconds without a control mechanism to stop or mute the audio | Moderate | cat.time-and-media, wcag2a, wcag142, ACT | needs review | [80f0bf](https://act-rules.github.io/rules/80f0bf) |
| [object-alt](https://dequeuniversity.com/rules/axe/4.4/object-alt?application=RuleDescription) | Ensures <object> elements have alternate text | Serious | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a | failure, needs review | [8fc3b6](https://act-rules.github.io/rules/8fc3b6) |
| [role-img-alt](https://dequeuniversity.com/rules/axe/4.4/role-img-alt?application=RuleDescription) | Ensures [role='img'] elements have alternate text | Serious | cat.text-alternatives, wcag2a, wcag111, section508, section508.22.a, ACT | failure, needs review | [23a2a8](https://act-rules.github.io/rules/23a2a8) |
| [scrollable-region-focusable](https://dequeuniversity.com/rules/axe/4.4/scrollable-region-focusable?application=RuleDescription) | Ensure elements that have scrollable content are accessible by keyboard | Moderate | cat.keyboard, wcag2a, wcag211 | failure | [0ssw9k](https://act-rules.github.io/rules/0ssw9k) |
Expand Down Expand Up @@ -126,17 +127,16 @@ Rules that check for conformance to WCAG AAA success criteria that can be fully

Rules we are still testing and developing. They are not enabled by default in axe-core, but are enabled for the axe browser extensions.

| Rule ID | Description | Impact | Tags | Issue Type | ACT Rules |
| :------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | :--------------------------------------------------------------------- | :------------------------- | :------------------------------------------------- |
| [css-orientation-lock](https://dequeuniversity.com/rules/axe/4.4/css-orientation-lock?application=RuleDescription) | Ensures content is not locked to any specific display orientation, and the content is operable in all display orientations | Serious | cat.structure, wcag134, wcag21aa, experimental | failure, needs review | [b33eff](https://act-rules.github.io/rules/b33eff) |
| [focus-order-semantics](https://dequeuniversity.com/rules/axe/4.4/focus-order-semantics?application=RuleDescription) | Ensures elements in the focus order have a role appropriate for interactive content | Minor | cat.keyboard, best-practice, experimental | failure | |
| [hidden-content](https://dequeuniversity.com/rules/axe/4.4/hidden-content?application=RuleDescription) | Informs users about hidden content. | Minor | cat.structure, experimental, review-item, best-practice | failure, needs review | |
| [label-content-name-mismatch](https://dequeuniversity.com/rules/axe/4.4/label-content-name-mismatch?application=RuleDescription) | Ensures that elements labelled through their content must have their visible text as part of their accessible name | Serious | cat.semantics, wcag21a, wcag253, experimental | failure | [2ee8b8](https://act-rules.github.io/rules/2ee8b8) |
| [link-in-text-block](https://dequeuniversity.com/rules/axe/4.4/link-in-text-block?application=RuleDescription) | Ensure links are distinguished from surrounding text in a way that does not rely on color | Serious | cat.color, experimental, wcag2a, wcag141 | failure, needs review | |
| [no-autoplay-audio](https://dequeuniversity.com/rules/axe/4.4/no-autoplay-audio?application=RuleDescription) | Ensures <video> or <audio> elements do not autoplay audio for more than 3 seconds without a control mechanism to stop or mute the audio | Moderate | cat.time-and-media, wcag2a, wcag142, experimental, ACT | failure, needs review | [80f0bf](https://act-rules.github.io/rules/80f0bf) |
| [p-as-heading](https://dequeuniversity.com/rules/axe/4.4/p-as-heading?application=RuleDescription) | Ensure bold, italic text and font-size is not used to style <p> elements as a heading | Serious | cat.semantics, wcag2a, wcag131, experimental | failure, needs review | |
| [table-fake-caption](https://dequeuniversity.com/rules/axe/4.4/table-fake-caption?application=RuleDescription) | Ensure that tables with a caption use the <caption> element. | Serious | cat.tables, experimental, wcag2a, wcag131, section508, section508.22.g | failure | |
| [td-has-header](https://dequeuniversity.com/rules/axe/4.4/td-has-header?application=RuleDescription) | Ensure that each non-empty data cell in a <table> larger than 3 by 3 has one or more table headers | Critical | cat.tables, experimental, wcag2a, wcag131, section508, section508.22.g | failure | |
| Rule ID | Description | Impact | Tags | Issue Type | ACT Rules |
| :------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------- | :------- | :--------------------------------------------------------------------- | :------------------------- | :------------------------------------------------- |
| [css-orientation-lock](https://dequeuniversity.com/rules/axe/4.4/css-orientation-lock?application=RuleDescription) | Ensures content is not locked to any specific display orientation, and the content is operable in all display orientations | Serious | cat.structure, wcag134, wcag21aa, experimental | failure, needs review | [b33eff](https://act-rules.github.io/rules/b33eff) |
| [focus-order-semantics](https://dequeuniversity.com/rules/axe/4.4/focus-order-semantics?application=RuleDescription) | Ensures elements in the focus order have a role appropriate for interactive content | Minor | cat.keyboard, best-practice, experimental | failure | |
| [hidden-content](https://dequeuniversity.com/rules/axe/4.4/hidden-content?application=RuleDescription) | Informs users about hidden content. | Minor | cat.structure, experimental, review-item, best-practice | failure, needs review | |
| [label-content-name-mismatch](https://dequeuniversity.com/rules/axe/4.4/label-content-name-mismatch?application=RuleDescription) | Ensures that elements labelled through their content must have their visible text as part of their accessible name | Serious | cat.semantics, wcag21a, wcag253, experimental | failure | [2ee8b8](https://act-rules.github.io/rules/2ee8b8) |
| [link-in-text-block](https://dequeuniversity.com/rules/axe/4.4/link-in-text-block?application=RuleDescription) | Ensure links are distinguished from surrounding text in a way that does not rely on color | Serious | cat.color, experimental, wcag2a, wcag141 | failure, needs review | |
| [p-as-heading](https://dequeuniversity.com/rules/axe/4.4/p-as-heading?application=RuleDescription) | Ensure bold, italic text and font-size is not used to style <p> elements as a heading | Serious | cat.semantics, wcag2a, wcag131, experimental | failure, needs review | |
| [table-fake-caption](https://dequeuniversity.com/rules/axe/4.4/table-fake-caption?application=RuleDescription) | Ensure that tables with a caption use the <caption> element. | Serious | cat.tables, experimental, wcag2a, wcag131, section508, section508.22.g | failure | |
| [td-has-header](https://dequeuniversity.com/rules/axe/4.4/td-has-header?application=RuleDescription) | Ensure that each non-empty data cell in a <table> larger than 3 by 3 has one or more table headers | Critical | cat.tables, experimental, wcag2a, wcag131, section508, section508.22.g | failure | |

## Deprecated Rules

Expand Down
3 changes: 2 additions & 1 deletion lib/rules/no-autoplay-audio.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"excludeHidden": false,
"selector": "audio[autoplay], video[autoplay]",
"matches": "no-autoplay-audio-matches",
"tags": ["cat.time-and-media", "wcag2a", "wcag142", "experimental", "ACT"],
"reviewOnFail": true,
"tags": ["cat.time-and-media", "wcag2a", "wcag142", "ACT"],
"actIds": ["80f0bf"],
"metadata": {
"description": "Ensures <video> or <audio> elements do not autoplay audio for more than 3 seconds without a control mechanism to stop or mute the audio",
Expand Down
5 changes: 5 additions & 0 deletions test/integration/full/isolated-env/isolated-env.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ <h2>Ok</h2>
<span id="pass1"></span>
<button id="pass2"></button>
<div aria-labelledby="fail1 pass1 pass2"></div>
<audio
id="incomplete1"
src="/test/assets/moon-speech.mp3"
autoplay="true"
></audio>
</main>
<footer></footer>

Expand Down
18 changes: 9 additions & 9 deletions test/integration/full/no-autoplay-audio/no-autoplay-audio.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,26 @@
controls
></audio>

<!-- Failed -->
<!-- fail 1 -->
<!-- Incomplete -->
<!-- incomplete 1 -->
<audio
id="fail1"
id="incomplete1"
src="/test/assets/moon-speech.mp3"
autoplay="true"
></audio>
<!-- fail 2 -->
<video id="fail2" autoplay="true">
<!-- incomplete 2 -->
<video id="incomplete2" autoplay="true">
<source src="/test/assets/video.webm" type="video/webm" />
<source src="/test/assets/video.mp4" type="video/mp4" />
</video>
<!-- fail 3 -->
<video id="fail3" autoplay="true" loop="true">
<!-- incomplete 3 -->
<video id="incomplete3" autoplay="true" loop="true">
<source src="/test/assets/video.webm#t=8,10" type="video/webm" />
<source src="/test/assets/video.mp4#t=8,10" type="video/mp4" />
</video>
<!-- fail 4 -->
<!-- incomplete 4 -->
<audio
id="fail4"
id="incomplete4"
src="/test/assets/moon-speech.mp3#t=1,3"
autoplay="true"
loop="true"
Expand Down
26 changes: 13 additions & 13 deletions test/integration/full/no-autoplay-audio/no-autoplay-audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,24 @@ describe('landmark-no-duplicate-main test failure', function() {
});
});

describe('violations', function() {
it('should find 4', function() {
assert.isDefined(results.violations);

var failNodes = results.violations[0].nodes;
assert.lengthOf(failNodes, 4);
assert.deepEqual(failNodes[0].target, ['#fail1']);
assert.deepEqual(failNodes[1].target, ['#fail2']);
assert.deepEqual(failNodes[2].target, ['#fail3']);
assert.deepEqual(failNodes[3].target, ['#fail4']);
});
it('should find 0 violations', function() {
assert.lengthOf(results.violations, 0);
});

it('should find 0 inapplicable', function() {
assert.lengthOf(results.inapplicable, 0);
});

it('should find 0 incomplete', function() {
assert.lengthOf(results.incomplete, 0);
describe('incomplete', function() {
it('should find 4', function() {
assert.isDefined(results.incomplete);

var incompleteNodes = results.incomplete[0].nodes;
assert.lengthOf(incompleteNodes, 4);
assert.deepEqual(incompleteNodes[0].target, ['#incomplete1']);
assert.deepEqual(incompleteNodes[1].target, ['#incomplete2']);
assert.deepEqual(incompleteNodes[2].target, ['#incomplete3']);
assert.deepEqual(incompleteNodes[3].target, ['#incomplete4']);
});
});
});

0 comments on commit 60ec997

Please sign in to comment.