layout/style/test/test_bug377947.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

     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 type="text/javascript" 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">
    16 </div>
    17 <pre id="test">
    18 <script class="testbody" type="text/javascript">
    20 /** Test for Bug 377947 **/
    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  */
    30 var s = document.getElementById("display").style;
    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");
    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-size-adjust": "none", // has to be default value
    60   "font-stretch": "normal", // has to be default value
    61   "-moz-font-feature-settings": "normal", // has to be default value
    62   "-moz-font-language-override": "normal" // has to be default value
    63 };
    64 if (SpecialPowers.getBoolPref("layout.css.font-features.enabled")) {
    65   var featureDefs = {
    66     "font-kerning": "auto", // has to be default value
    67     "font-synthesis": "weight style", // has to be default value
    68     "font-variant-alternates": "normal", // has to be default value
    69     "font-variant-caps": "normal", // has to be default value
    70     "font-variant-east-asian": "normal", // 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   for (var prop in featureDefs) {
    76     all_but_one[prop] = featureDefs[prop];
    77   }
    78 }
    79 for (var prop in all_but_one) {
    80   s.setProperty(prop, all_but_one[prop], "");
    81 }
    82 is(s.getPropertyValue("font"), "",
    83    "font shorthand should be empty when some subproperties specified");
    84 s.setProperty("line-height", "1.5", "");
    85 isnot(s.getPropertyValue("font"), "",
    86       "font shorthand should produce value when all subproperties set");
    87 s.setProperty("font-stretch", "condensed", "");
    88 is(s.getPropertyValue("font"), "",
    89    "font shorthand should be empty when font-stretch is non-default");
    90 s.setProperty("font-stretch", "normal", "");
    91 isnot(s.getPropertyValue("font"), "",
    92       "font shorthand should produce value when all subproperties set");
    93 s.removeProperty("font");
    94 is(s.getPropertyValue("font"), "",
    95    "font shorthand be empty after removal");
    96 s.font="medium serif";
    97 isnot(s.getPropertyValue("font"), "",
    98       "font shorthand should produce value when shorthand set");
    99 s.removeProperty("font");
   100 is(s.getPropertyValue("font"), "",
   101    "font shorthand be empty after removal");
   102 s.font="menu";
   103 isnot(s.getPropertyValue("font"), "",
   104       "font shorthand should produce value when shorthand (system font) set");
   105 s.removeProperty("font");
   106 is(s.getPropertyValue("font"), "",
   107    "font shorthand be empty after removal");
   109 </script>
   110 </pre>
   111 </body>
   112 </html>

mercurial