1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/style/test/test_bug377947.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,113 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=377947 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 377947</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=377947">Mozilla Bug 377947</a> 1.16 +<p id="display"></p> 1.17 +<div id="content" style="display: none"> 1.18 + 1.19 +</div> 1.20 +<pre id="test"> 1.21 +<script class="testbody" type="text/javascript"> 1.22 + 1.23 +/** Test for Bug 377947 **/ 1.24 + 1.25 +/* 1.26 + * In particular, test that CSSStyleDeclaration.getPropertyValue doesn't 1.27 + * return values for shorthands when some of the subproperties are not 1.28 + * specified (a change that wasn't all that related to the main point of 1.29 + * the bug). And also test that the internal system-font property added 1.30 + * in bug 377947 doesn't interfere with that. 1.31 + */ 1.32 + 1.33 +var s = document.getElementById("display").style; 1.34 + 1.35 +is(s.getPropertyValue("list-style"), "", 1.36 + "list-style shorthand should start off empty"); 1.37 +s.listStyleType="disc"; 1.38 +s.listStyleImage="none"; 1.39 +is(s.getPropertyValue("list-style"), "", 1.40 + "list-style shorthand should be empty when some subproperties specified"); 1.41 +s.listStylePosition="inside"; 1.42 +isnot(s.getPropertyValue("list-style"), "", 1.43 + "list-style shorthand should produce value when all subproperties set"); 1.44 +s.removeProperty("list-style"); 1.45 +is(s.getPropertyValue("list-style"), "", 1.46 + "list-style shorthand be empty after removal"); 1.47 +s.listStyle="none"; 1.48 +isnot(s.getPropertyValue("list-style"), "", 1.49 + "list-style shorthand should produce value when shorthand set"); 1.50 +s.removeProperty("list-style"); 1.51 +is(s.getPropertyValue("list-style"), "", 1.52 + "list-style shorthand be empty after removal"); 1.53 + 1.54 +is(s.getPropertyValue("font"), "", 1.55 + "font shorthand should start off empty"); 1.56 +var all_but_one = { 1.57 + "font-family": "serif", 1.58 + "font-style": "normal", 1.59 + "font-variant": "normal", 1.60 + "font-weight": "bold", 1.61 + "font-size": "small", 1.62 + "font-size-adjust": "none", // has to be default value 1.63 + "font-stretch": "normal", // has to be default value 1.64 + "-moz-font-feature-settings": "normal", // has to be default value 1.65 + "-moz-font-language-override": "normal" // has to be default value 1.66 +}; 1.67 +if (SpecialPowers.getBoolPref("layout.css.font-features.enabled")) { 1.68 + var featureDefs = { 1.69 + "font-kerning": "auto", // has to be default value 1.70 + "font-synthesis": "weight style", // has to be default value 1.71 + "font-variant-alternates": "normal", // has to be default value 1.72 + "font-variant-caps": "normal", // has to be default value 1.73 + "font-variant-east-asian": "normal", // has to be default value 1.74 + "font-variant-ligatures": "normal", // has to be default value 1.75 + "font-variant-numeric": "normal", // has to be default value 1.76 + "font-variant-position": "normal" // has to be default value 1.77 + }; 1.78 + for (var prop in featureDefs) { 1.79 + all_but_one[prop] = featureDefs[prop]; 1.80 + } 1.81 +} 1.82 +for (var prop in all_but_one) { 1.83 + s.setProperty(prop, all_but_one[prop], ""); 1.84 +} 1.85 +is(s.getPropertyValue("font"), "", 1.86 + "font shorthand should be empty when some subproperties specified"); 1.87 +s.setProperty("line-height", "1.5", ""); 1.88 +isnot(s.getPropertyValue("font"), "", 1.89 + "font shorthand should produce value when all subproperties set"); 1.90 +s.setProperty("font-stretch", "condensed", ""); 1.91 +is(s.getPropertyValue("font"), "", 1.92 + "font shorthand should be empty when font-stretch is non-default"); 1.93 +s.setProperty("font-stretch", "normal", ""); 1.94 +isnot(s.getPropertyValue("font"), "", 1.95 + "font shorthand should produce value when all subproperties set"); 1.96 +s.removeProperty("font"); 1.97 +is(s.getPropertyValue("font"), "", 1.98 + "font shorthand be empty after removal"); 1.99 +s.font="medium serif"; 1.100 +isnot(s.getPropertyValue("font"), "", 1.101 + "font shorthand should produce value when shorthand set"); 1.102 +s.removeProperty("font"); 1.103 +is(s.getPropertyValue("font"), "", 1.104 + "font shorthand be empty after removal"); 1.105 +s.font="menu"; 1.106 +isnot(s.getPropertyValue("font"), "", 1.107 + "font shorthand should produce value when shorthand (system font) set"); 1.108 +s.removeProperty("font"); 1.109 +is(s.getPropertyValue("font"), "", 1.110 + "font shorthand be empty after removal"); 1.111 + 1.112 +</script> 1.113 +</pre> 1.114 +</body> 1.115 +</html> 1.116 +