2 <script src=
"../resources/testharness.js"></script>
3 <script src=
"../resources/testharnessreport.js"></script>
6 .hideAllContainers .container {
11 <div class=
"container">
12 <button id=
"button1"></button>
17 var axButton1
= accessibilityController
.accessibleElementById("button1");
18 assert_equals(axButton1
.name
, "");
19 }, "Button with no content");
22 <div class=
"container">
23 <button id=
"button2">button2-content
</button>
28 var axButton2
= accessibilityController
.accessibleElementById("button2");
29 assert_equals(axButton2
.name
, "button2-content");
30 assert_equals(axButton2
.nameFrom
, "contents");
31 }, "Button with text content");
34 <div class=
"container">
35 <button id=
"button3"><img src=
"resources/cake.png"></button>
40 var axButton3
= accessibilityController
.accessibleElementById("button3");
41 assert_equals(axButton3
.name
, "");
42 }, "Button with img content with no alt");
45 <div class=
"container">
46 <button id=
"button4"><img src=
"resources/cake.png" alt=
"cake"></button>
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");
57 <div class=
"container">
58 <button id=
"button5">I love
<img src=
"resources/cake.png">!
</button>
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");
69 <div class=
"container">
70 <button id=
"button6">I love
<img src=
"resources/cake.png" alt=
"cake">!
</button>
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");
81 <div class=
"container">
82 <button id=
"button7" title=
"button7-title"></button>
87 var axButton7
= accessibilityController
.accessibleElementById("button7");
88 assert_equals(axButton7
.name
, "button7-title");
89 assert_equals(axButton7
.nameFrom
, "attribute");
90 }, "Button with title only");
93 <div class=
"container">
94 <button id=
"button8" title=
"button8-title">button8-content
</button>
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");
105 <div class=
"container">
106 <button id=
"button9" title=
"button9-title"><img src=
"resources/cake.png"></button>
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");
117 <div class=
"container">
118 <button id=
"button10" title=
"button10-title"><img src=
"resources/cake.png" alt=
"cake"></button>
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");
129 <div class=
"container">
130 <button id=
"button11">button11-content
</button>
131 <label for=
"button11">label-for-button11
</label>
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");
144 if (window
.testRunner
)
145 document
.body
.className
= "hideAllContainers";