accessible/tests/mochitest/selectable/test_aria.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/selectable/test_aria.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,225 @@
     1.4 +<html>
     1.5 +
     1.6 +<head>
     1.7 +  <title>nsIAccessibleSelectable ARIA widgets testing</title>
     1.8 +
     1.9 +  <link rel="stylesheet" type="text/css"
    1.10 +        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    1.11 +
    1.12 +  </style>
    1.13 +
    1.14 +  <script type="application/javascript"
    1.15 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.16 +
    1.17 +  <script type="application/javascript"
    1.18 +          src="../common.js"></script>
    1.19 +  <script type="application/javascript"
    1.20 +          src="../role.js"></script>
    1.21 +  <script type="application/javascript"
    1.22 +          src="../states.js"></script>
    1.23 +  <script type="application/javascript"
    1.24 +          src="../selectable.js"></script>
    1.25 +
    1.26 +  <script type="application/javascript">
    1.27 +    function testSelectable(aID, aSelectableChildren)
    1.28 +    {
    1.29 +      var acc = getAccessible(aID, [nsIAccessibleSelectable]);
    1.30 +
    1.31 +      testSelectableSelection(acc, []);
    1.32 +
    1.33 +      acc.selectAll();
    1.34 +      testSelectableSelection(acc, aSelectableChildren);
    1.35 +
    1.36 +      acc.unselectAll();
    1.37 +      testSelectableSelection(acc, []);
    1.38 +    }
    1.39 +
    1.40 +    function doTest()
    1.41 +    {
    1.42 +      //////////////////////////////////////////////////////////////////////////
    1.43 +      // role="tablist"
    1.44 +
    1.45 +      id = "tablist";
    1.46 +      ok(isAccessible(id, [nsIAccessibleSelectable]),
    1.47 +         "No selectable accessible for " + id);
    1.48 +
    1.49 +      testSelectableSelection(id, [ ]);
    1.50 +
    1.51 +      //////////////////////////////////////////////////////////////////////////
    1.52 +      // role="listbox"
    1.53 +
    1.54 +      id = "listbox1";
    1.55 +      ok(isAccessible(id, [nsIAccessibleSelectable]),
    1.56 +         "No selectable accessible for " + id);
    1.57 +
    1.58 +      testSelectableSelection(id, [ ]);
    1.59 +
    1.60 +      //////////////////////////////////////////////////////////////////////////
    1.61 +      // role="listbox" aria-multiselectable
    1.62 +
    1.63 +      id = "listbox2";
    1.64 +      ok(isAccessible(id, [nsIAccessibleSelectable]),
    1.65 +         "No selectable accessible for " + id);
    1.66 +
    1.67 +      testSelectableSelection(id, [ ]);
    1.68 +
    1.69 +      select = getAccessible(id, [nsIAccessibleSelectable]);
    1.70 +      select.addItemToSelection(0);
    1.71 +      testSelectableSelection(id, [ "listbox2_item1" ]);
    1.72 +      select.removeItemFromSelection(0);
    1.73 +      testSelectableSelection(id, [ ]);
    1.74 +      select.selectAll();
    1.75 +      testSelectableSelection(id, [ "listbox2_item1", "listbox2_item2" ]);
    1.76 +      select.unselectAll();
    1.77 +      testSelectableSelection(id, [ ]);
    1.78 +      
    1.79 +      //////////////////////////////////////////////////////////////////////////
    1.80 +      // role="grid"
    1.81 +
    1.82 +      id = "grid1";
    1.83 +      ok(isAccessible(id, [nsIAccessibleSelectable]),
    1.84 +         "No selectable accessible for " + id);
    1.85 +
    1.86 +      testSelectableSelection(id, [ ]);
    1.87 +
    1.88 +      //////////////////////////////////////////////////////////////////////////
    1.89 +      // role="tree"
    1.90 +
    1.91 +      id = "tree1";
    1.92 +      ok(isAccessible(id, [nsIAccessibleSelectable]),
    1.93 +         "No selectable accessible for " + id);
    1.94 +
    1.95 +      testSelectableSelection(id, [ ]);
    1.96 +
    1.97 +      //////////////////////////////////////////////////////////////////////////
    1.98 +      // role="treegrid"
    1.99 +
   1.100 +      id = "treegrid1";
   1.101 +      ok(isAccessible(id, [nsIAccessibleSelectable]),
   1.102 +         "No selectable accessible for " + id);
   1.103 +
   1.104 +      testSelectableSelection(id, [ ]);
   1.105 +
   1.106 +      //////////////////////////////////////////////////////////////////////////
   1.107 +      // role="grid" aria-multiselectable, selectable children in subtree
   1.108 +
   1.109 +      id = "grid2";
   1.110 +      ok(isAccessible(id, [nsIAccessibleSelectable]),
   1.111 +         "No selectable accessible for " + id);
   1.112 +
   1.113 +      testSelectable(id,
   1.114 +                     ["grid2_colhead1", "grid2_colhead2", "grid2_colhead3",
   1.115 +                      "grid2_rowhead", "grid2_cell1", "grid2_cell2"]);
   1.116 +
   1.117 +      SimpleTest.finish();
   1.118 +    }
   1.119 +
   1.120 +    SimpleTest.waitForExplicitFinish();
   1.121 +    addA11yLoadEvent(doTest);
   1.122 +  </script>
   1.123 +
   1.124 +</head>
   1.125 +
   1.126 +<body>
   1.127 +
   1.128 +  <a target="_blank"
   1.129 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=530014"
   1.130 +     title="ARIA single selectable widget should implement nsIAccessibleSelectable">
   1.131 +    Mozilla Bug 530014
   1.132 +  </a>
   1.133 +  <a target="_blank"
   1.134 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=566551"
   1.135 +     title="ARIA grid and accessible selectable methods shouldn't use GetNextSibling">
   1.136 +    Mozilla Bug 566551
   1.137 +  </a>
   1.138 +  <a target="_blank"
   1.139 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=590176"
   1.140 +     title="add pseudo SelectAccessible interface">
   1.141 +    Mozilla Bug 590176
   1.142 +  </a>
   1.143 +  <a target="_blank"
   1.144 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=804040"
   1.145 +     title="Selection event not fired when selection of ARIA tab changes">
   1.146 +    Mozilla Bug 804040
   1.147 +  </a>
   1.148 +  <p id="display"></p>
   1.149 +  <div id="content" style="display: none"></div>
   1.150 +  <pre id="test">
   1.151 +  </pre>
   1.152 +
   1.153 +  <div role="tablist" id="tablist">
   1.154 +    <div role="tab">tab1</div>
   1.155 +    <div role="tab">tab2</div>
   1.156 +  </div>
   1.157 +
   1.158 +  <div role="listbox" id="listbox1">
   1.159 +    <div role="option">item1</div>
   1.160 +    <div role="option">item2</div>
   1.161 +  </div>
   1.162 +
   1.163 +  <div role="listbox" id="listbox2" aria-multiselectable="true">
   1.164 +    <div role="option" id="listbox2_item1">item1</div>
   1.165 +    <div role="option" id="listbox2_item2">item2</div>
   1.166 +  </div>
   1.167 +
   1.168 +  <div role="grid" id="grid1">
   1.169 +    <div role="row">
   1.170 +      <span role="gridcell">cell</span>
   1.171 +      <span role="gridcell">cell</span>
   1.172 +    </div>
   1.173 +    <div role="row">
   1.174 +      <span role="gridcell">cell</span>
   1.175 +      <span role="gridcell">cell</span>
   1.176 +    </div>
   1.177 +  </div>
   1.178 +
   1.179 +  <div role="tree" id="tree1">
   1.180 +    <div role="treeitem">
   1.181 +      item1
   1.182 +      <div role="group">
   1.183 +        <div role="treeitem">item1.1</div>
   1.184 +      </div>
   1.185 +    </div>
   1.186 +    <div>item2</div>
   1.187 +  </div>
   1.188 +
   1.189 +  <div role="treegrid" id="treegrid1">
   1.190 +    <div role="row" aria-level="1">
   1.191 +      <span role="gridcell">cell</span>
   1.192 +      <span role="gridcell">cell</span>
   1.193 +    </div>
   1.194 +    <div role="row" aria-level="2">
   1.195 +      <span role="gridcell">cell</span>
   1.196 +      <span role="gridcell">cell</span>
   1.197 +    </div>
   1.198 +    <div role="row" aria-level="1">
   1.199 +      <span role="gridcell">cell</span>
   1.200 +      <span role="gridcell">cell</span>
   1.201 +    </div>
   1.202 +  </div>
   1.203 +
   1.204 +  <table tabindex="0" border="2" cellspacing="0" id="grid2" role="grid"
   1.205 +         aria-multiselectable="true">
   1.206 +    <thead>
   1.207 +      <tr>
   1.208 +        <th tabindex="-1" role="columnheader" id="grid2_colhead1"
   1.209 +            style="width:6em">Entry #</th>
   1.210 +        <th tabindex="-1" role="columnheader" id="grid2_colhead2"
   1.211 +            style="width:10em">Date</th>
   1.212 +        <th tabindex="-1" role="columnheader" id="grid2_colhead3"
   1.213 +            style="width:20em">Expense</th>
   1.214 +      </tr>
   1.215 +    </thead>
   1.216 +    <tbody>
   1.217 +      <tr>
   1.218 +        <td tabindex="-1" role="rowheader" id="grid2_rowhead"
   1.219 +            aria-readonly="true">1</td>
   1.220 +        <td tabindex="-1" role="gridcell" id="grid2_cell1"
   1.221 +            aria-selected="false">03/14/05</td>
   1.222 +        <td tabindex="-1" role="gridcell" id="grid2_cell2"
   1.223 +            aria-selected="false">Conference Fee</td>
   1.224 +      </tr>
   1.225 +    </tobdy>
   1.226 +  </table>
   1.227 +</body>
   1.228 +</html>

mercurial