| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
| 4 | 4 |
| 5 <style> | 5 <style> |
| 6 .hideAllContainers .container { | 6 .hideAllContainers .container { |
| 7 display: none; | 7 display: none; |
| 8 } | 8 } |
| 9 </style> | 9 </style> |
| 10 | 10 |
| 11 <div class="container"> | 11 <div class="container"> |
| 12 <input id="text1" type="text" placeholder="Placeholder"> | 12 <input id="text1" type="text" placeholder="Placeholder"> |
| 13 </div> | 13 </div> |
| 14 | 14 |
| 15 <script> | 15 <script> |
| 16 test(function(t) { | 16 test(function(t) { |
| 17 var axTextInput1 = accessibilityController.accessibleElementById("text1"); | 17 var axTextInput1 = accessibilityController.accessibleElementById("text1"); |
| 18 assert_equals(axTextInput1.name, "Placeholder"); | 18 assert_equals(axTextInput1.name, "Placeholder"); |
| 19 assert_equals(axTextInput1.nameFrom, "placeholder"); | 19 assert_equals(axTextInput1.nameFrom, "placeholder"); |
| 20 assert_equals(axTextInput1.description, ""); | 20 assert_equals(axTextInput1.description, ""); |
| 21 assert_equals(axTextInput1.descriptionFrom, ""); | 21 assert_equals(axTextInput1.descriptionFrom, ""); |
| 22 }, "Text input uses placeholder as accessible name if that's the only accessible
text."); | 22 }, "Text input uses placeholder as accessible name if that's the only accessible
text."); |
| 23 </script> | 23 </script> |
| 24 | 24 |
| 25 <div class="container"> | 25 <div class="container"> |
| 26 <input id="text1a" type="text" aria-placeholder="ARIA Placeholder"> |
| 27 </div> |
| 28 |
| 29 <script> |
| 30 test(function(t) { |
| 31 var axTextInput1a = accessibilityController.accessibleElementById("text1a"); |
| 32 assert_equals(axTextInput1a.name, "ARIA Placeholder"); |
| 33 assert_equals(axTextInput1a.nameFrom, "placeholder"); |
| 34 assert_equals(axTextInput1a.description, ""); |
| 35 assert_equals(axTextInput1a.descriptionFrom, ""); |
| 36 }, "Text input uses ARIA placeholder as accessible name if that's the only acces
sible text."); |
| 37 </script> |
| 38 |
| 39 <div class="container"> |
| 40 <input id="text1b" type="text" aria-placeholder="ARIA Placeholder" placehold
er="Placeholder"> |
| 41 </div> |
| 42 |
| 43 <script> |
| 44 test(function(t) { |
| 45 var axTextInput1b = accessibilityController.accessibleElementById("text1b"); |
| 46 assert_equals(axTextInput1b.name, "Placeholder"); |
| 47 assert_equals(axTextInput1b.nameFrom, "placeholder"); |
| 48 assert_equals(axTextInput1b.description, ""); |
| 49 assert_equals(axTextInput1b.descriptionFrom, ""); |
| 50 }, "Text input uses placeholder in preference to ARIA placeholder for accessible
name."); |
| 51 </script> |
| 52 |
| 53 <div class="container"> |
| 26 <input id="text2" type="text" aria-label="Label" placeholder="Placeholder"> | 54 <input id="text2" type="text" aria-label="Label" placeholder="Placeholder"> |
| 27 </div> | 55 </div> |
| 28 | 56 |
| 29 <script> | 57 <script> |
| 30 test(function(t) { | 58 test(function(t) { |
| 31 var axTextInput2 = accessibilityController.accessibleElementById("text2"); | 59 var axTextInput2 = accessibilityController.accessibleElementById("text2"); |
| 32 assert_equals(axTextInput2.name, "Label"); | 60 assert_equals(axTextInput2.name, "Label"); |
| 33 assert_equals(axTextInput2.nameFrom, "attribute"); | 61 assert_equals(axTextInput2.nameFrom, "attribute"); |
| 34 assert_equals(axTextInput2.description, "Placeholder"); | 62 assert_equals(axTextInput2.description, "Placeholder"); |
| 35 assert_equals(axTextInput2.descriptionFrom, "placeholder"); | 63 assert_equals(axTextInput2.descriptionFrom, "placeholder"); |
| 36 }, "Text input uses placeholder as accessible description if it wasn't used as t
he accessible name."); | 64 }, "Text input uses placeholder as accessible description if it wasn't used as t
he accessible name."); |
| 37 </script> | 65 </script> |
| 38 | 66 |
| 39 <div class="container"> | 67 <div class="container"> |
| 68 <input id="text2a" type="text" aria-label="Label" aria-placeholder="ARIA Pla
ceholder"> |
| 69 </div> |
| 70 |
| 71 <script> |
| 72 test(function(t) { |
| 73 var axTextInput2 = accessibilityController.accessibleElementById("text2a"); |
| 74 assert_equals(axTextInput2.name, "Label"); |
| 75 assert_equals(axTextInput2.nameFrom, "attribute"); |
| 76 assert_equals(axTextInput2.description, "ARIA Placeholder"); |
| 77 assert_equals(axTextInput2.descriptionFrom, "placeholder"); |
| 78 }, "Text input uses aria-placeholder as accessible description if it wasn't used
as the accessible name."); |
| 79 </script> |
| 80 |
| 81 <div class="container"> |
| 82 <input id="text2b" type="text" aria-label="Label" aria-placeholder="ARIA Pla
ceholder" placeholder="Placeholder"> |
| 83 </div> |
| 84 |
| 85 <script> |
| 86 test(function(t) { |
| 87 var axTextInput2 = accessibilityController.accessibleElementById("text2b"); |
| 88 assert_equals(axTextInput2.name, "Label"); |
| 89 assert_equals(axTextInput2.nameFrom, "attribute"); |
| 90 assert_equals(axTextInput2.description, "Placeholder"); |
| 91 assert_equals(axTextInput2.descriptionFrom, "placeholder"); |
| 92 }, "Text input uses placeholder in preference to ARIA placeholder for accessible
description."); |
| 93 </script> |
| 94 |
| 95 <div class="container"> |
| 40 <input id="text3" type="text" aria-label="Label" placeholder="Placeholder" a
ria-describedby="describedby3"> | 96 <input id="text3" type="text" aria-label="Label" placeholder="Placeholder" a
ria-describedby="describedby3"> |
| 41 <div id="describedby3">DescribedBy</div> | 97 <div id="describedby3">DescribedBy</div> |
| 42 </div> | 98 </div> |
| 43 | 99 |
| 44 <script> | 100 <script> |
| 45 test(function(t) { | 101 test(function(t) { |
| 46 var axTextInput3 = accessibilityController.accessibleElementById("text3"); | 102 var axTextInput3 = accessibilityController.accessibleElementById("text3"); |
| 47 assert_equals(axTextInput3.name, "Label"); | 103 assert_equals(axTextInput3.name, "Label"); |
| 48 assert_equals(axTextInput3.nameFrom, "attribute"); | 104 assert_equals(axTextInput3.nameFrom, "attribute"); |
| 49 assert_equals(axTextInput3.description, "DescribedBy"); | 105 assert_equals(axTextInput3.description, "DescribedBy"); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 assert_equals(axTextInput8.nameFrom, ""); | 180 assert_equals(axTextInput8.nameFrom, ""); |
| 125 assert_equals(axTextInput8.description, "Described By"); | 181 assert_equals(axTextInput8.description, "Described By"); |
| 126 assert_equals(axTextInput8.descriptionFrom, "relatedElement"); | 182 assert_equals(axTextInput8.descriptionFrom, "relatedElement"); |
| 127 }, "aria-describedby does not include newlines."); | 183 }, "aria-describedby does not include newlines."); |
| 128 </script> | 184 </script> |
| 129 | 185 |
| 130 <script> | 186 <script> |
| 131 if (window.testRunner) | 187 if (window.testRunner) |
| 132 document.body.className = "hideAllContainers"; | 188 document.body.className = "hideAllContainers"; |
| 133 </script> | 189 </script> |
| OLD | NEW |