layout/base/tests/chrome/dialog_with_positioning_window.xul

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:c112e9fe6fa8
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
3 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
4 onload="setTimeout(runTest, 0)">
5 <vbox>
6 <text value="powered by example.com" style="padding: 16px;"/>
7 </vbox>
8 <hbox id="t" style="position: fixed; right: 16px; bottom: 16px;">
9 <button label="OK"/>
10 </hbox>
11 <script><![CDATA[
12 var SimpleTest = window.opener.wrappedJSObject.SimpleTest;
13 var SpecialPowers = window.opener.wrappedJSObject.SpecialPowers;
14 var is = window.opener.wrappedJSObject.is;
15 var ok = window.opener.wrappedJSObject.ok;
16
17 // We run this off a setTimeout from onload, because the XUL window
18 // only does its intrinsic-height layout after the load event has
19 // finished
20 function runTest() {
21 var t = document.getElementById("t");
22 var tBottom = t.getBoundingClientRect().bottom;
23 is(tBottom, document.documentElement.getBoundingClientRect().bottom - 16,
24 "check fixed-pos element t bottom positioned correctly");
25 ok(tBottom < 200, "fixed-pos element t bottom must be sane, less than 200 (got " + tBottom + ")");
26 window.close();
27 SimpleTest.finish();
28 }
29 ]]></script>
30 </window>

mercurial