accessible/tests/mochitest/selectable/test_aria.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <html>
     3 <head>
     4   <title>nsIAccessibleSelectable ARIA widgets testing</title>
     6   <link rel="stylesheet" type="text/css"
     7         href="chrome://mochikit/content/tests/SimpleTest/test.css" />
     9   </style>
    11   <script type="application/javascript"
    12           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    14   <script type="application/javascript"
    15           src="../common.js"></script>
    16   <script type="application/javascript"
    17           src="../role.js"></script>
    18   <script type="application/javascript"
    19           src="../states.js"></script>
    20   <script type="application/javascript"
    21           src="../selectable.js"></script>
    23   <script type="application/javascript">
    24     function testSelectable(aID, aSelectableChildren)
    25     {
    26       var acc = getAccessible(aID, [nsIAccessibleSelectable]);
    28       testSelectableSelection(acc, []);
    30       acc.selectAll();
    31       testSelectableSelection(acc, aSelectableChildren);
    33       acc.unselectAll();
    34       testSelectableSelection(acc, []);
    35     }
    37     function doTest()
    38     {
    39       //////////////////////////////////////////////////////////////////////////
    40       // role="tablist"
    42       id = "tablist";
    43       ok(isAccessible(id, [nsIAccessibleSelectable]),
    44          "No selectable accessible for " + id);
    46       testSelectableSelection(id, [ ]);
    48       //////////////////////////////////////////////////////////////////////////
    49       // role="listbox"
    51       id = "listbox1";
    52       ok(isAccessible(id, [nsIAccessibleSelectable]),
    53          "No selectable accessible for " + id);
    55       testSelectableSelection(id, [ ]);
    57       //////////////////////////////////////////////////////////////////////////
    58       // role="listbox" aria-multiselectable
    60       id = "listbox2";
    61       ok(isAccessible(id, [nsIAccessibleSelectable]),
    62          "No selectable accessible for " + id);
    64       testSelectableSelection(id, [ ]);
    66       select = getAccessible(id, [nsIAccessibleSelectable]);
    67       select.addItemToSelection(0);
    68       testSelectableSelection(id, [ "listbox2_item1" ]);
    69       select.removeItemFromSelection(0);
    70       testSelectableSelection(id, [ ]);
    71       select.selectAll();
    72       testSelectableSelection(id, [ "listbox2_item1", "listbox2_item2" ]);
    73       select.unselectAll();
    74       testSelectableSelection(id, [ ]);
    76       //////////////////////////////////////////////////////////////////////////
    77       // role="grid"
    79       id = "grid1";
    80       ok(isAccessible(id, [nsIAccessibleSelectable]),
    81          "No selectable accessible for " + id);
    83       testSelectableSelection(id, [ ]);
    85       //////////////////////////////////////////////////////////////////////////
    86       // role="tree"
    88       id = "tree1";
    89       ok(isAccessible(id, [nsIAccessibleSelectable]),
    90          "No selectable accessible for " + id);
    92       testSelectableSelection(id, [ ]);
    94       //////////////////////////////////////////////////////////////////////////
    95       // role="treegrid"
    97       id = "treegrid1";
    98       ok(isAccessible(id, [nsIAccessibleSelectable]),
    99          "No selectable accessible for " + id);
   101       testSelectableSelection(id, [ ]);
   103       //////////////////////////////////////////////////////////////////////////
   104       // role="grid" aria-multiselectable, selectable children in subtree
   106       id = "grid2";
   107       ok(isAccessible(id, [nsIAccessibleSelectable]),
   108          "No selectable accessible for " + id);
   110       testSelectable(id,
   111                      ["grid2_colhead1", "grid2_colhead2", "grid2_colhead3",
   112                       "grid2_rowhead", "grid2_cell1", "grid2_cell2"]);
   114       SimpleTest.finish();
   115     }
   117     SimpleTest.waitForExplicitFinish();
   118     addA11yLoadEvent(doTest);
   119   </script>
   121 </head>
   123 <body>
   125   <a target="_blank"
   126      href="https://bugzilla.mozilla.org/show_bug.cgi?id=530014"
   127      title="ARIA single selectable widget should implement nsIAccessibleSelectable">
   128     Mozilla Bug 530014
   129   </a>
   130   <a target="_blank"
   131      href="https://bugzilla.mozilla.org/show_bug.cgi?id=566551"
   132      title="ARIA grid and accessible selectable methods shouldn't use GetNextSibling">
   133     Mozilla Bug 566551
   134   </a>
   135   <a target="_blank"
   136      href="https://bugzilla.mozilla.org/show_bug.cgi?id=590176"
   137      title="add pseudo SelectAccessible interface">
   138     Mozilla Bug 590176
   139   </a>
   140   <a target="_blank"
   141      href="https://bugzilla.mozilla.org/show_bug.cgi?id=804040"
   142      title="Selection event not fired when selection of ARIA tab changes">
   143     Mozilla Bug 804040
   144   </a>
   145   <p id="display"></p>
   146   <div id="content" style="display: none"></div>
   147   <pre id="test">
   148   </pre>
   150   <div role="tablist" id="tablist">
   151     <div role="tab">tab1</div>
   152     <div role="tab">tab2</div>
   153   </div>
   155   <div role="listbox" id="listbox1">
   156     <div role="option">item1</div>
   157     <div role="option">item2</div>
   158   </div>
   160   <div role="listbox" id="listbox2" aria-multiselectable="true">
   161     <div role="option" id="listbox2_item1">item1</div>
   162     <div role="option" id="listbox2_item2">item2</div>
   163   </div>
   165   <div role="grid" id="grid1">
   166     <div role="row">
   167       <span role="gridcell">cell</span>
   168       <span role="gridcell">cell</span>
   169     </div>
   170     <div role="row">
   171       <span role="gridcell">cell</span>
   172       <span role="gridcell">cell</span>
   173     </div>
   174   </div>
   176   <div role="tree" id="tree1">
   177     <div role="treeitem">
   178       item1
   179       <div role="group">
   180         <div role="treeitem">item1.1</div>
   181       </div>
   182     </div>
   183     <div>item2</div>
   184   </div>
   186   <div role="treegrid" id="treegrid1">
   187     <div role="row" aria-level="1">
   188       <span role="gridcell">cell</span>
   189       <span role="gridcell">cell</span>
   190     </div>
   191     <div role="row" aria-level="2">
   192       <span role="gridcell">cell</span>
   193       <span role="gridcell">cell</span>
   194     </div>
   195     <div role="row" aria-level="1">
   196       <span role="gridcell">cell</span>
   197       <span role="gridcell">cell</span>
   198     </div>
   199   </div>
   201   <table tabindex="0" border="2" cellspacing="0" id="grid2" role="grid"
   202          aria-multiselectable="true">
   203     <thead>
   204       <tr>
   205         <th tabindex="-1" role="columnheader" id="grid2_colhead1"
   206             style="width:6em">Entry #</th>
   207         <th tabindex="-1" role="columnheader" id="grid2_colhead2"
   208             style="width:10em">Date</th>
   209         <th tabindex="-1" role="columnheader" id="grid2_colhead3"
   210             style="width:20em">Expense</th>
   211       </tr>
   212     </thead>
   213     <tbody>
   214       <tr>
   215         <td tabindex="-1" role="rowheader" id="grid2_rowhead"
   216             aria-readonly="true">1</td>
   217         <td tabindex="-1" role="gridcell" id="grid2_cell1"
   218             aria-selected="false">03/14/05</td>
   219         <td tabindex="-1" role="gridcell" id="grid2_cell2"
   220             aria-selected="false">Conference Fee</td>
   221       </tr>
   222     </tobdy>
   223   </table>
   224 </body>
   225 </html>

mercurial