test_descr.html (4262B)
1 <html> 2 3 <head> 4 <title>nsIAccessible::description tests</title> 5 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 6 7 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 8 <script type="application/javascript" 9 src="common.js"></script> 10 <script type="application/javascript" 11 src="name.js"></script> 12 13 <script type="application/javascript"> 14 function doTest() { 15 // Description from aria-describedby attribute 16 testDescr("img1", "aria description"); 17 18 // No description from @title attribute because it is used to generate 19 // name. 20 testDescr("img2", ""); 21 22 // Description from @title attribute, name is generated from @alt 23 // attribute. 24 testDescr("img3", "description"); 25 26 // No description from aria-describedby since it is the same as the 27 // @alt attribute which is used as the name 28 testDescr("img4", ""); 29 30 // No description from @title attribute since it is the same as the 31 // @alt attribute which is used as the name 32 testDescr("img5", ""); 33 34 // Description from content of h2. 35 testDescr("p", "heading"); 36 37 // Description from aria-description attribute 38 testDescr("p2", "I describe"); 39 40 // Description from contents of h2 when both aria-describedby and 41 // aria-description are present 42 testDescr("p3", "heading"); 43 44 // From table summary (caption is used as a name) 45 testDescr("table1", "summary"); 46 47 // Empty (summary is used as a name) 48 testDescr("table2", ""); 49 50 // From title (summary is used as a name) 51 testDescr("table3", "title"); 52 53 // No description from <desc> element since it is the same as the 54 // <title> element. 55 testDescr("svg", ""); 56 57 // role="alert" referenced by aria-describedby should include subtree. 58 testDescr("inputDescribedByAlert", "Error"); 59 60 SimpleTest.finish(); 61 } 62 63 SimpleTest.waitForExplicitFinish(); 64 addA11yLoadEvent(doTest); 65 </script> 66 67 </head> 68 69 <body> 70 71 <a target="_blank" 72 href="https://bugzilla.mozilla.org/show_bug.cgi?id=489944" 73 title="@title attribute no longer exposed on accDescription"> 74 Mozilla Bug 489944 75 </a> 76 <a target="_blank" 77 href="https://bugzilla.mozilla.org/show_bug.cgi?id=666212" 78 title="summary attribute content mapped to accessible name in MSAA"> 79 Mozilla Bug 666212 80 </a> 81 <a target="_blank" 82 href="https://bugzilla.mozilla.org/show_bug.cgi/id=1031188" 83 title="Ensure that accDescription never duplicates AccessibleName"> 84 Mozilla Bug 1031188 85 </a> 86 87 <p id="display"></p> 88 <div id="content" style="display: none"></div> 89 <pre id="test"> 90 </pre> 91 92 <p id="description">aria description</p> 93 <img id="img1" aria-describedby="description" /> 94 <img id="img2" title="title" /> 95 <img id="img3" alt="name" title="description" /> 96 <img id="img4" alt="aria description" aria-describedby="description"> 97 <img id="img5" alt="image" title="image"> 98 99 <h2 id="heading">heading</h2> 100 <p id="p" aria-describedby="heading" role="button">click me</p> 101 <p id="p2" aria-description="I describe" role="button">click me</p> 102 <p id="p3" aria-description="I do not describe" aria-describedby="heading" role="button">click me</p> 103 104 <table id="table1" summary="summary"> 105 <caption>caption</caption> 106 <tr><td>cell</td></tr> 107 </table> 108 109 <table id="table2" summary="summary"> 110 <tr><td>cell</td></tr> 111 </table> 112 113 <table id="table3" summary="summary" title="title"> 114 <tr><td>cell</td></tr> 115 </table> 116 117 <svg xmlns="http://www.w3.org/2000/svg" version="1.1" 118 viewBox="0 0 100 100" preserveAspectRatio="xMidYMid slice" 119 id="svg" 120 style="width:100px; height:100px;"> 121 <title>SVG Image</title> 122 <desc>SVG Image</desc> 123 <linearGradient id="gradient"> 124 <stop class="begin" offset="0%"/> 125 <stop class="end" offset="100%"/> 126 </linearGradient> 127 <rect x="0" y="0" width="100" height="100" style="fill:url(#gradient)" /> 128 <circle cx="50" cy="50" r="30" style="fill:url(#gradient)" /> 129 </svg> 130 131 <div id="alert" role="alert">Error</div> 132 <input type="text" id="inputDescribedByAlert" aria-describedby="alert"> 133 </body> 134 </html>