Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 <html>
3 <head>
4 <title>nsIAccessible::name calculation for HTML links (html:a)</title>
6 <link rel="stylesheet"
7 type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
9 <script type="application/javascript"
10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
12 <script type="application/javascript"
13 src="../common.js"></script>
14 <script type="application/javascript"
15 src="../name.js"></script>
17 <script type="application/javascript">
18 function doTest()
19 {
20 // aria-label
21 testName("aria_label", "anchor label");
23 // aria-labelledby
24 testName("aria_labelledby", "text");
26 // html:label
27 testName("label", "label");
29 // name from content
30 testName("namefromcontent", "1");
32 // name from content
33 testName("namefromimg", "img title");
35 // no name from content
36 testName("nonamefromcontent", null);
38 // title
39 testName("title", "title");
41 SimpleTest.finish();
42 }
44 SimpleTest.waitForExplicitFinish();
45 addA11yLoadEvent(doTest);
46 </script>
48 </head>
50 <body>
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>
62 <!-- aria-label -->
63 <a id="aria_label" href="mozilla.org"
64 aria-label="anchor label">1</a>
65 <br/>
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/>
74 <!-- label, preferred to name from content -->
75 <label for="label">label</label>
76 <a id="label" href="mozilla.org">1</a>
77 <br/>
79 <!-- name from content, preferred to @title -->
80 <a id="namefromcontent" href="mozilla.org"
81 title="title">1</a>
82 <br/>
84 <!-- name from content, preferred to @title -->
85 <a id="namefromimg" href="mozilla.org"
86 title="title"><img alt="img title" /></a>
88 <!-- no name from content, ARIA role overrides this rule -->
89 <a id="nonamefromcontent" href="mozilla.org" role="img">1</a>
90 <br/>
92 <!-- no content, name from @title -->
93 <a id="title" href="mozilla.org"
94 title="title"></a>
96 </body>
97 </html>