tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_tabs.xhtml (2994B)


      1 <?xml version="1.0"?>
      2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
      3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
      4                 type="text/css"?>
      5 
      6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
      7        title="XUL tabs selectable tests">
      8 
      9  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
     10 
     11  <script type="application/javascript"
     12          src="../common.js" />
     13  <script type="application/javascript"
     14          src="../role.js" />
     15  <script type="application/javascript"
     16          src="../states.js" />
     17  <script type="application/javascript"
     18          src="../selectable.js" />
     19 
     20  <script type="application/javascript">
     21  <![CDATA[
     22 
     23    ////////////////////////////////////////////////////////////////////////////
     24    // Test
     25 
     26    function doTest()
     27    {
     28      var id = "tabs_single";
     29      ok(isAccessible(id, [nsIAccessibleSelectable]),
     30         "No selectable accessible for tabs_single");
     31      var select = getAccessible(id, [nsIAccessibleSelectable]);
     32 
     33      testSelectableSelection(select, ["tab_single1"]);
     34 
     35      select.unselectAll();
     36      select.addItemToSelection(1); // tab_single2
     37      testSelectableSelection(select, ["tab_single2"], "select tab_single2: ");
     38 
     39      id = "tabs_multi";
     40      ok(isAccessible(id, [nsIAccessibleSelectable]),
     41         "No selectable accessible for tabs_multi");
     42      select = getAccessible(id, [nsIAccessibleSelectable]);
     43 
     44      // Make sure both XUL selection and ARIA selection are included.
     45      testSelectableSelection(select, ["tab_multi_xul1", "tab_multi_aria"]);
     46 
     47      select.unselectAll();
     48      select.addItemToSelection(2); // tab_multi_xul2
     49      // We can only affect XUL selection, so ARIA selection won't change.
     50      testSelectableSelection(select, ["tab_multi_aria", "tab_multi_xul2"],
     51                              "select tab_multi_xul2: ");
     52 
     53      SimpleTest.finish();
     54    }
     55 
     56    SimpleTest.waitForExplicitFinish();
     57    addA11yLoadEvent(doTest);
     58  ]]>
     59  </script>
     60 
     61  <hbox flex="1" style="overflow: auto;">
     62    <body xmlns="http://www.w3.org/1999/xhtml">
     63      <a target="_blank"
     64        href="https://bugzilla.mozilla.org/show_bug.cgi?id=1480058"
     65        title="XUL tabs don't support ARIA selection">
     66       Mozilla Bug 1480058
     67      </a><br/>
     68      <p id="display"></p>
     69      <div id="content" style="display: none">
     70      </div>
     71      <pre id="test">
     72      </pre>
     73    </body>
     74 
     75    <vbox flex="1">
     76      <tabbox>
     77        <tabs id="tabs_single">
     78          <tab id="tab_single1" label="tab1" selected="true"/>
     79          <tab id="tab_single2" label="tab2"/>
     80        </tabs>
     81      </tabbox>
     82 
     83      <tabbox>
     84        <tabs id="tabs_multi" aria-multiselectable="true">
     85          <tab id="tab_multi_xul1" label="tab1" selected="true"/>
     86          <tab id="tab_multi_aria" label="tab2" aria-selected="true"/>
     87          <tab id="tab_multi_xul2" label="tab3"/>
     88        </tabs>
     89      </tabbox>
     90    </vbox>
     91  </hbox>
     92 
     93 </window>