-
Notifications
You must be signed in to change notification settings - Fork 791
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jkodu
authored and
jkodu
committed
Jan 20, 2020
1 parent
1ea98ba
commit 0f3f6df
Showing
4 changed files
with
165 additions
and
68 deletions.
There are no files selected for viewing
107 changes: 107 additions & 0 deletions
107
test/integration/full/no-autoplay-audio/no-autoplay-audio.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,107 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<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> | ||
<div id="fixture"> | ||
<!-- Passed --> | ||
<!-- pass 1 --> | ||
<audio | ||
id="pass1" | ||
src="/test/assets/moon-speech.mp3" | ||
autoplay="true" | ||
controls | ||
></audio> | ||
<!-- pass 2 --> | ||
<video id="pass2" autoplay="true" controls> | ||
<source src="/test/assets/video.webm" type="video/webm" /> | ||
<source src="/test/assets/video.mp4" type="video/mp4" /> | ||
</video> | ||
<!-- pass 3 --> | ||
<audio | ||
id="pass3" | ||
src="/test/assets/moon-speech.mp3#t=25" | ||
autoplay="true" | ||
></audio> | ||
<!-- pass 4 --> | ||
<video id="pass4" autoplay="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> | ||
<!-- pass 5 --> | ||
<!-- pass 1 --> | ||
<audio | ||
id="pass5" | ||
src="/test/assets/moon-speech.mp3" | ||
autoplay | ||
controls | ||
></audio> | ||
|
||
<!-- Failed --> | ||
<!-- fail 1 --> | ||
<audio | ||
id="fail1" | ||
src="/test/assets/moon-speech.mp3" | ||
autoplay="true" | ||
></audio> | ||
<!-- fail 2 --> | ||
<video id="fail2" 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"> | ||
<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 --> | ||
<audio | ||
id="fail4" | ||
src="/test/assets/moon-speech.mp3#t=1,3" | ||
autoplay="true" | ||
loop="true" | ||
></audio> | ||
|
||
<!-- Inapplicable --> | ||
<!-- inapplicable 1 --> | ||
<video id="inapplicable1" autoplay="true" muted="true"> | ||
<source src="/test/assets/video.webm" type="video/webm" /> | ||
<source src="/test/assets/video.mp4" type="video/mp4" /> | ||
</video> | ||
<!-- inapplicable 2 --> | ||
<audio | ||
id="inapplicable2" | ||
src="/test/assets/moon-speech.mp3" | ||
controls | ||
></audio> | ||
<!-- inapplicable 3 --> | ||
<video id="inapplicable3" autoplay="true" paused="true"> | ||
<source src="/test/assets/video.webm" type="video/webm" /> | ||
<source src="/test/assets/video.mp4" type="video/mp4" /> | ||
</video> | ||
</div> | ||
|
||
<div id="mocha"></div> | ||
|
||
<script src="/test/testutils.js"></script> | ||
<script src="no-autoplay-audio.js"></script> | ||
<script src="/test/integration/adapter.js"></script> | ||
</body> | ||
</html> |
58 changes: 58 additions & 0 deletions
58
test/integration/full/no-autoplay-audio/no-autoplay-audio.js
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,58 @@ | ||
describe('landmark-no-duplicate-main test failure', function() { | ||
'use strict'; | ||
|
||
var results; | ||
var isIE11 = axe.testUtils.isIE11; | ||
|
||
before(function(done) { | ||
if (isIE11) { | ||
this.skip(); | ||
} else { | ||
axe.testUtils.awaitNestedLoad(function() { | ||
axe.run( | ||
{ runOnly: { type: 'rule', values: ['no-autoplay-audio'] } }, | ||
function(err, r) { | ||
assert.isNull(err); | ||
results = r; | ||
done(); | ||
} | ||
); | ||
}); | ||
} | ||
}); | ||
|
||
describe('passes', function() { | ||
it('should find 5', function() { | ||
assert.isDefined(results.passes); | ||
|
||
var passNodes = results.passes[0].nodes; | ||
assert.lengthOf(passNodes, 5); | ||
assert.deepEqual(passNodes[0].target, ['#pass1']); | ||
assert.deepEqual(passNodes[1].target, ['#pass2']); | ||
assert.deepEqual(passNodes[2].target, ['#pass3']); | ||
assert.deepEqual(passNodes[3].target, ['#pass4']); | ||
assert.deepEqual(passNodes[4].target, ['#pass5']); | ||
}); | ||
}); | ||
|
||
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 inapplicable', function() { | ||
assert.lengthOf(results.inapplicable, 0); | ||
}); | ||
|
||
it('should find 0 incomplete', function() { | ||
assert.lengthOf(results.incomplete, 0); | ||
}); | ||
}); |
62 changes: 0 additions & 62 deletions
62
test/integration/rules/no-autoplay-audio/no-autoplay-audio.html
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
test/integration/rules/no-autoplay-audio/no-autoplay-audio.json
This file was deleted.
Oops, something went wrong.