toolkit/content/tests/chrome/test_popuphidden.xul

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:ff35c7c4f5a3
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" type="text/css"?>
4
5 <window title="Hidden Popup Test"
6 onload="setTimeout(runTests, 0, $('popup'));"
7 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
8
9 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
10
11 <menupopup id="popup" hidden="true" onpopupshown="ok(true, 'popupshown'); this.hidePopup()"
12 onpopuphidden="$('popup-hideonshow').openPopup(null, 'after_start')">
13 <menuitem id="i1" label="One"/>
14 <menuitem id="i2" label="Two"/>
15 </menupopup>
16
17 <menupopup id="popup-hideonshow" onpopupshowing="hidePopupWhileShowing(this)"
18 onpopupshown="ok(false, 'popupshown when hidden')">
19 <menuitem id="i1" label="One"/>
20 <menuitem id="i2" label="Two"/>
21 </menupopup>
22
23 <button id="button" type="menu" label="Menu" onDOMAttrModified="checkEndTest(event)">
24 <menupopup id="popupinbutton" hidden="true"
25 onpopupshown="ok(true, 'popupshown'); ok($('button').open, 'open'); this.hidden = true;">
26 <menuitem id="i1" label="One"/>
27 <menuitem id="i2" label="Two"/>
28 </menupopup>
29 </button>
30
31 <script class="testbody" type="application/javascript">
32 <![CDATA[
33
34 SimpleTest.waitForExplicitFinish();
35
36 function runTests(popup)
37 {
38 popup.hidden = false;
39 popup.openPopup(null, "after_start");
40 }
41
42 function hidePopupWhileShowing(popup)
43 {
44 popup.hidden = true;
45 popup.clientWidth; // flush layout
46 is(popup.state, 'closed', 'popupshowing hidden');
47 SimpleTest.executeSoon(function () runTests($('popupinbutton')));
48 }
49
50 function checkEndTest(event)
51 {
52 var button = $("button");
53 if (event.originalTarget != button || event.attrName != 'open' || event.attrChange != event.REMOVAL)
54 return;
55
56 ok($("popupinbutton").hidden, "popup hidden");
57 is($("popupinbutton").state, "closed", "popup state");
58 ok(!button.open, "not open after hidden");
59 SimpleTest.finish();
60 }
61
62 ]]>
63 </script>
64
65 <body xmlns="http://www.w3.org/1999/xhtml">
66 <p id="display">
67 </p>
68 <div id="content" style="display: none">
69 </div>
70 <pre id="test">
71 </pre>
72 </body>
73
74 </window>

mercurial