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 <input id="text1" type="text"> |
| 13 </div> |
| 14 |
| 15 <script> |
| 16 test(function(t) { |
| 17 var axTextInput1 = accessibilityController.accessibleElementById("text1"); |
| 18 assert_equals(axTextInput1.name, ""); |
| 19 }, "Text input"); |
| 20 </script> |
| 21 |
| 22 <div class="container"> |
| 23 <input id="text2" type="text" title="text2-title"> |
| 24 </div> |
| 25 |
| 26 <script> |
| 27 test(function(t) { |
| 28 var axTextInput2 = accessibilityController.accessibleElementById("text2"); |
| 29 assert_equals(axTextInput2.name, "text2-title"); |
| 30 assert_equals(axTextInput2.nameFrom, "attribute"); |
| 31 }, "Text input with title"); |
| 32 </script> |
| 33 |
| 34 <div class="container"> |
| 35 <input id="text3" type="text" title="text3-title" placeholder="text3-placeho
lder"> |
| 36 </div> |
| 37 |
| 38 <script> |
| 39 test(function(t) { |
| 40 var axTextInput3 = accessibilityController.accessibleElementById("text3"); |
| 41 assert_equals(axTextInput3.name, "text3-placeholder"); |
| 42 assert_equals(axTextInput3.nameFrom, "placeholder"); |
| 43 }, "Text input with title and placeholder"); |
| 44 </script> |
| 45 |
| 46 <div class="container"> |
| 47 <input id="text4" type="text" title="text4-title" placeholder="text4-placeho
lder"> |
| 48 <label for="text4">label-for-text4</label> |
| 49 </div> |
| 50 |
| 51 <script> |
| 52 test(function(t) { |
| 53 var axTextInput4 = accessibilityController.accessibleElementById("text4"); |
| 54 assert_equals(axTextInput4.name, "label-for-text4"); |
| 55 assert_equals(axTextInput4.nameFrom, "relatedElement"); |
| 56 }, "Text input with title, placeholder and label-for"); |
| 57 </script> |
| 58 |
| 59 <div class="container"> |
| 60 <input id="text5" type="text" title="text5-title" placeholder="text5-placeho
lder" aria-label="text5-aria-label"> |
| 61 <label for="text5">label-for-text5</label> |
| 62 </div> |
| 63 |
| 64 <script> |
| 65 test(function(t) { |
| 66 var axTextInput5 = accessibilityController.accessibleElementById("text5"); |
| 67 assert_equals(axTextInput5.name, "text5-aria-label"); |
| 68 assert_equals(axTextInput5.nameFrom, "attribute"); |
| 69 }, "Text input with title, placeholder, label-for and aria-label"); |
| 70 </script> |
| 71 |
| 72 <div class="container"> |
| 73 <input id="text6" type="text" title="text6-title" placeholder="text6-placeho
lder" aria-label="text6-aria-label" aria-labelledby="labelledby6"> |
| 74 <label for="text6">label-for-text6</label> |
| 75 <span id="labelledby6">labelledby-for-text6</span> |
| 76 </div> |
| 77 |
| 78 <script> |
| 79 test(function(t) { |
| 80 var axTextInput6 = accessibilityController.accessibleElementById("text6"); |
| 81 assert_equals(axTextInput6.name, "labelledby-for-text6"); |
| 82 assert_equals(axTextInput6.nameFrom, "relatedElement"); |
| 83 }, "Text input with title, placeholder, label-for, aria-label and aria-labelledb
y"); |
| 84 </script> |
| 85 |
| 86 <script> |
| 87 if (window.testRunner) |
| 88 document.body.className = "hideAllContainers"; |
| 89 </script> |
OLD | NEW |