layout/base/tests/chrome/dialog_with_positioning_window.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/tests/chrome/dialog_with_positioning_window.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,30 @@
     1.4 +<?xml version="1.0" encoding="UTF-8" ?>
     1.5 +<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
     1.6 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     1.7 +        onload="setTimeout(runTest, 0)">
     1.8 +  <vbox>
     1.9 +    <text value="powered by example.com" style="padding: 16px;"/>
    1.10 +  </vbox>
    1.11 +  <hbox id="t" style="position: fixed; right: 16px; bottom: 16px;">
    1.12 +    <button label="OK"/>
    1.13 +  </hbox>
    1.14 +<script><![CDATA[
    1.15 +var SimpleTest = window.opener.wrappedJSObject.SimpleTest;
    1.16 +var SpecialPowers = window.opener.wrappedJSObject.SpecialPowers;
    1.17 +var is = window.opener.wrappedJSObject.is;
    1.18 +var ok = window.opener.wrappedJSObject.ok;
    1.19 +
    1.20 +// We run this off a setTimeout from onload, because the XUL window
    1.21 +// only does its intrinsic-height layout after the load event has
    1.22 +// finished
    1.23 +function runTest() {
    1.24 +  var t = document.getElementById("t");
    1.25 +  var tBottom = t.getBoundingClientRect().bottom;
    1.26 +  is(tBottom, document.documentElement.getBoundingClientRect().bottom - 16,
    1.27 +     "check fixed-pos element t bottom positioned correctly");
    1.28 +  ok(tBottom < 200, "fixed-pos element t bottom must be sane, less than 200 (got " + tBottom + ")");
    1.29 +  window.close();
    1.30 +  SimpleTest.finish();
    1.31 +}
    1.32 +]]></script>
    1.33 +</window>

mercurial