layout/style/test/test_bug391034.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/style/test/test_bug391034.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,71 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=391034
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 391034</title>
    1.11 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.13 +</head>
    1.14 +<body>
    1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=391034">Mozilla Bug 391034</a>
    1.16 +<div id="display" style="width: 90px; height: 80px">
    1.17 +  <div id="width-ref" style="width: 2ch"></div>
    1.18 +  <div id="width-ref2" style="width: 5ch"></div>
    1.19 +  <div id="one" style="position: relative; left: 2ch; bottom: 5ch"></div>  
    1.20 +  <div id="two" style="position: relative; left: 10%; bottom: 20%"></div>  
    1.21 +  <div id="three" style="position: relative; left: 10px; bottom: 6px"></div>
    1.22 +</div>
    1.23 +<div id="content" style="display: none">
    1.24 +  <div id="four" style="position: relative; left: 10%; bottom: 20%"></div>  
    1.25 +</div>
    1.26 +<pre id="test">
    1.27 +<script class="testbody" type="text/javascript">
    1.28 +
    1.29 +/** Test for Bug 391034 **/
    1.30 +function getComp(id) {
    1.31 + return document.defaultView.getComputedStyle($(id), "");
    1.32 +}
    1.33 +
    1.34 +is(getComp("one").top, "-" + getComp("width-ref2").width,
    1.35 +   "Incorrect computed top offset if specified in ch")
    1.36 +is(getComp("one").right, "-" + getComp("width-ref").width,
    1.37 +   "Incorrect computed right offset if specified in ch")
    1.38 +is(getComp("one").bottom, getComp("width-ref2").width,
    1.39 +   "Incorrect computed bottom offset if specified in ch")
    1.40 +is(getComp("one").left, getComp("width-ref").width,
    1.41 +   "Incorrect computed left offset if specified in ch")
    1.42 +
    1.43 +is(getComp("two").top, "-16px",
    1.44 +   "Incorrect computed top offset if specified in %")
    1.45 +is(getComp("two").right, "-9px",
    1.46 +   "Incorrect computed right offset if specified in %")
    1.47 +is(getComp("two").bottom, "16px",
    1.48 +   "Incorrect computed bottom offset if specified in %")
    1.49 +is(getComp("two").left, "9px",
    1.50 +   "Incorrect computed left offset if specified in %")
    1.51 +
    1.52 +is(getComp("three").top, "-6px",
    1.53 +   "Incorrect computed top offset if specified in %")
    1.54 +is(getComp("three").right, "-10px",
    1.55 +   "Incorrect computed right offset if specified in %")
    1.56 +is(getComp("three").bottom, "6px",
    1.57 +   "Incorrect computed bottom offset if specified in %")
    1.58 +is(getComp("three").left, "10px",
    1.59 +   "Incorrect computed left offset if specified in %")
    1.60 +
    1.61 +is(getComp("four").top, "auto",
    1.62 +   "Incorrect undisplayed computed top offset if specified in %")
    1.63 +is(getComp("four").right, "auto",
    1.64 +   "Incorrect undisplayed computed right offset if specified in %")
    1.65 +is(getComp("four").bottom, "20%",
    1.66 +   "Incorrect undisplayed computed bottom offset if specified in %")
    1.67 +is(getComp("four").left, "10%",
    1.68 +   "Incorrect undisplayed computed left offset if specified in %")
    1.69 +
    1.70 +</script>
    1.71 +</pre>
    1.72 +</body>
    1.73 +</html>
    1.74 +

mercurial