Chromium Code Reviews| Index: LayoutTests/accessibility/name-calc-native-markup-buttons.html |
| diff --git a/LayoutTests/accessibility/name-calc-native-markup-buttons.html b/LayoutTests/accessibility/name-calc-native-markup-buttons.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8bb89f661fcbbccae5bf699d9a04a908e17e17b5 |
| --- /dev/null |
| +++ b/LayoutTests/accessibility/name-calc-native-markup-buttons.html |
| @@ -0,0 +1,122 @@ |
| +<!DOCTYPE HTML> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| + |
| +<style> |
| +.hideAllContainers .container { |
| + display: none; |
| +} |
| +</style> |
| + |
| +<div class="container"> |
| + <button id="button1"></button> |
| +</div> |
| + |
| +<script> |
| +test(function(t) { |
| + var axButton1 = accessibilityController.accessibleElementById("button1"); |
| + assert_equals(axButton1.name, ""); |
| +}, "Button with no content"); |
| +</script> |
| + |
| +<div class="container"> |
| + <button id="button2">button2-content</button> |
| +</div> |
| + |
| +<script> |
| +test(function(t) { |
| + var axButton2 = accessibilityController.accessibleElementById("button2"); |
| + assert_equals(axButton2.name, "button2-content"); |
| + assert_equals(axButton2.nameFrom, "contents"); |
| +}, "Button with text content"); |
| +</script> |
| + |
| +<div class="container"> |
| + <button id="button3"><img src="resources/cake.png"></button> |
| +</div> |
| + |
| +<script> |
| +test(function(t) { |
| + var axButton3 = accessibilityController.accessibleElementById("button3"); |
| + assert_equals(axButton3.name, ""); |
| +}, "Button with img content with no alt"); |
| +</script> |
| + |
| +<div class="container"> |
| + <button id="button4"><img src="resources/cake.png" alt="cake"></button> |
| +</div> |
| + |
| +<script> |
| +test(function(t) { |
| + var axButton4 = accessibilityController.accessibleElementById("button4"); |
| + assert_equals(axButton4.name, "cake"); |
|
dmazzoni
2015/08/24 18:02:03
I'm excited that this works correctly!
Could you
aboxhall
2015/08/25 02:45:53
Done.
It turned out it _didn't_ work, so I made a
|
| + assert_equals(axButton4.nameFrom, "contents"); |
| +}, "Button with img content with alt"); |
| +</script> |
| + |
| +<div class="container"> |
| + <button id="button5" title="button5-title"></button> |
| +</div> |
| + |
| +<script> |
| +test(function(t) { |
| + var axButton5 = accessibilityController.accessibleElementById("button5"); |
| + assert_equals(axButton5.name, "button5-title"); |
| + assert_equals(axButton5.nameFrom, "attribute"); |
| +}, "Button with title only"); |
| +</script> |
| + |
| +<div class="container"> |
| + <button id="button6" title="button6-title">button6-content</button> |
| +</div> |
| + |
| +<script> |
| +test(function(t) { |
| + var axButton6 = accessibilityController.accessibleElementById("button6"); |
| + assert_equals(axButton6.name, "button6-content"); |
| + assert_equals(axButton6.nameFrom, "contents"); |
| +}, "Button with title and contents"); |
| +</script> |
| + |
| +<div class="container"> |
| + <button id="button7" title="button7-title"><img src="resources/cake.png"></button> |
| +</div> |
| + |
| +<script> |
| +test(function(t) { |
| + var axButton7 = accessibilityController.accessibleElementById("button7"); |
| + assert_equals(axButton7.name, "button7-title"); |
| + assert_equals(axButton7.nameFrom, "attribute"); |
| +}, "Button with title and img content with no alt"); |
| +</script> |
| + |
| +<div class="container"> |
| + <button id="button8" title="button8-title"><img src="resources/cake.png" alt="cake"></button> |
| +</div> |
| + |
| +<script> |
| +test(function(t) { |
| + var axButton8 = accessibilityController.accessibleElementById("button8"); |
| + assert_equals(axButton8.name, "cake"); |
| + assert_equals(axButton8.nameFrom, "contents"); |
| +}, "Button with title and img content with alt"); |
| +</script> |
| + |
| +<div class="container"> |
| + <button id="button9">button9-content</button> |
| + <label for="button9">label-for-button9</label> |
| +</div> |
| + |
| +<script> |
| +test(function(t) { |
| + var axButton9 = accessibilityController.accessibleElementById("button9"); |
| + assert_equals(axButton9.name, "label-for-button9"); |
| + assert_equals(axButton9.nameFrom, "relatedElement"); |
| +}, "Button with text content and label"); |
| +</script> |
| + |
| + |
| +<script> |
| +if (window.testRunner) |
| + document.body.className = "hideAllContainers"; |
| +</script> |