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