tor-browser

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

test_general.xhtml (9446B)


      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        xmlns:html="http://www.w3.org/1999/xhtml"
      8        title="nsIAccessible::getAccessibleRelated() tests">
      9 
     10  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
     11 
     12  <script type="application/javascript"
     13          src="../common.js" />
     14  <script type="application/javascript"
     15          src="../relations.js" />
     16  <script type="application/javascript"
     17          src="../role.js" />
     18 
     19  <script type="application/javascript">
     20  <![CDATA[
     21    function doTest()
     22    {
     23      // xul:label@control
     24      testRelation("label1", RELATION_LABEL_FOR, "checkbox1");
     25      testRelation("checkbox1", RELATION_LABELLED_BY, "label1");
     26 
     27      // xul:label@control, multiple
     28      testRelation("label1_1", RELATION_LABEL_FOR, "checkbox1_1");
     29      testRelation("label1_2", RELATION_LABEL_FOR, "checkbox1_1");
     30      testRelation("checkbox1_1", RELATION_LABELLED_BY,
     31                   [ "label1_1", "label1_2" ]);
     32 
     33      // aria-labelledby
     34      testRelation("label2", RELATION_LABEL_FOR, "checkbox2");
     35      testRelation("checkbox2", RELATION_LABELLED_BY, "label2");
     36 
     37      // aria-labelledby, multiple relations
     38      testRelation("label3", RELATION_LABEL_FOR, "checkbox3");
     39      testRelation("label4", RELATION_LABEL_FOR, "checkbox3");
     40      testRelation("checkbox3", RELATION_LABELLED_BY, ["label3", "label4"]);
     41 
     42      // xul:label@control referring to HTML element
     43      testRelation("label_input", RELATION_LABEL_FOR, "input");
     44      testRelation("input", RELATION_LABELLED_BY, "label_input");
     45 
     46      // aria-describedby
     47      testRelation("descr1", RELATION_DESCRIPTION_FOR, "checkbox4");
     48      testRelation("checkbox4", RELATION_DESCRIBED_BY, "descr1");
     49 
     50      // aria-describedby, multiple relations
     51      testRelation("descr2", RELATION_DESCRIPTION_FOR, "checkbox5");
     52      testRelation("descr3", RELATION_DESCRIPTION_FOR, "checkbox5");
     53      testRelation("checkbox5", RELATION_DESCRIBED_BY, ["descr2", "descr3"]);
     54 
     55      // xul:description@control
     56      testRelation("descr4", RELATION_DESCRIPTION_FOR, "checkbox6");
     57      testRelation("checkbox6", RELATION_DESCRIBED_BY, "descr4");
     58 
     59      // xul:description@control, multiple
     60      testRelation("descr5", RELATION_DESCRIPTION_FOR, "checkbox7");
     61      testRelation("descr6", RELATION_DESCRIPTION_FOR, "checkbox7");
     62      testRelation("checkbox7", RELATION_DESCRIBED_BY,
     63                   [ "descr5", "descr6" ]);
     64 
     65      // aria_owns, multiple relations
     66      testRelation("treeitem1", RELATION_NODE_CHILD_OF, "tree");
     67      testRelation("treeitem2", RELATION_NODE_CHILD_OF, "tree");
     68 
     69      // 'node child of' relation for outlineitem role
     70      testRelation("treeitem3", RELATION_NODE_CHILD_OF, "tree");
     71      testRelation("treeitem4", RELATION_NODE_CHILD_OF, "tree");
     72      testRelation("treeitem5", RELATION_NODE_CHILD_OF, "treeitem4");
     73 
     74      // no relation node_child_of for accessible contained in an unexpected
     75      // parent
     76      testRelation("treeitem6", RELATION_NODE_CHILD_OF, null);
     77 
     78      // 'node child of' relation for the document having window, returns
     79      // direct accessible parent (fixed in bug 419770).
     80      var iframeElmObj = {};
     81      var iframeAcc = getAccessible("iframe", null, iframeElmObj);
     82      var iframeDoc = iframeElmObj.value.contentDocument;
     83      var iframeDocAcc = getAccessible(iframeDoc);
     84      testRelation(iframeDocAcc, RELATION_NODE_CHILD_OF, iframeAcc);
     85 
     86      // aria-controls
     87      getAccessible("tab");
     88      todo(false,
     89           "Getting an accessible tab, otherwise relations for tabpanel aren't cached. Bug 606924 will fix that.");
     90      testRelation("tabpanel", RELATION_CONTROLLED_BY, "tab");
     91      testRelation("tab", RELATION_CONTROLLER_FOR, "tabpanel");
     92 
     93      // aria-controls, multiple relations
     94      testRelation("lr1", RELATION_CONTROLLED_BY, "button");
     95      testRelation("lr2", RELATION_CONTROLLED_BY, "button");
     96      testRelation("button", RELATION_CONTROLLER_FOR, ["lr1", "lr2"]);
     97 
     98      // aria-flowto
     99      testRelation("flowto", RELATION_FLOWS_TO, "flowfrom");
    100      testRelation("flowfrom", RELATION_FLOWS_FROM, "flowto");
    101 
    102      // aria-flowto, multiple relations
    103      testRelation("flowto1", RELATION_FLOWS_TO, ["flowfrom1", "flowfrom2"]);
    104      testRelation("flowfrom1", RELATION_FLOWS_FROM, "flowto1");
    105      testRelation("flowfrom2", RELATION_FLOWS_FROM, "flowto1");
    106 
    107      // 'labelled by'/'label for' relation for xul:groupbox and xul:label
    108      var groupboxAcc = getAccessible("groupbox");
    109      var labelAcc = groupboxAcc.firstChild;
    110      testRelation(labelAcc, RELATION_LABEL_FOR, groupboxAcc);
    111      testRelation(groupboxAcc, RELATION_LABELLED_BY, labelAcc);
    112 
    113      // 'labelled by'/'label for' relations for xul:tab and xul:tabpanel
    114      // (fixed in bug 366527)
    115      testRelation("tabpanel1", RELATION_LABELLED_BY, "tab1");
    116      testRelation("tab1", RELATION_LABEL_FOR, "tabpanel1");
    117      testRelation("tabpanel2", RELATION_LABELLED_BY, "tab2");
    118      testRelation("tab2", RELATION_LABEL_FOR, "tabpanel2");
    119      testRelation("tabpanel3", RELATION_LABELLED_BY, "tab3");
    120      testRelation("tab3", RELATION_LABEL_FOR, "tabpanel3");
    121 
    122      // finish test
    123      SimpleTest.finish();
    124    }
    125 
    126    SimpleTest.waitForExplicitFinish();
    127    addA11yLoadEvent(doTest);
    128  ]]>
    129  </script>
    130 
    131  <vbox style="overflow: auto;" flex="1">
    132    <body xmlns="http://www.w3.org/1999/xhtml">
    133      <a target="_blank"
    134         href="https://bugzilla.mozilla.org/show_bug.cgi?id=475298"
    135         title="mochitests for accessible relations">
    136        Mozilla Bug 475298
    137      </a><br/>
    138      <a target="_blank"
    139         href="https://bugzilla.mozilla.org/show_bug.cgi?id=673389"
    140         title="node_child_of on an item not in a proper container">
    141        Mozilla Bug 67389
    142      </a><br/>
    143 
    144      <p id="display"></p>
    145      <div id="content" style="display: none">
    146      </div>
    147      <pre id="test">
    148      </pre>
    149    </body>
    150 
    151    <label id="label1" control="checkbox1">label</label>
    152    <checkbox id="checkbox1"/>
    153 
    154    <label id="label1_1" control="checkbox1_1">label</label>
    155    <label id="label1_2" control="checkbox1_1">label</label>
    156    <checkbox id="checkbox1_1"/>
    157 
    158    <description id="label2">label</description>
    159    <description role="checkbox" id="checkbox2" aria-labelledby="label2"/>
    160 
    161    <description id="label3">label</description>
    162    <description id="label4">label</description>
    163    <description role="checkbox" id="checkbox3"
    164                 aria-labelledby="label3 label4"/>
    165 
    166    <label id="label_input" control="input">label</label>
    167    <html:input id="input"/>
    168 
    169    <description id="descr1">description</description>
    170    <description role="checkbox" id="checkbox4" aria-describedby="descr1"/>
    171 
    172    <description id="descr2">label</description>
    173    <description id="descr3">label</description>
    174    <description role="checkbox" id="checkbox5"
    175                 aria-describedby="descr2 descr3"/>
    176 
    177    <description id="descr4" control="checkbox6">description</description>
    178    <checkbox id="checkbox6"/>
    179 
    180    <description id="descr5" control="checkbox7">description</description>
    181    <description id="descr6" control="checkbox7">description</description>
    182    <checkbox id="checkbox7"/>
    183 
    184    <description role="treeitem" id="treeitem1">Yellow</description>
    185    <description role="treeitem" id="treeitem2">Orange</description>
    186    <vbox id="tree" role="tree" aria-owns="treeitem1 treeitem2">
    187      <description role="treeitem" id="treeitem3">Blue</description>
    188      <description role="treeitem" id="treeitem4" aria-level="1">Green</description>
    189      <description role="treeitem" id="treeitem5" aria-level="2">Light green</description>
    190    </vbox>
    191 
    192    <description role="treeitem" id="treeitem6">Dark green</description>
    193 
    194    <iframe id="iframe"/>
    195 
    196    <hbox id="tablist" role="tablist">
    197      <description id="tab" role="tab" aria-controls="tabpanel">tab</description>
    198    </hbox>
    199    <description id="tabpanel" role="tabpanel">tabpanel</description>
    200 
    201    <description id="lr1" aria-live="assertive">1</description>
    202    <description id="lr2" aria-live="assertive">a</description>
    203    <button id="button" aria-controls="lr1 lr2" label="button"
    204            oncommand="getNode('lr1').textContent += '1'; getNode('lr2').textContent += 'a';"/>
    205 
    206    <description id="flowto1" aria-flowto="flowfrom1 flowfrom2">flow to</description>
    207    <description id="flowfrom1">flow from</description>
    208    <description id="flowfrom2">flow from</description>
    209 
    210    <description id="flowto" aria-flowto="flowfrom">flow to</description>
    211    <description id="flowfrom">flow from</description>
    212 
    213    <groupbox id="groupbox">
    214      <label value="caption"/>
    215    </groupbox>
    216 
    217    <tabbox>
    218      <tabs>
    219        <tab label="tab1" id="tab1"/>
    220        <tab label="tab2" id="tab2" linkedpanel="tabpanel2"/>
    221        <tab label="tab3" id="tab3" linkedpanel="tabpanel3"/>
    222      </tabs>
    223      <tabpanels>
    224        <tabpanel id="tabpanel1">
    225          <description>tabpanel1</description>
    226        </tabpanel>
    227        <tabpanel id="tabpanel3">
    228          <description>tabpanel3</description>
    229        </tabpanel>
    230        <tabpanel id="tabpanel2">
    231          <description>tabpanel2</description>
    232        </tabpanel>
    233      </tabpanels>
    234    </tabbox>
    235 
    236 </vbox>
    237 </window>