forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_button.html
147 lines (109 loc) · 4.22 KB
/
test_button.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<html>
<head>
<title>nsIAccessible::name calculation for HTML buttons</title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../name.js"></script>
<script type="application/javascript">
function doTest()
{
// html:button, aria-label
testName("btn_aria_label", "button label");
// html:button, aria-labelledby
testName("btn_aria_labelledby_text", "text");
// html:button, html:label
testName("btn_labelled", "label");
// html:button, name from content
testName("btn_namefromcontent", "1");
// html:button, no name from content
testName("btn_nonamefromcontent", null);
// @html:button, title
testName("btn_title", "title");
// html:input, aria-label
testName("input_aria_label", "button label");
// html:input, aria-labelledby
testName("input_aria_labelledby_text", "text");
// html:input, html:label
testName("input_labelled", "label");
// html:input, @value
testName("input_value0", "1");
// html:input, @value
testName("input_value", "1");
// html:input, @alt
testName("input_alt", "alt");
// html:input, @src
testName("input_src", "src");
// html:input, @data
testName("input_data", "data");
// html:input, @title
testName("input_title", "title");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=459635"
title="nsIAccessible::name calculation for HTML buttons">
Mozilla Bug 459635
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<!-- aria-labelledby preferred to aria-label -->
<button id="btn_aria_label"
aria-label="button label">1</button>
<br/>
<!-- button, aria-labelledby, preferred to html:label -->
<span id="aria_labelledby_text">text</span>
<label for="btn_aria_labelledby_text">label</label>
<button id="btn_aria_labelledby_text"
aria-labelledby="aria_labelledby_text">1</button>
<br/>
<!-- button, label, preferred to name from content -->
<label for="btn_labelled">label</label>
<button id="btn_labelled">1</button>
<!-- button, name from content, preferred to @title -->
<button id="btn_namefromcontent" title="title">1</button>
<!-- button, no name from content, ARIA role overrides this rule -->
<button id="btn_nonamefromcontent" role="presentation">1</button>
<!-- button, no content, name from @title -->
<button id="btn_title" title="title"></button>
<!-- input, aria-label -->
<input type="button" id="input_aria_label"
aria-label="button label"
value="1"/>
<br/>
<!-- aria-labelledby, preferred to html:label -->
<span id="aria_labelledby_text_for_input">text</span>
<label for="input_aria_labelledby_text">label</label>
<input type="button" id="input_aria_labelledby_text"
aria-labelledby="aria_labelledby_text_for_input"
value="1"/>
<br/>
<!-- label, preferred to @title -->
<label for="input_labelled">label</label>
<input type="button" id="input_labelled" value="1" title="title"/>
<!-- name from @value, preferred to @title -->
<input type="button" id="input_value0" title="title" value="1"/>
<!-- name from @value, preferred to @alt -->
<input type="button" id="input_value" value="1" alt="alt"/>
<!-- name from @alt, preferred to @src -->
<input type="button" id="input_alt" alt="alt" @src="src"/>
<!-- name from @src, preferred to @data -->
<input type="button" id="input_src" src="src" data="data"/>
<!-- name from @data -->
<input type="button" id="input_data" data="data"/>
<!-- name from @title -->
<input type="button" id="input_title" title="title"/>
</body>
</html>