layout/style/test/test_bug391034.html

branch
TOR_BUG_9701
changeset 11
deefc01c0e14
equal deleted inserted replaced
-1:000000000000 0:f4dd1256e9a3
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=391034
5 -->
6 <head>
7 <title>Test for Bug 391034</title>
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
10 </head>
11 <body>
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=391034">Mozilla Bug 391034</a>
13 <div id="display" style="width: 90px; height: 80px">
14 <div id="width-ref" style="width: 2ch"></div>
15 <div id="width-ref2" style="width: 5ch"></div>
16 <div id="one" style="position: relative; left: 2ch; bottom: 5ch"></div>
17 <div id="two" style="position: relative; left: 10%; bottom: 20%"></div>
18 <div id="three" style="position: relative; left: 10px; bottom: 6px"></div>
19 </div>
20 <div id="content" style="display: none">
21 <div id="four" style="position: relative; left: 10%; bottom: 20%"></div>
22 </div>
23 <pre id="test">
24 <script class="testbody" type="text/javascript">
25
26 /** Test for Bug 391034 **/
27 function getComp(id) {
28 return document.defaultView.getComputedStyle($(id), "");
29 }
30
31 is(getComp("one").top, "-" + getComp("width-ref2").width,
32 "Incorrect computed top offset if specified in ch")
33 is(getComp("one").right, "-" + getComp("width-ref").width,
34 "Incorrect computed right offset if specified in ch")
35 is(getComp("one").bottom, getComp("width-ref2").width,
36 "Incorrect computed bottom offset if specified in ch")
37 is(getComp("one").left, getComp("width-ref").width,
38 "Incorrect computed left offset if specified in ch")
39
40 is(getComp("two").top, "-16px",
41 "Incorrect computed top offset if specified in %")
42 is(getComp("two").right, "-9px",
43 "Incorrect computed right offset if specified in %")
44 is(getComp("two").bottom, "16px",
45 "Incorrect computed bottom offset if specified in %")
46 is(getComp("two").left, "9px",
47 "Incorrect computed left offset if specified in %")
48
49 is(getComp("three").top, "-6px",
50 "Incorrect computed top offset if specified in %")
51 is(getComp("three").right, "-10px",
52 "Incorrect computed right offset if specified in %")
53 is(getComp("three").bottom, "6px",
54 "Incorrect computed bottom offset if specified in %")
55 is(getComp("three").left, "10px",
56 "Incorrect computed left offset if specified in %")
57
58 is(getComp("four").top, "auto",
59 "Incorrect undisplayed computed top offset if specified in %")
60 is(getComp("four").right, "auto",
61 "Incorrect undisplayed computed right offset if specified in %")
62 is(getComp("four").bottom, "20%",
63 "Incorrect undisplayed computed bottom offset if specified in %")
64 is(getComp("four").left, "10%",
65 "Incorrect undisplayed computed left offset if specified in %")
66
67 </script>
68 </pre>
69 </body>
70 </html>
71

mercurial