accessible/tests/mochitest/treeupdate/test_listbox.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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"?>
     6 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     7         title="Accessible XUL listbox hierarchy tests">
     9   <script type="application/javascript"
    10           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
    12   <script type="application/javascript"
    13           src="../common.js" />
    14   <script type="application/javascript"
    15           src="../role.js" />
    16   <script type="application/javascript"
    17           src="../events.js" />
    19   <script type="application/javascript">
    20   <![CDATA[
    21     ////////////////////////////////////////////////////////////////////////////
    22     // Test
    24     function insertListitem(aListboxID)
    25     {
    26       this.listboxNode = getNode(aListboxID);
    28       this.listitemNode = document.createElement("listitem");
    29       this.listitemNode.setAttribute("label", "item1");
    31       this.eventSeq = [
    32         new invokerChecker(EVENT_SHOW, this.listitemNode),
    33         new invokerChecker(EVENT_REORDER, this.listboxNode)
    34       ];
    36       this.invoke = function insertListitem_invoke()
    37       {
    38         this.listboxNode.insertBefore(this.listitemNode,
    39                                       this.listboxNode.firstChild);
    40       }
    42       this.finalCheck = function insertListitem_finalCheck()
    43       {
    44         var tree =
    45           { LISTBOX: [
    46             {
    47               role: ROLE_RICH_OPTION,
    48               name: "item1"
    49             },
    50             {
    51               role: ROLE_RICH_OPTION,
    52               name: "item2"
    53             },
    54             {
    55               role: ROLE_RICH_OPTION,
    56               name: "item3"
    57             },
    58             {
    59               role: ROLE_RICH_OPTION,
    60               name: "item4"
    61             }
    62           ] };
    63         testAccessibleTree(this.listboxNode, tree);
    64       }
    66       this.getID = function insertListitem_getID()
    67       {
    68         return "insert listitem ";
    69       }
    70     }
    72     function removeListitem(aListboxID)
    73     {
    74       this.listboxNode = getNode(aListboxID);
    75       this.listitemNode = null;
    76       this.listitem;
    78       function getListitem(aThisObj)
    79       {
    80         return aThisObj.listitem;
    81       }
    83       this.eventSeq = [
    84         new invokerChecker(EVENT_HIDE, getListitem, this),
    85         new invokerChecker(EVENT_REORDER, this.listboxNode)
    86       ];
    88       this.invoke = function removeListitem_invoke()
    89       {
    90         this.listitemNode = this.listboxNode.firstChild;
    91         this.listitem = getAccessible(this.listitemNode);
    93         this.listboxNode.removeChild(this.listitemNode);
    94       }
    96       this.finalCheck = function removeListitem_finalCheck()
    97       {
    98         var tree =
    99           { LISTBOX: [
   100             {
   101               role: ROLE_RICH_OPTION,
   102               name: "item2"
   103             },
   104             {
   105               role: ROLE_RICH_OPTION,
   106               name: "item3"
   107             },
   108             {
   109               role: ROLE_RICH_OPTION,
   110               name: "item4"
   111             }
   112           ] };
   113         testAccessibleTree(this.listboxNode, tree);
   114       }
   116       this.getID = function removeListitem_getID()
   117       {
   118         return "remove listitem ";
   119       }
   120     }
   122     //gA11yEventDumpToConsole = true; // debug stuff
   124     var gQueue = null;
   125     function doTest()
   126     {
   127       var tree =
   128         { LISTBOX: [
   129           {
   130             role: ROLE_RICH_OPTION,
   131             name: "item2"
   132           },
   133           {
   134             role: ROLE_RICH_OPTION,
   135             name: "item3"
   136           },
   137           {
   138             role: ROLE_RICH_OPTION,
   139             name: "item4"
   140           }
   141         ] };
   142       testAccessibleTree("listbox", tree);
   144       gQueue = new eventQueue();
   145       gQueue.push(new insertListitem("listbox"));
   146       gQueue.push(new removeListitem("listbox"));
   147       gQueue.invoke(); // Will call SimpleTest.finish()
   148     }
   150     SimpleTest.waitForExplicitFinish();
   151     addA11yLoadEvent(doTest);
   152   ]]>
   153   </script>
   155   <hbox flex="1" style="overflow: auto;">
   156     <body xmlns="http://www.w3.org/1999/xhtml">
   157       <a target="_blank"
   158          href="https://bugzilla.mozilla.org/show_bug.cgi?id=656225"
   159          title="XUL listbox accessible tree doesn't get updated">
   160         Mozilla Bug 656225
   161       </a>
   162       <br/>
   163       <p id="display"></p>
   164       <div id="content" style="display: none">
   165       </div>
   166       <pre id="test">
   167       </pre>
   168     </body>
   170     <vbox flex="1">
   171       <listbox id="listbox" rows="2">
   172         <listitem label="item2"/>
   173         <listitem label="item3"/>
   174         <listitem label="item4"/>
   175       </listbox>
   176     </vbox>
   177   </hbox>
   179 </window>

mercurial