accessible/tests/mochitest/tree/test_aria_presentation.html

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 <!DOCTYPE html>
     2 <html>
     3 <head>
     4   <title>Test accessible tree when ARIA role presentation is used</title>
     5   <link rel="stylesheet" type="text/css"
     6         href="chrome://mochikit/content/tests/SimpleTest/test.css" />
     8   <script type="application/javascript"
     9           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    10   <script type="application/javascript"
    11           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
    13   <script type="application/javascript"
    14           src="../common.js"></script>
    15   <script type="application/javascript"
    16           src="../role.js"></script>
    18   <script type="application/javascript">
    19   function doTest()
    20   {
    21     // Presentation role don't allow accessible.
    22     var tree =
    23       { SECTION: [ // container
    24         { TEXT_LEAF: [ ] } // child text of presentation node
    25       ] };
    26     testAccessibleTree("div_cnt", tree);
    28     // Focusable element, presentation role is ignored.
    29     tree =
    30       { SECTION: [ // container
    31         { PUSHBUTTON: [ // button
    32           { TEXT_LEAF: [ ] }
    33         ] }
    34       ] };
    35     testAccessibleTree("btn_cnt", tree);
    37     // Presentation table, no table structure is exposed.
    38     tree =
    39       { SECTION: [ // container
    40         { TEXT_CONTAINER: [ // td generic accessible
    41           { TEXT_LEAF: [ ] } // cell text
    42         ] }
    43       ] };
    44     testAccessibleTree("tbl_cnt", tree);
    46     // Focusable table, presentation role is ignored.
    47     tree =
    48       { SECTION: [ // container
    49         { TABLE: [ // table
    50           { ROW: [ // tr
    51             { CELL: [ //td
    52               { TEXT_LEAF: [ ] }
    53             ] }
    54           ] }
    55         ] }
    56       ] };
    57     testAccessibleTree("tblfocusable_cnt", tree);
    59     // Has ARIA globals or referred by ARIA relationship.
    60     tree =
    61       { SECTION: [ // container
    62         { LABEL: [ // label, has aria-owns
    63           { TEXT_LEAF: [ ] }
    64         ] },
    65         { TEXT_LEAF: [ ] },
    66         { LABEL: [ // label, referenced by aria-owns
    67           { TEXT_LEAF: [ ] }
    68         ] }
    69       ] };
    70     testAccessibleTree("airaglobalprop_cnt", tree);
    72     SimpleTest.finish();
    73   }
    75   SimpleTest.waitForExplicitFinish();
    76   addA11yLoadEvent(doTest);
    77   </script>
    78 </head>
    79 <body>
    81   <a target="_blank"
    82      href="https://bugzilla.mozilla.org/show_bug.cgi?id=548291"
    83      title="Accessible tree of ARIA image maps">
    84     Mozilla Bug 548291
    85   </a>
    86   <a target="_blank"
    87      href="https://bugzilla.mozilla.org/show_bug.cgi?id=666504"
    88      title="Ignore role presentation on focusable elements">
    89     Mozilla Bug 666504
    90   </a>
    91   <p id="display"></p>
    92   <div id="content" style="display: none"></div>
    93   <pre id="test">
    94   </pre>
    96   <div id="div_cnt"><div role="presentation">text</div></div>
    98   <div id="btn_cnt"><button role="presentation">btn</button></div>
   100   <div id="tbl_cnt">
   101     <table role="presentation">
   102       <tr>
   103         <td>cell</td>
   104       </tr>
   105     </table>
   106   </div>
   108   <div id="tblfocusable_cnt">
   109     <table role="presentation" tabindex="0">
   110       <tr>
   111         <td>cell</td>
   112       </tr>
   113     </table>
   114   </div>
   116   <div id="airaglobalprop_cnt">
   117     <label role="presentation" aria-owns="ariaowned">has aria-owns</label>
   118     <label role="presentation" id="ariaowned">referred by aria-owns</label>
   119   </div>
   121 </body>
   122 </html>

mercurial