|
1 <html> |
|
2 |
|
3 <head> |
|
4 <title>nsIAccessible::name calculation for HTML links (html:a)</title> |
|
5 |
|
6 <link rel="stylesheet" |
|
7 type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
|
8 |
|
9 <script type="application/javascript" |
|
10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
|
11 |
|
12 <script type="application/javascript" |
|
13 src="../common.js"></script> |
|
14 <script type="application/javascript" |
|
15 src="../name.js"></script> |
|
16 |
|
17 <script type="application/javascript"> |
|
18 function doTest() |
|
19 { |
|
20 // aria-label |
|
21 testName("aria_label", "anchor label"); |
|
22 |
|
23 // aria-labelledby |
|
24 testName("aria_labelledby", "text"); |
|
25 |
|
26 // html:label |
|
27 testName("label", "label"); |
|
28 |
|
29 // name from content |
|
30 testName("namefromcontent", "1"); |
|
31 |
|
32 // name from content |
|
33 testName("namefromimg", "img title"); |
|
34 |
|
35 // no name from content |
|
36 testName("nonamefromcontent", null); |
|
37 |
|
38 // title |
|
39 testName("title", "title"); |
|
40 |
|
41 SimpleTest.finish(); |
|
42 } |
|
43 |
|
44 SimpleTest.waitForExplicitFinish(); |
|
45 addA11yLoadEvent(doTest); |
|
46 </script> |
|
47 |
|
48 </head> |
|
49 |
|
50 <body> |
|
51 |
|
52 <a target="_blank" |
|
53 href="https://bugzilla.mozilla.org/show_bug.cgi?id=459782" |
|
54 title="nsIAccessible::name calculation for HTML links (html:a)"> |
|
55 Mozilla Bug 459782 |
|
56 </a> |
|
57 <p id="display"></p> |
|
58 <div id="content" style="display: none"></div> |
|
59 <pre id="test"> |
|
60 </pre> |
|
61 |
|
62 <!-- aria-label --> |
|
63 <a id="aria_label" href="mozilla.org" |
|
64 aria-label="anchor label">1</a> |
|
65 <br/> |
|
66 |
|
67 <!-- aria-labelledby, preferred to html:label --> |
|
68 <span id="text">text</span> |
|
69 <label for="aria_labelledby">label</label> |
|
70 <a id="aria_labelledby" href="mozilla.org" |
|
71 aria-labelledby="text">1</a> |
|
72 <br/> |
|
73 |
|
74 <!-- label, preferred to name from content --> |
|
75 <label for="label">label</label> |
|
76 <a id="label" href="mozilla.org">1</a> |
|
77 <br/> |
|
78 |
|
79 <!-- name from content, preferred to @title --> |
|
80 <a id="namefromcontent" href="mozilla.org" |
|
81 title="title">1</a> |
|
82 <br/> |
|
83 |
|
84 <!-- name from content, preferred to @title --> |
|
85 <a id="namefromimg" href="mozilla.org" |
|
86 title="title"><img alt="img title" /></a> |
|
87 |
|
88 <!-- no name from content, ARIA role overrides this rule --> |
|
89 <a id="nonamefromcontent" href="mozilla.org" role="img">1</a> |
|
90 <br/> |
|
91 |
|
92 <!-- no content, name from @title --> |
|
93 <a id="title" href="mozilla.org" |
|
94 title="title"></a> |
|
95 |
|
96 </body> |
|
97 </html> |