test_deck.xhtml (4600B)
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="Tree update on XUL deck panel switching"> 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="../events.js" /> 19 20 <script type="application/javascript"> 21 <![CDATA[ 22 function switchDeckPanel(aContainerID, aDeckID) 23 { 24 this.panelIndex = 0; 25 26 this.container = getAccessible(aContainerID); 27 this.deckNode = getNode(aDeckID); 28 this.prevPanel = getAccessible(this.deckNode.selectedPanel); 29 this.panelNode = this.deckNode.childNodes[this.panelIndex]; 30 31 this.eventSeq = [ 32 new invokerChecker(EVENT_HIDE, this.prevPanel), 33 new invokerChecker(EVENT_SHOW, this.panelNode), 34 new invokerChecker(EVENT_REORDER, this.container) 35 ]; 36 37 this.invoke = function switchDeckPanel_invoke() 38 { 39 var tree = 40 { GROUPING: [ // role="group" 41 { GROUPING: [ // groupbox, a selected panel #2 42 { PUSHBUTTON: [ ] } // button 43 ] } 44 ] }; 45 testAccessibleTree(this.container, tree); 46 47 this.deckNode.selectedIndex = this.panelIndex; 48 } 49 50 this.finalCheck = function switchDeckPanel_finalCheck() 51 { 52 var tree = 53 { GROUPING: [ // role="group" 54 { LABEL: [ // description, a selected panel #1 55 { TEXT_LEAF: [] } // text leaf, a description value 56 ] } 57 ] }; 58 testAccessibleTree(this.container, tree); 59 } 60 61 this.getID = function switchDeckPanel_getID() 62 { 63 return "switch deck panel"; 64 } 65 } 66 67 function showDeckPanel(aContainerID, aPanelID) 68 { 69 this.container = getAccessible(aContainerID); 70 this.deckNode = getNode(aPanelID); 71 var tree = 72 { GROUPING: [ // role="group" 73 { GROUPING: [ // grouping of panel 2 74 { PUSHBUTTON: [] } // push button in panel 2 75 ] } 76 ] }; 77 78 79 this.unexpectedEventSeq = [ 80 new invokerChecker(EVENT_REORDER, this.container) 81 ]; 82 83 this.invoke = function showDeckPanel_invoke() 84 { 85 // This stops the refreh driver from doing its regular ticks, and leaves 86 // us in control. 100 is an arbitrary positive number to advance the clock 87 // it is not checked or used anywhere. 88 window.windowUtils.advanceTimeAndRefresh(100); 89 90 testAccessibleTree(this.container, tree); 91 this.deckNode.style.display = "-moz-box"; 92 93 // This flushes our DOM mutations and forces any pending mutation events. 94 window.windowUtils.advanceTimeAndRefresh(100); 95 } 96 97 this.finalCheck = function showDeckPanel_finalCheck() 98 { 99 testAccessibleTree(this.container, tree); 100 101 // Return to regular refresh driver ticks. 102 window.windowUtils.restoreNormalRefresh(); 103 } 104 105 this.getID = function showDeckPanel_getID() 106 { 107 return "show deck panel"; 108 } 109 } 110 111 var gQueue = null; 112 function doTest() 113 { 114 gQueue = new eventQueue(); 115 gQueue.push(new showDeckPanel("container", "hidden")); 116 gQueue.push(new switchDeckPanel("container", "deck")); 117 gQueue.invoke(); // will call SimpleTest.finish(); 118 } 119 120 SimpleTest.waitForExplicitFinish(); 121 addA11yLoadEvent(doTest); 122 ]]> 123 </script> 124 125 <hbox flex="1" style="overflow: auto;"> 126 <body xmlns="http://www.w3.org/1999/xhtml"> 127 <a target="_blank" 128 href="https://bugzilla.mozilla.org/show_bug.cgi?id=814836" 129 title=" xul:deck element messes up screen reader"> 130 Mozilla Bug 814836 131 </a> 132 133 <p id="display"></p> 134 <div id="content" style="display: none"> 135 </div> 136 <pre id="test"> 137 </pre> 138 </body> 139 140 <vbox flex="1" id="container" role="group"> 141 142 <deck id="deck" selectedIndex="1"> 143 <description>This is the first page</description> 144 <groupbox> 145 <button label="This is the second page"/> 146 </groupbox> 147 <hbox id="hidden" style="display: none;"><label>This is the third page</label></hbox> 148 </deck> 149 150 </vbox> 151 </hbox> 152 153 </window>