accessible/tests/mochitest/name/markuprules.xml

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 <?xml version="1.0"?>
michael@0 2
michael@0 3 <!--
michael@0 4 This XML file is used to create sequence of accessible name tests. It consist
michael@0 5 of two sections. The first section 'ruledfn' declares name computation rules.
michael@0 6 The second section 'rulesample' defines markup samples we need to check name
michael@0 7 computation rules for.
michael@0 8
michael@0 9 <ruledfn>
michael@0 10 <ruleset>
michael@0 11 <rule>
michael@0 12
michael@0 13 Section 'ruledfn' contains 'ruleset' elements. Every 'ruleset' element is
michael@0 14 presented by 'rule' elements so that sequence of 'rule' elements gives the
michael@0 15 sequence of name computations rules. Every 'rule' element can be one of four
michael@0 16 types.
michael@0 17
michael@0 18 * <rule attr='' type='string'/> used when name is equal to the value of
michael@0 19 attribute presented on the element.
michael@0 20
michael@0 21 Example, 'aria-label' attribute. In this case 'rule' element has 'attr'
michael@0 22 attribute pointing to attribute name and 'type' attribute with 'string'
michael@0 23 value. For example, <rule attr="aria-label" type="string"/>.
michael@0 24
michael@0 25 * <rule attr='' type='ref'/> used when name is calculated from elements that
michael@0 26 are pointed to by attribute value on the element.
michael@0 27
michael@0 28 Example is 'aria-labelledby'. In this case 'rule' element has 'attr'
michael@0 29 attribute holding the sequence of IDs of elements used to compute the name,
michael@0 30 in addition the 'rule' element has 'type' attribute with 'ref' value.
michael@0 31 For example, <rule attr="aria-labelledby" type="ref"/>.
michael@0 32
michael@0 33 * <rule elm='' elmattr=''/> used when name is calculated from another
michael@0 34 element. These attributes are used to find an element by tagname and
michael@0 35 attribute with value equaled to ID of the element. If 'elmattr' is missed
michael@0 36 then element from subtree with the given tagname is used.
michael@0 37
michael@0 38 Example, html:label@for element, <rule elm="label" elmattr="for"/>.
michael@0 39 Example, html:caption element, <rule elm="caption"/>
michael@0 40
michael@0 41 * <rule fromsubtree='true'/> used when name is computed from subtree.
michael@0 42
michael@0 43 Example, html:button. In this case 'rule' element has 'fromsubtree'
michael@0 44 attribute with 'true' value.
michael@0 45
michael@0 46 <rulesample>
michael@0 47 <markup ruleset=''>
michael@0 48
michael@0 49 Section 'rulesample' provides set of markup samples ('markup' elements). Every
michael@0 50 'markup' element contains an element that accessible name will be computed for
michael@0 51 (let's call it test element). In addition the 'markup' element contains some
michael@0 52 other elements from native markup used in name calculation process for test
michael@0 53 element. Test element is pointed to by 'ref' attribute on 'markup' element.
michael@0 54 Also 'markup' element has 'ruleset' attribute to indicate ruleset for the test
michael@0 55 element.
michael@0 56
michael@0 57 How does it work? Let's consider simple example:
michael@0 58 <ruledfn>
michael@0 59 <ruleset id="aria">
michael@0 60 <rule attr="aria-label" type="string"/>
michael@0 61 <rule attr="aria-labelledby" type="ref"/>
michael@0 62 </ruleset>
michael@0 63 </ruledfn>
michael@0 64 <rulesample>
michael@0 65 <markup ref="html:div" ruleset="aria">
michael@0 66 <html:span id="label" textequiv="test2">test2</html:span>
michael@0 67 <html:div aria-label="test1"
michael@0 68 aria-labelledby="label">it's a div</html:div>
michael@0 69 </markup>
michael@0 70 </rulesample>
michael@0 71
michael@0 72 Initially 'markup' element holds markup for all rules specified by 'ruleset'
michael@0 73 attribute. This allows us to check if the sequence of name computation rules
michael@0 74 is correct. Here 'ruleset' element defines two rules. We get the first rule
michael@0 75 which means accesible name is computed from value of 'aria-label' attribute.
michael@0 76 Then we check accessible name for the test element and remove 'aria-label'
michael@0 77 attribute. After we get the second rule which means we should get IDs from
michael@0 78 'aria-labelledby' attribute and compose accessible name from values of
michael@0 79 'textequiv' attributes (that are supposed to give the desired name for each
michael@0 80 element that is being pointed to by aria-labelledby). Check accessible name
michael@0 81 and finish test.
michael@0 82 -->
michael@0 83
michael@0 84 <rules xmlns:html="http://www.w3.org/1999/xhtml"
michael@0 85 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
michael@0 86
michael@0 87 <ruledfn>
michael@0 88
michael@0 89 <!-- bricks -->
michael@0 90 <ruleset id="ARIA">
michael@0 91 <rule attr="aria-labelledby" type="ref"/>
michael@0 92 <rule attr="aria-label" type="string"/>
michael@0 93 </ruleset>
michael@0 94
michael@0 95 <ruleset id="HTMLElm:Head">
michael@0 96 <ruleset ref="ARIA"/>
michael@0 97 <rule elm="label" elmattr="for"/>
michael@0 98 </ruleset>
michael@0 99
michael@0 100 <!-- general -->
michael@0 101 <ruleset id="HTMLControl">
michael@0 102 <ruleset ref="ARIA"/>
michael@0 103 <rule elm="label" elmattr="for"/>
michael@0 104 <rule fromsubtree="true"/>
michael@0 105 <rule attr="title" type="string"/>
michael@0 106 </ruleset>
michael@0 107
michael@0 108 <ruleset id="HTMLElm">
michael@0 109 <ruleset ref="HTMLElm:Head"/>
michael@0 110 <rule attr="title" type="string"/>
michael@0 111 </ruleset>
michael@0 112
michael@0 113 <!-- specific -->
michael@0 114 <ruleset id="HTMLInputButton">
michael@0 115 <ruleset ref="HTMLElm:Head"/>
michael@0 116 <rule attr="value" type="string" explict-name="false" reordered="true"/>
michael@0 117 <rule attr="title" type="string"/>
michael@0 118 </ruleset>
michael@0 119
michael@0 120 <ruleset id="HTMLInputSubmit" defaultName="Submit Query">
michael@0 121 <ruleset ref="HTMLElm:Head"/>
michael@0 122 <rule attr="value" type="string" explict-name="false" textchanged="true"/>
michael@0 123 </ruleset>
michael@0 124
michael@0 125 <ruleset id="HTMLInputReset" defaultName="Reset">
michael@0 126 <ruleset ref="HTMLElm:Head"/>
michael@0 127 <rule attr="value" type="string" explict-name="false" textchanged="true"/>
michael@0 128 </ruleset>
michael@0 129
michael@0 130 <ruleset id="HTMLInputImage">
michael@0 131 <ruleset ref="HTMLElm:Head"/>
michael@0 132 <rule attr="alt" type="string" recreated="true"/>
michael@0 133 <rule attr="value" type="string" recreated="true"/>
michael@0 134 <rule attr="title" type="string"/>
michael@0 135 </ruleset>
michael@0 136
michael@0 137 <ruleset id="HTMLInputImageNoValidSrc" defaultName="Submit Query">
michael@0 138 <ruleset ref="HTMLElm:Head"/>
michael@0 139 <rule attr="alt" type="string" explict-name="false" recreated="true"/>
michael@0 140 <rule attr="value" type="string" explict-name="false" recreated="true"/>
michael@0 141 </ruleset>
michael@0 142
michael@0 143 <ruleset id="HTMLOption">
michael@0 144 <ruleset ref="ARIA"/>
michael@0 145 <rule attr="label" type="string"/>
michael@0 146 <rule fromsubtree="true"/>
michael@0 147 <rule attr="title" type="string"/>
michael@0 148 </ruleset>
michael@0 149
michael@0 150 <ruleset id="HTMLImg">
michael@0 151 <ruleset ref="ARIA"/>
michael@0 152 <rule attr="alt" type="string"/>
michael@0 153 <rule attr="title" type="string"/>
michael@0 154 </ruleset>
michael@0 155
michael@0 156 <ruleset id="HTMLImgEmptyAlt">
michael@0 157 <ruleset ref="ARIA"/>
michael@0 158 <rule attr="title" type="string"/>
michael@0 159 <rule attr="alt" type="string"/>
michael@0 160 </ruleset>
michael@0 161
michael@0 162 <ruleset id="HTMLTable">
michael@0 163 <ruleset ref="HTMLElm:Head"/>
michael@0 164 <rule elm="caption"/>
michael@0 165 <rule attr="summary" type="string"/>
michael@0 166 <rule attr="title" type="string"/>
michael@0 167 </ruleset>
michael@0 168 </ruledfn>
michael@0 169
michael@0 170 <rulesample>
michael@0 171
michael@0 172 <markup id="HTMLButtonTest"
michael@0 173 ref="html:button" ruleset="HTMLControl">
michael@0 174 <html:span id="l1" textequiv="test2">test2</html:span>
michael@0 175 <html:span id="l2" textequiv="test3">test3</html:span>
michael@0 176 <html:label for="btn" textequiv="test4">test4</html:label>
michael@0 177 <html:button id="btn"
michael@0 178 aria-label="test1"
michael@0 179 aria-labelledby="l1 l2"
michael@0 180 title="test5"
michael@0 181 textequiv="press me">press me</html:button>
michael@0 182 </markup>
michael@0 183
michael@0 184 <markup id="HTMLInputButtonTest"
michael@0 185 ref="html:input" ruleset="HTMLInputButton">
michael@0 186 <html:span id="l1" textequiv="test2">test2</html:span>
michael@0 187 <html:span id="l2" textequiv="test3">test3</html:span>
michael@0 188 <html:label for="btn" textequiv="test4">test4</html:label>
michael@0 189 <html:input id="btn"
michael@0 190 type="button"
michael@0 191 aria-label="test1"
michael@0 192 aria-labelledby="l1 l2"
michael@0 193 value="name from value"
michael@0 194 alt="no name from al"
michael@0 195 src="no name from src"
michael@0 196 data="no name from data"
michael@0 197 title="name from title"/>
michael@0 198 </markup>
michael@0 199
michael@0 200 <markup id="HTMLInputSubmitTest"
michael@0 201 ref="html:input" ruleset="HTMLInputSubmit">
michael@0 202 <html:span id="l1" textequiv="test2">test2</html:span>
michael@0 203 <html:span id="l2" textequiv="test3">test3</html:span>
michael@0 204 <html:label for="btn-submit" textequiv="test4">test4</html:label>
michael@0 205 <html:input id="btn-submit"
michael@0 206 type="submit"
michael@0 207 aria-label="test1"
michael@0 208 aria-labelledby="l1 l2"
michael@0 209 value="name from value"
michael@0 210 alt="no name from atl"
michael@0 211 src="no name from src"
michael@0 212 data="no name from data"
michael@0 213 title="no name from title"/>
michael@0 214 </markup>
michael@0 215
michael@0 216 <markup id="HTMLInputResetTest"
michael@0 217 ref="html:input" ruleset="HTMLInputReset">
michael@0 218 <html:span id="l1" textequiv="test2">test2</html:span>
michael@0 219 <html:span id="l2" textequiv="test3">test3</html:span>
michael@0 220 <html:label for="btn-reset" textequiv="test4">test4</html:label>
michael@0 221 <html:input id="btn-reset"
michael@0 222 type="reset"
michael@0 223 aria-label="test1"
michael@0 224 aria-labelledby="l1 l2"
michael@0 225 value="name from value"
michael@0 226 alt="no name from alt"
michael@0 227 src="no name from src"
michael@0 228 data="no name from data"
michael@0 229 title="no name from title"/>
michael@0 230 </markup>
michael@0 231
michael@0 232 <markup id="HTMLInputImageTest"
michael@0 233 ref="html:input" ruleset="HTMLInputImage">
michael@0 234 <html:span id="l1" textequiv="test2">test2</html:span>
michael@0 235 <html:span id="l2" textequiv="test3">test3</html:span>
michael@0 236 <html:label for="btn-image" textequiv="test4">test4</html:label>
michael@0 237 <html:input id="btn-image"
michael@0 238 type="image"
michael@0 239 aria-label="test1"
michael@0 240 aria-labelledby="l1 l2"
michael@0 241 alt="name from alt"
michael@0 242 value="name from value"
michael@0 243 src="../moz.png"
michael@0 244 data="no name from data"
michael@0 245 title="name from title"/>
michael@0 246 </markup>
michael@0 247
michael@0 248 <markup id="HTMLInputImageNoValidSrcTest"
michael@0 249 ref="html:input" ruleset="HTMLInputImageNoValidSrc">
michael@0 250 <html:span id="l1" textequiv="test2">test2</html:span>
michael@0 251 <html:span id="l2" textequiv="test3">test3</html:span>
michael@0 252 <html:label for="btn-image" textequiv="test4">test4</html:label>
michael@0 253 <html:input id="btn-image"
michael@0 254 type="image"
michael@0 255 aria-label="test1"
michael@0 256 aria-labelledby="l1 l2"
michael@0 257 alt="name from alt"
michael@0 258 value="name from value"
michael@0 259 data="no name from data"
michael@0 260 title="no name from title"/>
michael@0 261 </markup>
michael@0 262
michael@0 263 <markup id="HTMLOptionTest"
michael@0 264 ref="html:select/html:option[1]" ruleset="HTMLOption">
michael@0 265 <html:span id="l1" textequiv="test2">test2</html:span>
michael@0 266 <html:span id="l2" textequiv="test3">test3</html:span>
michael@0 267 <html:select>
michael@0 268 <html:option id="opt"
michael@0 269 aria-label="test1"
michael@0 270 aria-labelledby="l1 l2"
michael@0 271 label="test4"
michael@0 272 title="test5"
michael@0 273 textequiv="option1">option1</html:option>
michael@0 274 <html:option>option2</html:option>
michael@0 275 </html:select>
michael@0 276 </markup>
michael@0 277
michael@0 278 <markup id="HTMLImageTest"
michael@0 279 ref="html:img" ruleset="HTMLImg">
michael@0 280 <html:span id="l1" textequiv="test2">test2</html:span>
michael@0 281 <html:span id="l2" textequiv="test3">test3</html:span>
michael@0 282 <html:img id="img"
michael@0 283 aria-label="Logo of Mozilla"
michael@0 284 aria-labelledby="l1 l2"
michael@0 285 alt="Mozilla logo"
michael@0 286 title="This is a logo"
michael@0 287 src="../moz.png"/>
michael@0 288 </markup>
michael@0 289
michael@0 290 <markup id="HTMLImageEmptyAltTest"
michael@0 291 ref="html:img" ruleset="HTMLImgEmptyAlt">
michael@0 292 <html:span id="l1" textequiv="test2">test2</html:span>
michael@0 293 <html:span id="l2" textequiv="test3">test3</html:span>
michael@0 294 <html:img id="imgemptyalt"
michael@0 295 aria-label="Logo of Mozilla"
michael@0 296 aria-labelledby="l1 l2"
michael@0 297 title="This is a logo"
michael@0 298 alt=""
michael@0 299 src="../moz.png"/>
michael@0 300 </markup>
michael@0 301
michael@0 302 <markup id="HTMLTdTest"
michael@0 303 ref="html:table/html:tr/html:td" ruleset="HTMLElm">
michael@0 304 <html:span id="l1" textequiv="test2">test2</html:span>
michael@0 305 <html:span id="l2" textequiv="test3">test3</html:span>
michael@0 306 <html:label for="tc" textequiv="test4">test4</html:label>
michael@0 307 <html:table>
michael@0 308 <html:tr>
michael@0 309 <html:td id="tc"
michael@0 310 aria-label="test1"
michael@0 311 aria-labelledby="l1 l2"
michael@0 312 title="test5">
michael@0 313 <html:p>This is a paragraph</html:p>
michael@0 314 <html:a href="#">This is a link</html:a>
michael@0 315 <html:ul>
michael@0 316 <html:li>This is a list</html:li>
michael@0 317 </html:ul>
michael@0 318 </html:td>
michael@0 319 </html:tr>
michael@0 320 </html:table>
michael@0 321 </markup>
michael@0 322
michael@0 323 <markup id="HTMLTdARIAGridCellTest"
michael@0 324 ref="html:table/html:tr/html:td" ruleset="HTMLControl">
michael@0 325 <html:span id="l1" textequiv="test2">test2</html:span>
michael@0 326 <html:span id="l2" textequiv="test3">test3</html:span>
michael@0 327 <html:label for="gc" textequiv="test4">test4</html:label>
michael@0 328 <html:table>
michael@0 329 <html:tr>
michael@0 330 <html:td id="gc"
michael@0 331 role="gridcell"
michael@0 332 aria-label="test1"
michael@0 333 aria-labelledby="l1 l2"
michael@0 334 textequiv="This is a paragraph This is a link • Listitem1 • Listitem2"
michael@0 335 title="This is a paragraph This is a link This is a list">
michael@0 336 <html:p>This is a paragraph</html:p>
michael@0 337 <html:a href="#">This is a link</html:a>
michael@0 338 <html:ul>
michael@0 339 <html:li>Listitem1</html:li>
michael@0 340 <html:li>Listitem2</html:li>
michael@0 341 </html:ul>
michael@0 342 </html:td>
michael@0 343 </html:tr>
michael@0 344 </html:table>
michael@0 345 </markup>
michael@0 346
michael@0 347 <markup id="HTMLTableTest"
michael@0 348 ref="html:table" ruleset="HTMLTable">
michael@0 349 <html:span id="l1" textequiv="lby_tst6_1">lby_tst6_1</html:span>
michael@0 350 <html:span id="l2" textequiv="lby_tst6_2">lby_tst6_2</html:span>
michael@0 351 <html:label for="t" textequiv="label_tst6">label_tst6</html:label>
michael@0 352 <!-- layout frame are recreated due to varous reasons, here's text frame
michael@0 353 placed after caption frame triggres table frame recreation when
michael@0 354 caption element is removed from DOM; get rid text node after caption
michael@0 355 node to make the test working -->
michael@0 356 <html:table id="t" aria-label="arialabel_tst6"
michael@0 357 aria-labelledby="l1 l2"
michael@0 358 summary="summary_tst6"
michael@0 359 title="title_tst6">
michael@0 360 <html:caption textequiv="caption_tst6">caption_tst6</html:caption><html:tr>
michael@0 361 <html:td>cell1</html:td>
michael@0 362 <html:td>cell2</html:td>
michael@0 363 </html:tr>
michael@0 364 </html:table>
michael@0 365 </markup>
michael@0 366
michael@0 367 </rulesample>
michael@0 368 </rules>

mercurial