test_bug467442.xhtml (1763B)
1 <?xml version="1.0"?> 2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?> 3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?> 4 <!-- 5 https://bugzilla.mozilla.org/show_bug.cgi?id=467442 6 --> 7 <window title="Mozilla Bug 467442" 8 onload="onload()" 9 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 10 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> 11 12 <!-- test code goes here --> 13 <popupset> 14 <panel id="panel"> 15 Hello. 16 </panel> 17 </popupset> 18 <hbox> 19 <button id="anchor" label="Anchor hello on here" style="transform: translate(100px, 0)"/> 20 </hbox> 21 <script type="application/javascript"> 22 <![CDATA[ 23 24 SimpleTest.waitForExplicitFinish(); 25 26 function onload() { 27 /** Test for Bug 467442 */ 28 let panel = document.getElementById("panel"); 29 let anchor = document.getElementById("anchor"); 30 31 panel.addEventListener("popupshown", function onpopupshown() { 32 let panelRect = panel.getBoundingClientRect(); 33 let marginLeft = parseFloat(getComputedStyle(panel).marginLeft); 34 let anchorRect = anchor.getBoundingClientRect(); 35 is(panelRect.left - marginLeft, anchorRect.left, "Panel should be anchored to the button"); 36 panel.addEventListener("popuphidden", function onpopuphidden() { 37 SimpleTest.finish(); 38 }, { once: true }); 39 panel.hidePopup(); 40 }, { once: true }); 41 42 panel.openPopup(anchor, "after_start", 0, 0, false, false); 43 } 44 45 ]]> 46 </script> 47 48 <!-- test results are displayed in the html:body --> 49 <body xmlns="http://www.w3.org/1999/xhtml"> 50 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=467442" 51 target="_blank">Mozilla Bug 467442</a> 52 </body> 53 </window>