diff --git a/src/audits/AudioWithoutControls.js b/src/audits/AudioWithoutControls.js
index 69790068..bf072838 100644
--- a/src/audits/AudioWithoutControls.js
+++ b/src/audits/AudioWithoutControls.js
@@ -27,8 +27,7 @@ axs.AuditRule.specs.audioWithoutControls = {
return axs.browserUtils.matchSelector(element, 'audio[autoplay]');
},
test: function(audio) {
- var controls = audio.querySelectorAll('[controls]');
- return !controls.length && audio.duration > 3;
+ return !audio.hasAttribute('controls') && audio.duration > 3;
},
code: 'AX_AUDIO_01'
};
diff --git a/test/audits/audio-without-controls-test.js b/test/audits/audio-without-controls-test.js
new file mode 100644
index 00000000..9404efc7
--- /dev/null
+++ b/test/audits/audio-without-controls-test.js
@@ -0,0 +1,14 @@
+module("Audio");
+
+test("Audio has no controls attribute.", function() {
+ // Setup fixture
+ var fixture = document.getElementById('qunit-fixture');
+ fixture.innerHTML = "";
+ var audio = document.querySelector('audio');
+ audio.addEventListener('canplay', function() {
+ deepEqual(
+ axs.AuditRules.getRule('audioWithoutControls').run({ scope: fixture }),
+ { elements: [ audio ], result: axs.constants.AuditResult.FAIL }
+ );
+ })
+});
\ No newline at end of file
diff --git a/test/index.html b/test/index.html
index 00025b52..0af8bcd5 100644
--- a/test/index.html
+++ b/test/index.html
@@ -42,6 +42,7 @@
+