test_bug377947.html (4141B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=377947 5 --> 6 <head> 7 <title>Test for Bug 377947</title> 8 <script 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=377947">Mozilla Bug 377947</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"> 15 16 </div> 17 <pre id="test"> 18 <script class="testbody" type="text/javascript"> 19 20 /** Test for Bug 377947 */ 21 22 /* 23 * In particular, test that CSSStyleDeclaration.getPropertyValue doesn't 24 * return values for shorthands when some of the subproperties are not 25 * specified (a change that wasn't all that related to the main point of 26 * the bug). And also test that the internal system-font property added 27 * in bug 377947 doesn't interfere with that. 28 */ 29 30 var s = document.getElementById("display").style; 31 32 is(s.getPropertyValue("list-style"), "", 33 "list-style shorthand should start off empty"); 34 s.listStyleType="disc"; 35 s.listStyleImage="none"; 36 is(s.getPropertyValue("list-style"), "", 37 "list-style shorthand should be empty when some subproperties specified"); 38 s.listStylePosition="inside"; 39 isnot(s.getPropertyValue("list-style"), "", 40 "list-style shorthand should produce value when all subproperties set"); 41 s.removeProperty("list-style"); 42 is(s.getPropertyValue("list-style"), "", 43 "list-style shorthand be empty after removal"); 44 s.listStyle="none"; 45 isnot(s.getPropertyValue("list-style"), "", 46 "list-style shorthand should produce value when shorthand set"); 47 s.removeProperty("list-style"); 48 is(s.getPropertyValue("list-style"), "", 49 "list-style shorthand be empty after removal"); 50 51 is(s.getPropertyValue("font"), "", 52 "font shorthand should start off empty"); 53 var all_but_one = { 54 "font-family": "serif", 55 "font-style": "normal", 56 "font-variant": "normal", 57 "font-weight": "bold", 58 "font-size": "small", 59 "font-stretch": "normal", 60 "font-size-adjust": "none", // has to be default value 61 "font-feature-settings": "normal", // has to be default value 62 "font-variation-settings": "normal", // has to be default value 63 "font-language-override": "normal", // has to be default value 64 "font-kerning": "auto", // has to be default value 65 "font-optical-sizing": "auto", // has to be default value 66 "font-synthesis": "weight style", // has to be default value 67 "font-variant-alternates": "normal", // has to be default value 68 "font-variant-caps": "normal", // has to be default value 69 "font-variant-east-asian": "normal", // has to be default value 70 "font-variant-emoji": "auto", // has to be default value 71 "font-variant-ligatures": "normal", // has to be default value 72 "font-variant-numeric": "normal", // has to be default value 73 "font-variant-position": "normal" // has to be default value 74 }; 75 76 for (var prop in all_but_one) { 77 s.setProperty(prop, all_but_one[prop], ""); 78 } 79 is(s.getPropertyValue("font"), "", 80 "font shorthand should be empty when some subproperties specified"); 81 s.setProperty("line-height", "1.5", ""); 82 isnot(s.getPropertyValue("font"), "", 83 "font shorthand should produce value when all subproperties set"); 84 s.setProperty("font-size-adjust", "0.5", ""); 85 is(s.getPropertyValue("font"), "", 86 "font shorthand should be empty when font-size-adjust is non-default"); 87 s.setProperty("font-size-adjust", "none", ""); 88 isnot(s.getPropertyValue("font"), "", 89 "font shorthand should produce value when all subproperties set"); 90 s.removeProperty("font"); 91 is(s.getPropertyValue("font"), "", 92 "font shorthand be empty after removal"); 93 s.font="medium serif"; 94 isnot(s.getPropertyValue("font"), "", 95 "font shorthand should produce value when shorthand set"); 96 s.removeProperty("font"); 97 is(s.getPropertyValue("font"), "", 98 "font shorthand be empty after removal"); 99 s.font="menu"; 100 isnot(s.getPropertyValue("font"), "", 101 "font shorthand should produce value when shorthand (system font) set"); 102 s.removeProperty("font"); 103 is(s.getPropertyValue("font"), "", 104 "font shorthand be empty after removal"); 105 106 </script> 107 </pre> 108 </body> 109 </html>