test_visibility.xhtml (5043B)
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="XUL elements visibility states testing"> 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="../role.js" /> 16 <script type="application/javascript" 17 src="../states.js" /> 18 <script type="application/javascript" 19 src="../events.js" /> 20 21 <script type="application/javascript"> 22 <![CDATA[ 23 function openMenu(aID, aSubID, aOffscreenSubID) 24 { 25 this.menuNode = getNode(aID); 26 27 this.eventSeq = [ 28 new invokerChecker(EVENT_FOCUS, this.menuNode) 29 ]; 30 31 this.invoke = function openMenu_invoke() 32 { 33 this.menuNode.open = true; 34 } 35 36 this.finalCheck = function openMenu_finalCheck() 37 { 38 testStates(aID, 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN); 39 testStates(aSubID, 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN); 40 if (aOffscreenSubID) 41 testStates(aOffscreenSubID, STATE_OFFSCREEN, 0, STATE_INVISIBLE); 42 } 43 44 this.getID = function openMenu_invoke() 45 { 46 return "open menu '" + aID + "' and test states"; 47 } 48 } 49 50 function closeMenu(aID, aSubID, aSub2ID) 51 { 52 this.menuNode = getNode(aID); 53 54 this.eventSeq = [ 55 new invokerChecker(EVENT_FOCUS, document) 56 ]; 57 58 this.invoke = function openMenu_invoke() 59 { 60 this.menuNode.open = false; 61 } 62 63 this.finalCheck = function openMenu_finalCheck() 64 { 65 testStates(aID, 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN); 66 testStates(aSubID, STATE_INVISIBLE, 0, STATE_OFFSCREEN); 67 testStates(aSub2ID, STATE_INVISIBLE, 0, STATE_OFFSCREEN); 68 } 69 70 this.getID = function openMenu_invoke() 71 { 72 return "open menu and test states"; 73 } 74 } 75 76 var gQueue = null; 77 function doTest() 78 { 79 testStates("deck_pane2", 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN); 80 testStates("tabs_pane1", 0, 0, STATE_INVISIBLE | STATE_OFFSCREEN); 81 testStates("tabs_pane2", STATE_OFFSCREEN, 0, STATE_INVISIBLE); 82 83 gQueue = new eventQueue(); 84 gQueue.push(new openMenu("mi_file1", "mi_file1.1")); 85 gQueue.push(new openMenu("mi_file1.2", "mi_file1.2.1", "mi_file1.2.4")); 86 gQueue.push(new closeMenu("mi_file1", "mi_file1.1", "mi_file1.2.1")); 87 gQueue.invoke(); // Will call SimpleTest.finish(); 88 } 89 90 SimpleTest.waitForExplicitFinish(); 91 addA11yLoadEvent(doTest); 92 ]]> 93 </script> 94 <html:style> 95 <![CDATA[ 96 /* We want to control the height of the menu and which elements are visible, 97 and the Windows menu padding interferes with this. */ 98 menupopup::part(arrowscrollbox) { 99 margin: 0 !important; 100 padding-block: 0 !important; 101 } 102 ]]> 103 </html:style> 104 105 <hbox flex="1" style="overflow: auto;"> 106 <body xmlns="http://www.w3.org/1999/xhtml"> 107 <a target="_blank" 108 href="https://bugzilla.mozilla.org/show_bug.cgi?id=810260" 109 title="xul:deck hidden pages shouldn't be offscreen"> 110 Mozilla Bug 810260 111 </a> 112 <a target="_blank" 113 href="https://bugzilla.mozilla.org/show_bug.cgi?id=865591" 114 title="Visible menu item have offscreen state"> 115 Mozilla Bug 865591 116 </a> 117 118 <p id="display"></p> 119 <div id="content" style="display: none"> 120 </div> 121 <pre id="test"> 122 </pre> 123 </body> 124 125 <vbox flex="1"> 126 127 <deck selectedIndex="1"> 128 <description value="This is the first page" id="deck_pane1"/> 129 <button label="This is the second page" id="deck_pane2"/> 130 </deck> 131 132 <tabbox> 133 <tabs> 134 <tab>tab1</tab> 135 <tab>tab2</tab> 136 </tabs> 137 <tabpanels> 138 <description value="This is the first page" id="tabs_pane1"/> 139 <button label="This is the second page" id="tabs_pane2"/> 140 </tabpanels> 141 </tabbox> 142 143 <menubar> 144 <menu label="File" id="mi_file1"> 145 <menupopup> 146 <menuitem label="SubFile" id="mi_file1.1"/> 147 <menu label="SubFile2" id="mi_file1.2"> 148 <menupopup style="max-height: 3em;"> 149 <menuitem style="appearance: none; height: 1em" label="SubSubFile" id="mi_file1.2.1"/> 150 <menuitem style="appearance: none; height: 1em" label="SubSubFile2" id="mi_file1.2.2"/> 151 <menuitem style="appearance: none; height: 1em" label="SubSubFile3" id="mi_file1.2.3"/> 152 <menuitem style="appearance: none; height: 1em" label="SubSubFile4" id="mi_file1.2.4"/> 153 </menupopup> 154 </menu> 155 </menupopup> 156 </menu> 157 </menubar> 158 </vbox> 159 </hbox> 160 161 </window>