1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/style/test/test_default_computed_style.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=800983 1.8 +--> 1.9 +<head> 1.10 + <meta charset="utf-8"> 1.11 + <title>Test for Bug 800983</title> 1.12 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.14 + <style> 1.15 + #display::before { content: "Visible"; display: block } 1.16 + #display { 1.17 + display: inline; 1.18 + margin-top: 0; 1.19 + background: yellow; 1.20 + color: blue; 1.21 + } 1.22 + </style> 1.23 +</head> 1.24 +<body> 1.25 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=800983">Mozilla Bug 800983</a> 1.26 +<p id="display"></p> 1.27 +<div id="content" style="display: none"> 1.28 + 1.29 +</div> 1.30 +<pre id="test"> 1.31 +<script type="application/javascript"> 1.32 + 1.33 +/** Test for Bug 800983 **/ 1.34 +var cs = getComputedStyle($("display")); 1.35 +var cs_pseudo = getComputedStyle($("display"), "::before") 1.36 + 1.37 +var cs_default = getDefaultComputedStyle($("display")); 1.38 +var cs_default_pseudo = getDefaultComputedStyle($("display"), "::before"); 1.39 + 1.40 +// Sanity checks for normal computed style 1.41 +is(cs.display, "inline", "We have inline display"); 1.42 +is(cs.marginTop, "0px", "We have 0 margin"); 1.43 +is(cs.backgroundColor, "rgb(255, 255, 0)", "We have yellow background"); 1.44 +is(cs.color, "rgb(0, 0, 255)", "We have blue text"); 1.45 +is(cs_pseudo.content, '"Visible"', "We have some content"); 1.46 +is(cs_pseudo.display, "block", "Our ::before is block"); 1.47 + 1.48 +// And now our actual tests 1.49 +is(cs_default.display, "block", "We have block display by default"); 1.50 +is(cs_default.marginTop, "16px", "We have 16px margin by default"); 1.51 +is(cs_default.backgroundColor, "transparent", 1.52 + "We have transparent background by default"); 1.53 +is(cs_default.color, "rgb(0, 0, 0)", "We have black text by default"); 1.54 +is(cs_default_pseudo.content, "none", "We have no content by default"); 1.55 +is(cs_default_pseudo.display, "inline", "Our ::before is inline by default"); 1.56 + 1.57 + 1.58 +</script> 1.59 +</pre> 1.60 +</body> 1.61 +</html>