accessible/tests/mochitest/treeupdate/test_deck.xul

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     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="Tree update on XUL deck panel switching">
     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="../states.js" />
    18   <script type="application/javascript"
    19           src="../events.js" />
    21   <script type="application/javascript">
    22   <![CDATA[
    23     function switchDeckPanel(aContainerID, aDeckID)
    24     {
    25       this.panelIndex = 0;
    27       this.container = getAccessible(aContainerID);
    28       this.deckNode = getNode(aDeckID);
    29       this.prevPanel = getAccessible(this.deckNode.selectedPanel);
    30       this.panelNode = this.deckNode.childNodes[this.panelIndex];
    32       this.eventSeq = [
    33         new invokerChecker(EVENT_HIDE, this.prevPanel),
    34         new invokerChecker(EVENT_SHOW, this.panelNode),
    35         new invokerChecker(EVENT_REORDER, this.container)
    36       ];
    38       this.invoke = function switchDeckPanel_invoke()
    39       {
    40         var tree =
    41           { GROUPING: [ // role="group"
    42             { GROUPING: [ // groupbox, a selected panel #2
    43               { PUSHBUTTON: [ ] } // button
    44             ] }
    45           ] };
    46         testAccessibleTree(this.container, tree);
    48         this.deckNode.selectedIndex = this.panelIndex;
    49       }
    51       this.finalCheck = function switchDeckPanel_finalCheck()
    52       {
    53         var tree =
    54           { GROUPING: [ // role="group"
    55             { LABEL: [ // description, a selected panel #1
    56               { TEXT_LEAF: []  } // text leaf, a description value
    57             ] }
    58           ] };
    59         testAccessibleTree(this.container, tree);
    60       }
    62       this.getID = function switchDeckPanel_getID()
    63       {
    64         return "switch deck panel";
    65       }
    66     }
    68     var gQueue = null;
    69     function doTest()
    70     {
    71       gQueue = new eventQueue();
    72       gQueue.push(new switchDeckPanel("container", "deck"));
    73       gQueue.invoke(); // will call SimpleTest.finish();
    74     }
    76     SimpleTest.waitForExplicitFinish();
    77     addA11yLoadEvent(doTest);
    78   ]]>
    79   </script>
    81   <hbox flex="1" style="overflow: auto;">
    82     <body xmlns="http://www.w3.org/1999/xhtml">
    83      <a target="_blank"
    84          href="https://bugzilla.mozilla.org/show_bug.cgi?id=814836"
    85          title=" xul:deck element messes up screen reader">
    86         Mozilla Bug 814836
    87      </a>
    89       <p id="display"></p>
    90       <div id="content" style="display: none">
    91       </div>
    92       <pre id="test">
    93       </pre>
    94     </body>
    96     <vbox flex="1" id="container" role="group">
    98       <deck id="deck" selectedIndex="1">
    99         <description>This is the first page</description>
   100         <groupbox>
   101           <button label="This is the second page"/>
   102         </groupbox>
   103       </deck>
   105     </vbox>
   106   </hbox>
   108 </window>

mercurial