Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: third_party/WebKit/LayoutTests/accessibility/description-calc-inputs.html

Issue 2492083002: Implement aria-placeholder (Closed)
Patch Set: Rebaseline android placeholder test Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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, "");
35 assert_equals(axTextInput2.descriptionFrom, "placeholder"); 63 assert_equals(axTextInput2.descriptionFrom, "");
36 }, "Text input uses placeholder as accessible description if it wasn't used as t he accessible name."); 64 assert_equals(axTextInput2.placeholder, "Placeholder");
65 }, "Text input uses placeholder as accessible placeholder (not description) if i t wasn't used as the accessible name.");
37 </script> 66 </script>
38 67
39 <div class="container"> 68 <div class="container">
69 <input id="text2a" type="text" aria-label="Label" aria-placeholder="ARIA Pla ceholder">
70 </div>
71
72 <script>
73 test(function(t) {
74 var axTextInput2a = accessibilityController.accessibleElementById("text2a");
75 assert_equals(axTextInput2a.name, "Label");
76 assert_equals(axTextInput2a.nameFrom, "attribute");
77 assert_equals(axTextInput2a.description, "");
78 assert_equals(axTextInput2a.descriptionFrom, "");
79 assert_equals(axTextInput2a.placeholder, "ARIA Placeholder");
80 }, "Text input uses aria-placeholder as accessible placeholder if it wasn't used as the accessible name.");
81 </script>
82
83 <div class="container">
84 <input id="text2b" type="text" aria-label="Label" aria-placeholder="ARIA Pla ceholder" placeholder="Placeholder">
85 </div>
86
87 <script>
88 test(function(t) {
89 var axTextInput2b = accessibilityController.accessibleElementById("text2b");
90 assert_equals(axTextInput2b.name, "Label");
91 assert_equals(axTextInput2b.nameFrom, "attribute");
92 assert_equals(axTextInput2b.description, "");
93 assert_equals(axTextInput2b.descriptionFrom, "");
94 assert_equals(axTextInput2b.placeholder, "Placeholder");
95 }, "Text input uses placeholder in preference to ARIA placeholder for accessible placeholder.");
96 </script>
97
98 <div class="container">
40 <input id="text3" type="text" aria-label="Label" placeholder="Placeholder" a ria-describedby="describedby3"> 99 <input id="text3" type="text" aria-label="Label" placeholder="Placeholder" a ria-describedby="describedby3">
41 <div id="describedby3">DescribedBy</div> 100 <div id="describedby3">DescribedBy</div>
42 </div> 101 </div>
43 102
44 <script> 103 <script>
45 test(function(t) { 104 test(function(t) {
46 var axTextInput3 = accessibilityController.accessibleElementById("text3"); 105 var axTextInput3 = accessibilityController.accessibleElementById("text3");
47 assert_equals(axTextInput3.name, "Label"); 106 assert_equals(axTextInput3.name, "Label");
48 assert_equals(axTextInput3.nameFrom, "attribute"); 107 assert_equals(axTextInput3.nameFrom, "attribute");
49 assert_equals(axTextInput3.description, "DescribedBy"); 108 assert_equals(axTextInput3.description, "DescribedBy");
50 assert_equals(axTextInput3.descriptionFrom, "relatedElement"); 109 assert_equals(axTextInput3.descriptionFrom, "relatedElement");
51 }, "aria-describedby overrides placeholder as the accessible description."); 110 assert_equals(axTextInput3.placeholder, "Placeholder");
111 }, "aria-describedby is used as the accessible description, placeholder is used as placeholder.");
52 </script> 112 </script>
53 113
54 <div class="container"> 114 <div class="container">
55 <input id="text4" type="text" title="Title"> 115 <input id="text4" type="text" title="Title">
56 </div> 116 </div>
57 117
58 <script> 118 <script>
59 test(function(t) { 119 test(function(t) {
60 var axTextInput4 = accessibilityController.accessibleElementById("text4"); 120 var axTextInput4 = accessibilityController.accessibleElementById("text4");
61 assert_equals(axTextInput4.name, "Title"); 121 assert_equals(axTextInput4.name, "Title");
(...skipping 26 matching lines...) Expand all
88 test(function(t) { 148 test(function(t) {
89 var axTextInput6 = accessibilityController.accessibleElementById("text6"); 149 var axTextInput6 = accessibilityController.accessibleElementById("text6");
90 assert_equals(axTextInput6.name, "Label"); 150 assert_equals(axTextInput6.name, "Label");
91 assert_equals(axTextInput6.nameFrom, "attribute"); 151 assert_equals(axTextInput6.nameFrom, "attribute");
92 assert_equals(axTextInput6.description, "DescribedBy"); 152 assert_equals(axTextInput6.description, "DescribedBy");
93 assert_equals(axTextInput6.descriptionFrom, "relatedElement"); 153 assert_equals(axTextInput6.descriptionFrom, "relatedElement");
94 }, "aria-describedby overrides title as the accessible description."); 154 }, "aria-describedby overrides title as the accessible description.");
95 </script> 155 </script>
96 156
97 <div class="container"> 157 <div class="container">
98 <input id="text7" type="text" aria-label="Label" title="Title" placeholder=" Placeholder"> 158 <input id="text7" type="text" aria-describedby="describedby7">
99 </div> 159 <p id="describedby7">
100
101 <script>
102 test(function(t) {
103 var axTextInput7 = accessibilityController.accessibleElementById("text7");
104 assert_equals(axTextInput7.name, "Label");
105 assert_equals(axTextInput7.nameFrom, "attribute");
106 assert_equals(axTextInput7.description, "Placeholder");
107 assert_equals(axTextInput7.descriptionFrom, "placeholder");
108 }, "placeholder overrides title as the accessible description.");
109 </script>
110
111 <div class="container">
112 <input id="text8" type="text" aria-describedby="describedby8">
113 <p id="describedby8">
114 Described 160 Described
115 <br> 161 <br>
116 By 162 By
117 </p> 163 </p>
118 </div> 164 </div>
119 165
120 <script> 166 <script>
121 test(function(t) { 167 test(function(t) {
122 var axTextInput8 = accessibilityController.accessibleElementById("text8"); 168 var axTextInput7 = accessibilityController.accessibleElementById("text7");
123 assert_equals(axTextInput8.name, ""); 169 assert_equals(axTextInput7.name, "");
124 assert_equals(axTextInput8.nameFrom, ""); 170 assert_equals(axTextInput7.nameFrom, "");
125 assert_equals(axTextInput8.description, "Described By"); 171 assert_equals(axTextInput7.description, "Described By");
126 assert_equals(axTextInput8.descriptionFrom, "relatedElement"); 172 assert_equals(axTextInput7.descriptionFrom, "relatedElement");
127 }, "aria-describedby does not include newlines."); 173 }, "aria-describedby does not include newlines.");
128 </script> 174 </script>
129 175
130 <script> 176 <script>
131 if (window.testRunner) 177 if (window.testRunner)
132 document.body.className = "hideAllContainers"; 178 document.body.className = "hideAllContainers";
133 </script> 179 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698