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