1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/name/markuprules.xml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,368 @@ 1.4 +<?xml version="1.0"?> 1.5 + 1.6 +<!-- 1.7 + This XML file is used to create sequence of accessible name tests. It consist 1.8 + of two sections. The first section 'ruledfn' declares name computation rules. 1.9 + The second section 'rulesample' defines markup samples we need to check name 1.10 + computation rules for. 1.11 + 1.12 + <ruledfn> 1.13 + <ruleset> 1.14 + <rule> 1.15 + 1.16 + Section 'ruledfn' contains 'ruleset' elements. Every 'ruleset' element is 1.17 + presented by 'rule' elements so that sequence of 'rule' elements gives the 1.18 + sequence of name computations rules. Every 'rule' element can be one of four 1.19 + types. 1.20 + 1.21 + * <rule attr='' type='string'/> used when name is equal to the value of 1.22 + attribute presented on the element. 1.23 + 1.24 + Example, 'aria-label' attribute. In this case 'rule' element has 'attr' 1.25 + attribute pointing to attribute name and 'type' attribute with 'string' 1.26 + value. For example, <rule attr="aria-label" type="string"/>. 1.27 + 1.28 + * <rule attr='' type='ref'/> used when name is calculated from elements that 1.29 + are pointed to by attribute value on the element. 1.30 + 1.31 + Example is 'aria-labelledby'. In this case 'rule' element has 'attr' 1.32 + attribute holding the sequence of IDs of elements used to compute the name, 1.33 + in addition the 'rule' element has 'type' attribute with 'ref' value. 1.34 + For example, <rule attr="aria-labelledby" type="ref"/>. 1.35 + 1.36 + * <rule elm='' elmattr=''/> used when name is calculated from another 1.37 + element. These attributes are used to find an element by tagname and 1.38 + attribute with value equaled to ID of the element. If 'elmattr' is missed 1.39 + then element from subtree with the given tagname is used. 1.40 + 1.41 + Example, html:label@for element, <rule elm="label" elmattr="for"/>. 1.42 + Example, html:caption element, <rule elm="caption"/> 1.43 + 1.44 + * <rule fromsubtree='true'/> used when name is computed from subtree. 1.45 + 1.46 + Example, html:button. In this case 'rule' element has 'fromsubtree' 1.47 + attribute with 'true' value. 1.48 + 1.49 + <rulesample> 1.50 + <markup ruleset=''> 1.51 + 1.52 + Section 'rulesample' provides set of markup samples ('markup' elements). Every 1.53 + 'markup' element contains an element that accessible name will be computed for 1.54 + (let's call it test element). In addition the 'markup' element contains some 1.55 + other elements from native markup used in name calculation process for test 1.56 + element. Test element is pointed to by 'ref' attribute on 'markup' element. 1.57 + Also 'markup' element has 'ruleset' attribute to indicate ruleset for the test 1.58 + element. 1.59 + 1.60 + How does it work? Let's consider simple example: 1.61 + <ruledfn> 1.62 + <ruleset id="aria"> 1.63 + <rule attr="aria-label" type="string"/> 1.64 + <rule attr="aria-labelledby" type="ref"/> 1.65 + </ruleset> 1.66 + </ruledfn> 1.67 + <rulesample> 1.68 + <markup ref="html:div" ruleset="aria"> 1.69 + <html:span id="label" textequiv="test2">test2</html:span> 1.70 + <html:div aria-label="test1" 1.71 + aria-labelledby="label">it's a div</html:div> 1.72 + </markup> 1.73 + </rulesample> 1.74 + 1.75 + Initially 'markup' element holds markup for all rules specified by 'ruleset' 1.76 + attribute. This allows us to check if the sequence of name computation rules 1.77 + is correct. Here 'ruleset' element defines two rules. We get the first rule 1.78 + which means accesible name is computed from value of 'aria-label' attribute. 1.79 + Then we check accessible name for the test element and remove 'aria-label' 1.80 + attribute. After we get the second rule which means we should get IDs from 1.81 + 'aria-labelledby' attribute and compose accessible name from values of 1.82 + 'textequiv' attributes (that are supposed to give the desired name for each 1.83 + element that is being pointed to by aria-labelledby). Check accessible name 1.84 + and finish test. 1.85 +--> 1.86 + 1.87 +<rules xmlns:html="http://www.w3.org/1999/xhtml" 1.88 + xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 1.89 + 1.90 + <ruledfn> 1.91 + 1.92 + <!-- bricks --> 1.93 + <ruleset id="ARIA"> 1.94 + <rule attr="aria-labelledby" type="ref"/> 1.95 + <rule attr="aria-label" type="string"/> 1.96 + </ruleset> 1.97 + 1.98 + <ruleset id="HTMLElm:Head"> 1.99 + <ruleset ref="ARIA"/> 1.100 + <rule elm="label" elmattr="for"/> 1.101 + </ruleset> 1.102 + 1.103 + <!-- general --> 1.104 + <ruleset id="HTMLControl"> 1.105 + <ruleset ref="ARIA"/> 1.106 + <rule elm="label" elmattr="for"/> 1.107 + <rule fromsubtree="true"/> 1.108 + <rule attr="title" type="string"/> 1.109 + </ruleset> 1.110 + 1.111 + <ruleset id="HTMLElm"> 1.112 + <ruleset ref="HTMLElm:Head"/> 1.113 + <rule attr="title" type="string"/> 1.114 + </ruleset> 1.115 + 1.116 + <!-- specific --> 1.117 + <ruleset id="HTMLInputButton"> 1.118 + <ruleset ref="HTMLElm:Head"/> 1.119 + <rule attr="value" type="string" explict-name="false" reordered="true"/> 1.120 + <rule attr="title" type="string"/> 1.121 + </ruleset> 1.122 + 1.123 + <ruleset id="HTMLInputSubmit" defaultName="Submit Query"> 1.124 + <ruleset ref="HTMLElm:Head"/> 1.125 + <rule attr="value" type="string" explict-name="false" textchanged="true"/> 1.126 + </ruleset> 1.127 + 1.128 + <ruleset id="HTMLInputReset" defaultName="Reset"> 1.129 + <ruleset ref="HTMLElm:Head"/> 1.130 + <rule attr="value" type="string" explict-name="false" textchanged="true"/> 1.131 + </ruleset> 1.132 + 1.133 + <ruleset id="HTMLInputImage"> 1.134 + <ruleset ref="HTMLElm:Head"/> 1.135 + <rule attr="alt" type="string" recreated="true"/> 1.136 + <rule attr="value" type="string" recreated="true"/> 1.137 + <rule attr="title" type="string"/> 1.138 + </ruleset> 1.139 + 1.140 + <ruleset id="HTMLInputImageNoValidSrc" defaultName="Submit Query"> 1.141 + <ruleset ref="HTMLElm:Head"/> 1.142 + <rule attr="alt" type="string" explict-name="false" recreated="true"/> 1.143 + <rule attr="value" type="string" explict-name="false" recreated="true"/> 1.144 + </ruleset> 1.145 + 1.146 + <ruleset id="HTMLOption"> 1.147 + <ruleset ref="ARIA"/> 1.148 + <rule attr="label" type="string"/> 1.149 + <rule fromsubtree="true"/> 1.150 + <rule attr="title" type="string"/> 1.151 + </ruleset> 1.152 + 1.153 + <ruleset id="HTMLImg"> 1.154 + <ruleset ref="ARIA"/> 1.155 + <rule attr="alt" type="string"/> 1.156 + <rule attr="title" type="string"/> 1.157 + </ruleset> 1.158 + 1.159 + <ruleset id="HTMLImgEmptyAlt"> 1.160 + <ruleset ref="ARIA"/> 1.161 + <rule attr="title" type="string"/> 1.162 + <rule attr="alt" type="string"/> 1.163 + </ruleset> 1.164 + 1.165 + <ruleset id="HTMLTable"> 1.166 + <ruleset ref="HTMLElm:Head"/> 1.167 + <rule elm="caption"/> 1.168 + <rule attr="summary" type="string"/> 1.169 + <rule attr="title" type="string"/> 1.170 + </ruleset> 1.171 + </ruledfn> 1.172 + 1.173 + <rulesample> 1.174 + 1.175 + <markup id="HTMLButtonTest" 1.176 + ref="html:button" ruleset="HTMLControl"> 1.177 + <html:span id="l1" textequiv="test2">test2</html:span> 1.178 + <html:span id="l2" textequiv="test3">test3</html:span> 1.179 + <html:label for="btn" textequiv="test4">test4</html:label> 1.180 + <html:button id="btn" 1.181 + aria-label="test1" 1.182 + aria-labelledby="l1 l2" 1.183 + title="test5" 1.184 + textequiv="press me">press me</html:button> 1.185 + </markup> 1.186 + 1.187 + <markup id="HTMLInputButtonTest" 1.188 + ref="html:input" ruleset="HTMLInputButton"> 1.189 + <html:span id="l1" textequiv="test2">test2</html:span> 1.190 + <html:span id="l2" textequiv="test3">test3</html:span> 1.191 + <html:label for="btn" textequiv="test4">test4</html:label> 1.192 + <html:input id="btn" 1.193 + type="button" 1.194 + aria-label="test1" 1.195 + aria-labelledby="l1 l2" 1.196 + value="name from value" 1.197 + alt="no name from al" 1.198 + src="no name from src" 1.199 + data="no name from data" 1.200 + title="name from title"/> 1.201 + </markup> 1.202 + 1.203 + <markup id="HTMLInputSubmitTest" 1.204 + ref="html:input" ruleset="HTMLInputSubmit"> 1.205 + <html:span id="l1" textequiv="test2">test2</html:span> 1.206 + <html:span id="l2" textequiv="test3">test3</html:span> 1.207 + <html:label for="btn-submit" textequiv="test4">test4</html:label> 1.208 + <html:input id="btn-submit" 1.209 + type="submit" 1.210 + aria-label="test1" 1.211 + aria-labelledby="l1 l2" 1.212 + value="name from value" 1.213 + alt="no name from atl" 1.214 + src="no name from src" 1.215 + data="no name from data" 1.216 + title="no name from title"/> 1.217 + </markup> 1.218 + 1.219 + <markup id="HTMLInputResetTest" 1.220 + ref="html:input" ruleset="HTMLInputReset"> 1.221 + <html:span id="l1" textequiv="test2">test2</html:span> 1.222 + <html:span id="l2" textequiv="test3">test3</html:span> 1.223 + <html:label for="btn-reset" textequiv="test4">test4</html:label> 1.224 + <html:input id="btn-reset" 1.225 + type="reset" 1.226 + aria-label="test1" 1.227 + aria-labelledby="l1 l2" 1.228 + value="name from value" 1.229 + alt="no name from alt" 1.230 + src="no name from src" 1.231 + data="no name from data" 1.232 + title="no name from title"/> 1.233 + </markup> 1.234 + 1.235 + <markup id="HTMLInputImageTest" 1.236 + ref="html:input" ruleset="HTMLInputImage"> 1.237 + <html:span id="l1" textequiv="test2">test2</html:span> 1.238 + <html:span id="l2" textequiv="test3">test3</html:span> 1.239 + <html:label for="btn-image" textequiv="test4">test4</html:label> 1.240 + <html:input id="btn-image" 1.241 + type="image" 1.242 + aria-label="test1" 1.243 + aria-labelledby="l1 l2" 1.244 + alt="name from alt" 1.245 + value="name from value" 1.246 + src="../moz.png" 1.247 + data="no name from data" 1.248 + title="name from title"/> 1.249 + </markup> 1.250 + 1.251 + <markup id="HTMLInputImageNoValidSrcTest" 1.252 + ref="html:input" ruleset="HTMLInputImageNoValidSrc"> 1.253 + <html:span id="l1" textequiv="test2">test2</html:span> 1.254 + <html:span id="l2" textequiv="test3">test3</html:span> 1.255 + <html:label for="btn-image" textequiv="test4">test4</html:label> 1.256 + <html:input id="btn-image" 1.257 + type="image" 1.258 + aria-label="test1" 1.259 + aria-labelledby="l1 l2" 1.260 + alt="name from alt" 1.261 + value="name from value" 1.262 + data="no name from data" 1.263 + title="no name from title"/> 1.264 + </markup> 1.265 + 1.266 + <markup id="HTMLOptionTest" 1.267 + ref="html:select/html:option[1]" ruleset="HTMLOption"> 1.268 + <html:span id="l1" textequiv="test2">test2</html:span> 1.269 + <html:span id="l2" textequiv="test3">test3</html:span> 1.270 + <html:select> 1.271 + <html:option id="opt" 1.272 + aria-label="test1" 1.273 + aria-labelledby="l1 l2" 1.274 + label="test4" 1.275 + title="test5" 1.276 + textequiv="option1">option1</html:option> 1.277 + <html:option>option2</html:option> 1.278 + </html:select> 1.279 + </markup> 1.280 + 1.281 + <markup id="HTMLImageTest" 1.282 + ref="html:img" ruleset="HTMLImg"> 1.283 + <html:span id="l1" textequiv="test2">test2</html:span> 1.284 + <html:span id="l2" textequiv="test3">test3</html:span> 1.285 + <html:img id="img" 1.286 + aria-label="Logo of Mozilla" 1.287 + aria-labelledby="l1 l2" 1.288 + alt="Mozilla logo" 1.289 + title="This is a logo" 1.290 + src="../moz.png"/> 1.291 + </markup> 1.292 + 1.293 + <markup id="HTMLImageEmptyAltTest" 1.294 + ref="html:img" ruleset="HTMLImgEmptyAlt"> 1.295 + <html:span id="l1" textequiv="test2">test2</html:span> 1.296 + <html:span id="l2" textequiv="test3">test3</html:span> 1.297 + <html:img id="imgemptyalt" 1.298 + aria-label="Logo of Mozilla" 1.299 + aria-labelledby="l1 l2" 1.300 + title="This is a logo" 1.301 + alt="" 1.302 + src="../moz.png"/> 1.303 + </markup> 1.304 + 1.305 + <markup id="HTMLTdTest" 1.306 + ref="html:table/html:tr/html:td" ruleset="HTMLElm"> 1.307 + <html:span id="l1" textequiv="test2">test2</html:span> 1.308 + <html:span id="l2" textequiv="test3">test3</html:span> 1.309 + <html:label for="tc" textequiv="test4">test4</html:label> 1.310 + <html:table> 1.311 + <html:tr> 1.312 + <html:td id="tc" 1.313 + aria-label="test1" 1.314 + aria-labelledby="l1 l2" 1.315 + title="test5"> 1.316 + <html:p>This is a paragraph</html:p> 1.317 + <html:a href="#">This is a link</html:a> 1.318 + <html:ul> 1.319 + <html:li>This is a list</html:li> 1.320 + </html:ul> 1.321 + </html:td> 1.322 + </html:tr> 1.323 + </html:table> 1.324 + </markup> 1.325 + 1.326 + <markup id="HTMLTdARIAGridCellTest" 1.327 + ref="html:table/html:tr/html:td" ruleset="HTMLControl"> 1.328 + <html:span id="l1" textequiv="test2">test2</html:span> 1.329 + <html:span id="l2" textequiv="test3">test3</html:span> 1.330 + <html:label for="gc" textequiv="test4">test4</html:label> 1.331 + <html:table> 1.332 + <html:tr> 1.333 + <html:td id="gc" 1.334 + role="gridcell" 1.335 + aria-label="test1" 1.336 + aria-labelledby="l1 l2" 1.337 + textequiv="This is a paragraph This is a link • Listitem1 • Listitem2" 1.338 + title="This is a paragraph This is a link This is a list"> 1.339 + <html:p>This is a paragraph</html:p> 1.340 + <html:a href="#">This is a link</html:a> 1.341 + <html:ul> 1.342 + <html:li>Listitem1</html:li> 1.343 + <html:li>Listitem2</html:li> 1.344 + </html:ul> 1.345 + </html:td> 1.346 + </html:tr> 1.347 + </html:table> 1.348 + </markup> 1.349 + 1.350 + <markup id="HTMLTableTest" 1.351 + ref="html:table" ruleset="HTMLTable"> 1.352 + <html:span id="l1" textequiv="lby_tst6_1">lby_tst6_1</html:span> 1.353 + <html:span id="l2" textequiv="lby_tst6_2">lby_tst6_2</html:span> 1.354 + <html:label for="t" textequiv="label_tst6">label_tst6</html:label> 1.355 + <!-- layout frame are recreated due to varous reasons, here's text frame 1.356 + placed after caption frame triggres table frame recreation when 1.357 + caption element is removed from DOM; get rid text node after caption 1.358 + node to make the test working --> 1.359 + <html:table id="t" aria-label="arialabel_tst6" 1.360 + aria-labelledby="l1 l2" 1.361 + summary="summary_tst6" 1.362 + title="title_tst6"> 1.363 + <html:caption textequiv="caption_tst6">caption_tst6</html:caption><html:tr> 1.364 + <html:td>cell1</html:td> 1.365 + <html:td>cell2</html:td> 1.366 + </html:tr> 1.367 + </html:table> 1.368 + </markup> 1.369 + 1.370 + </rulesample> 1.371 +</rules>