OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> |
| 4 |
| 5 <style> |
| 6 .hideAllContainers .container { |
| 7 display: none; |
| 8 } |
| 9 </style> |
| 10 |
| 11 <div class="container"> |
| 12 <button id="button1"></button> |
| 13 </div> |
| 14 |
| 15 <script> |
| 16 test(function(t) { |
| 17 var axButton1 = accessibilityController.accessibleElementById("button1"); |
| 18 assert_equals(axButton1.name, ""); |
| 19 }, "Button with no content"); |
| 20 </script> |
| 21 |
| 22 <div class="container"> |
| 23 <button id="button2">button2-content</button> |
| 24 </div> |
| 25 |
| 26 <script> |
| 27 test(function(t) { |
| 28 var axButton2 = accessibilityController.accessibleElementById("button2"); |
| 29 assert_equals(axButton2.name, "button2-content"); |
| 30 assert_equals(axButton2.nameFrom, "contents"); |
| 31 }, "Button with text content"); |
| 32 </script> |
| 33 |
| 34 <div class="container"> |
| 35 <button id="button3"><img src="resources/cake.png"></button> |
| 36 </div> |
| 37 |
| 38 <script> |
| 39 test(function(t) { |
| 40 var axButton3 = accessibilityController.accessibleElementById("button3"); |
| 41 assert_equals(axButton3.name, ""); |
| 42 }, "Button with img content with no alt"); |
| 43 </script> |
| 44 |
| 45 <div class="container"> |
| 46 <button id="button4"><img src="resources/cake.png" alt="cake"></button> |
| 47 </div> |
| 48 |
| 49 <script> |
| 50 test(function(t) { |
| 51 var axButton4 = accessibilityController.accessibleElementById("button4"); |
| 52 assert_equals(axButton4.name, "cake"); |
| 53 assert_equals(axButton4.nameFrom, "contents"); |
| 54 }, "Button with img content with alt"); |
| 55 </script> |
| 56 |
| 57 <div class="container"> |
| 58 <button id="button5">I love <img src="resources/cake.png">!</button> |
| 59 </div> |
| 60 |
| 61 <script> |
| 62 test(function(t) { |
| 63 var axButton5 = accessibilityController.accessibleElementById("button5"); |
| 64 assert_equals(axButton5.name, "I love !"); |
| 65 assert_equals(axButton5.nameFrom, "contents"); |
| 66 }, "Button with text content and img content with no alt"); |
| 67 </script> |
| 68 |
| 69 <div class="container"> |
| 70 <button id="button6">I love <img src="resources/cake.png" alt="cake">!</butt
on> |
| 71 </div> |
| 72 |
| 73 <script> |
| 74 test(function(t) { |
| 75 var axButton6 = accessibilityController.accessibleElementById("button6"); |
| 76 assert_equals(axButton6.name, "I love cake!"); |
| 77 assert_equals(axButton6.nameFrom, "contents"); |
| 78 }, "Button with text content and img content with alt"); |
| 79 </script> |
| 80 |
| 81 <div class="container"> |
| 82 <button id="button7" title="button7-title"></button> |
| 83 </div> |
| 84 |
| 85 <script> |
| 86 test(function(t) { |
| 87 var axButton7 = accessibilityController.accessibleElementById("button7"); |
| 88 assert_equals(axButton7.name, "button7-title"); |
| 89 assert_equals(axButton7.nameFrom, "attribute"); |
| 90 }, "Button with title only"); |
| 91 </script> |
| 92 |
| 93 <div class="container"> |
| 94 <button id="button8" title="button8-title">button8-content</button> |
| 95 </div> |
| 96 |
| 97 <script> |
| 98 test(function(t) { |
| 99 var axButton8 = accessibilityController.accessibleElementById("button8"); |
| 100 assert_equals(axButton8.name, "button8-content"); |
| 101 assert_equals(axButton8.nameFrom, "contents"); |
| 102 }, "Button with title and contents"); |
| 103 </script> |
| 104 |
| 105 <div class="container"> |
| 106 <button id="button9" title="button9-title"><img src="resources/cake.png"></b
utton> |
| 107 </div> |
| 108 |
| 109 <script> |
| 110 test(function(t) { |
| 111 var axButton9 = accessibilityController.accessibleElementById("button9"); |
| 112 assert_equals(axButton9.name, "button9-title"); |
| 113 assert_equals(axButton9.nameFrom, "attribute"); |
| 114 }, "Button with title and img content with no alt"); |
| 115 </script> |
| 116 |
| 117 <div class="container"> |
| 118 <button id="button10" title="button10-title"><img src="resources/cake.png" a
lt="cake"></button> |
| 119 </div> |
| 120 |
| 121 <script> |
| 122 test(function(t) { |
| 123 var axButton10 = accessibilityController.accessibleElementById("button10"); |
| 124 assert_equals(axButton10.name, "cake"); |
| 125 assert_equals(axButton10.nameFrom, "contents"); |
| 126 }, "Button with title and img content with alt"); |
| 127 </script> |
| 128 |
| 129 <div class="container"> |
| 130 <button id="button11">button11-content</button> |
| 131 <label for="button11">label-for-button11</label> |
| 132 </div> |
| 133 |
| 134 <script> |
| 135 test(function(t) { |
| 136 var axButton11 = accessibilityController.accessibleElementById("button11"); |
| 137 assert_equals(axButton11.name, "label-for-button11"); |
| 138 assert_equals(axButton11.nameFrom, "relatedElement"); |
| 139 }, "Button with text content and label"); |
| 140 </script> |
| 141 |
| 142 |
| 143 <script> |
| 144 if (window.testRunner) |
| 145 document.body.className = "hideAllContainers"; |
| 146 </script> |
OLD | NEW |