Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
michael@0 | 3 | <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" |
michael@0 | 4 | type="text/css"?> |
michael@0 | 5 | |
michael@0 | 6 | <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 7 | title="Tree update on XUL deck panel switching"> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> |
michael@0 | 11 | |
michael@0 | 12 | <script type="application/javascript" |
michael@0 | 13 | src="../common.js" /> |
michael@0 | 14 | <script type="application/javascript" |
michael@0 | 15 | src="../role.js" /> |
michael@0 | 16 | <script type="application/javascript" |
michael@0 | 17 | src="../states.js" /> |
michael@0 | 18 | <script type="application/javascript" |
michael@0 | 19 | src="../events.js" /> |
michael@0 | 20 | |
michael@0 | 21 | <script type="application/javascript"> |
michael@0 | 22 | <![CDATA[ |
michael@0 | 23 | function switchDeckPanel(aContainerID, aDeckID) |
michael@0 | 24 | { |
michael@0 | 25 | this.panelIndex = 0; |
michael@0 | 26 | |
michael@0 | 27 | this.container = getAccessible(aContainerID); |
michael@0 | 28 | this.deckNode = getNode(aDeckID); |
michael@0 | 29 | this.prevPanel = getAccessible(this.deckNode.selectedPanel); |
michael@0 | 30 | this.panelNode = this.deckNode.childNodes[this.panelIndex]; |
michael@0 | 31 | |
michael@0 | 32 | this.eventSeq = [ |
michael@0 | 33 | new invokerChecker(EVENT_HIDE, this.prevPanel), |
michael@0 | 34 | new invokerChecker(EVENT_SHOW, this.panelNode), |
michael@0 | 35 | new invokerChecker(EVENT_REORDER, this.container) |
michael@0 | 36 | ]; |
michael@0 | 37 | |
michael@0 | 38 | this.invoke = function switchDeckPanel_invoke() |
michael@0 | 39 | { |
michael@0 | 40 | var tree = |
michael@0 | 41 | { GROUPING: [ // role="group" |
michael@0 | 42 | { GROUPING: [ // groupbox, a selected panel #2 |
michael@0 | 43 | { PUSHBUTTON: [ ] } // button |
michael@0 | 44 | ] } |
michael@0 | 45 | ] }; |
michael@0 | 46 | testAccessibleTree(this.container, tree); |
michael@0 | 47 | |
michael@0 | 48 | this.deckNode.selectedIndex = this.panelIndex; |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | this.finalCheck = function switchDeckPanel_finalCheck() |
michael@0 | 52 | { |
michael@0 | 53 | var tree = |
michael@0 | 54 | { GROUPING: [ // role="group" |
michael@0 | 55 | { LABEL: [ // description, a selected panel #1 |
michael@0 | 56 | { TEXT_LEAF: [] } // text leaf, a description value |
michael@0 | 57 | ] } |
michael@0 | 58 | ] }; |
michael@0 | 59 | testAccessibleTree(this.container, tree); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | this.getID = function switchDeckPanel_getID() |
michael@0 | 63 | { |
michael@0 | 64 | return "switch deck panel"; |
michael@0 | 65 | } |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | var gQueue = null; |
michael@0 | 69 | function doTest() |
michael@0 | 70 | { |
michael@0 | 71 | gQueue = new eventQueue(); |
michael@0 | 72 | gQueue.push(new switchDeckPanel("container", "deck")); |
michael@0 | 73 | gQueue.invoke(); // will call SimpleTest.finish(); |
michael@0 | 74 | } |
michael@0 | 75 | |
michael@0 | 76 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 77 | addA11yLoadEvent(doTest); |
michael@0 | 78 | ]]> |
michael@0 | 79 | </script> |
michael@0 | 80 | |
michael@0 | 81 | <hbox flex="1" style="overflow: auto;"> |
michael@0 | 82 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 83 | <a target="_blank" |
michael@0 | 84 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=814836" |
michael@0 | 85 | title=" xul:deck element messes up screen reader"> |
michael@0 | 86 | Mozilla Bug 814836 |
michael@0 | 87 | </a> |
michael@0 | 88 | |
michael@0 | 89 | <p id="display"></p> |
michael@0 | 90 | <div id="content" style="display: none"> |
michael@0 | 91 | </div> |
michael@0 | 92 | <pre id="test"> |
michael@0 | 93 | </pre> |
michael@0 | 94 | </body> |
michael@0 | 95 | |
michael@0 | 96 | <vbox flex="1" id="container" role="group"> |
michael@0 | 97 | |
michael@0 | 98 | <deck id="deck" selectedIndex="1"> |
michael@0 | 99 | <description>This is the first page</description> |
michael@0 | 100 | <groupbox> |
michael@0 | 101 | <button label="This is the second page"/> |
michael@0 | 102 | </groupbox> |
michael@0 | 103 | </deck> |
michael@0 | 104 | |
michael@0 | 105 | </vbox> |
michael@0 | 106 | </hbox> |
michael@0 | 107 | |
michael@0 | 108 | </window> |
michael@0 | 109 |