Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / accessibility / name-calc-native-markup-buttons.html
blob8a1631fabb3368f50c03bd7f882b1bc569cccde2
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 <button id="button1"></button>
13 </div>
15 <script>
16 test(function(t) {
17 var axButton1 = accessibilityController.accessibleElementById("button1");
18 assert_equals(axButton1.name, "");
19 }, "Button with no content");
20 </script>
22 <div class="container">
23 <button id="button2">button2-content</button>
24 </div>
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>
34 <div class="container">
35 <button id="button3"><img src="resources/cake.png"></button>
36 </div>
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>
45 <div class="container">
46 <button id="button4"><img src="resources/cake.png" alt="cake"></button>
47 </div>
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>
57 <div class="container">
58 <button id="button5">I love <img src="resources/cake.png">!</button>
59 </div>
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>
69 <div class="container">
70 <button id="button6">I love <img src="resources/cake.png" alt="cake">!</button>
71 </div>
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>
81 <div class="container">
82 <button id="button7" title="button7-title"></button>
83 </div>
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>
93 <div class="container">
94 <button id="button8" title="button8-title">button8-content</button>
95 </div>
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>
105 <div class="container">
106 <button id="button9" title="button9-title"><img src="resources/cake.png"></button>
107 </div>
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>
117 <div class="container">
118 <button id="button10" title="button10-title"><img src="resources/cake.png" alt="cake"></button>
119 </div>
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>
129 <div class="container">
130 <button id="button11">button11-content</button>
131 <label for="button11">label-for-button11</label>
132 </div>
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>
143 <script>
144 if (window.testRunner)
145 document.body.className = "hideAllContainers";
146 </script>