Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / accessibility / name-calc-inputs.html
blob9b845ec130394e4fcf5dcc183c48830aa043cdd3
1 <!DOCTYPE HTML>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
5 <style>
6 .hideAllContainers .container {
7 display: none;
9 </style>
11 <div class="container">
12 <input id="text1" type="text">
13 </div>
15 <script>
16 test(function(t) {
17 var axTextInput1 = accessibilityController.accessibleElementById("text1");
18 assert_equals(axTextInput1.name, "");
19 }, "Text input");
20 </script>
22 <div class="container">
23 <input id="text2" type="text" title="text2-title">
24 </div>
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>
34 <div class="container">
35 <input id="text3" type="text" title="text3-title" placeholder="text3-placeholder">
36 </div>
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>
46 <div class="container">
47 <input id="text4" type="text" title="text4-title" placeholder="text4-placeholder">
48 <label for="text4">label-for-text4</label>
49 </div>
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>
59 <div class="container">
60 <input id="text5" type="text" title="text5-title" placeholder="text5-placeholder" aria-label="text5-aria-label">
61 <label for="text5">label-for-text5</label>
62 </div>
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>
72 <div class="container">
73 <input id="text6" type="text" title="text6-title" placeholder="text6-placeholder" 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>
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-labelledby");
84 </script>
86 <script>
87 if (window.testRunner)
88 document.body.className = "hideAllContainers";
89 </script>