layout/style/test/test_default_computed_style.html

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=800983
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <meta charset="utf-8">
michael@0 8 <title>Test for Bug 800983</title>
michael@0 9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 11 <style>
michael@0 12 #display::before { content: "Visible"; display: block }
michael@0 13 #display {
michael@0 14 display: inline;
michael@0 15 margin-top: 0;
michael@0 16 background: yellow;
michael@0 17 color: blue;
michael@0 18 }
michael@0 19 </style>
michael@0 20 </head>
michael@0 21 <body>
michael@0 22 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=800983">Mozilla Bug 800983</a>
michael@0 23 <p id="display"></p>
michael@0 24 <div id="content" style="display: none">
michael@0 25
michael@0 26 </div>
michael@0 27 <pre id="test">
michael@0 28 <script type="application/javascript">
michael@0 29
michael@0 30 /** Test for Bug 800983 **/
michael@0 31 var cs = getComputedStyle($("display"));
michael@0 32 var cs_pseudo = getComputedStyle($("display"), "::before")
michael@0 33
michael@0 34 var cs_default = getDefaultComputedStyle($("display"));
michael@0 35 var cs_default_pseudo = getDefaultComputedStyle($("display"), "::before");
michael@0 36
michael@0 37 // Sanity checks for normal computed style
michael@0 38 is(cs.display, "inline", "We have inline display");
michael@0 39 is(cs.marginTop, "0px", "We have 0 margin");
michael@0 40 is(cs.backgroundColor, "rgb(255, 255, 0)", "We have yellow background");
michael@0 41 is(cs.color, "rgb(0, 0, 255)", "We have blue text");
michael@0 42 is(cs_pseudo.content, '"Visible"', "We have some content");
michael@0 43 is(cs_pseudo.display, "block", "Our ::before is block");
michael@0 44
michael@0 45 // And now our actual tests
michael@0 46 is(cs_default.display, "block", "We have block display by default");
michael@0 47 is(cs_default.marginTop, "16px", "We have 16px margin by default");
michael@0 48 is(cs_default.backgroundColor, "transparent",
michael@0 49 "We have transparent background by default");
michael@0 50 is(cs_default.color, "rgb(0, 0, 0)", "We have black text by default");
michael@0 51 is(cs_default_pseudo.content, "none", "We have no content by default");
michael@0 52 is(cs_default_pseudo.display, "inline", "Our ::before is inline by default");
michael@0 53
michael@0 54
michael@0 55 </script>
michael@0 56 </pre>
michael@0 57 </body>
michael@0 58 </html>

mercurial