tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

background-size-001.html (7178B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>CSS Backgrounds and Borders Test: background-size - initial and supported values</title>
      5    <link rel="author" title="Intel" href="http://www.intel.com" />
      6    <link rel="help" href="http://www.w3.org/TR/css3-background/#the-background-size" />
      7    <meta name="flags" content="dom" />
      8    <meta name="assert" content="Check if background-size initial value is auto and supports values auto, cover and contain" />
      9    <script src="/resources/testharness.js"></script>
     10    <script src="/resources/testharnessreport.js"></script>
     11  </head>
     12  <body>
     13    <div id="log"></div>
     14    <div id="test"></div>
     15    <script>
     16        test(function() {
     17            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
     18                "auto", "background-size initial value");
     19        }, "background-size_initial");
     20 
     21        document.getElementById("test").style.backgroundSize = "auto";
     22        test(function() {
     23            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
     24                "auto", "background-size supporting value");
     25        }, "background-size_auto");
     26 
     27        document.getElementById("test").style.backgroundSize = "cover";
     28        test(function() {
     29            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
     30                "cover", "background-size supporting value");
     31        }, "background-size_cover");
     32 
     33        document.getElementById("test").style.backgroundSize = "contain";
     34        test(function() {
     35            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
     36                "contain", "background-size supporting value");
     37        }, "background-size_contain");
     38 
     39        document.getElementById("test").style.backgroundSize = "0px";
     40        test(function() {
     41            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
     42                "0px auto", "background-size supporting value");
     43        }, "background-size_length_zero");
     44 
     45        document.getElementById("test").style.backgroundSize = "-0px";
     46        test(function() {
     47            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
     48                "0px auto", "background-size supporting value");
     49        }, "background-size_length_negative_zero");
     50 
     51        document.getElementById("test").style.backgroundSize = "+0px";
     52        test(function() {
     53            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
     54                "0px auto", "background-size supporting value");
     55        }, "background-size_length_positive_zero");
     56 
     57        document.getElementById("test").style.backgroundSize = "15px";
     58        test(function() {
     59            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
     60                "15px auto", "background-size supporting value");
     61        }, "background-size_length_normal");
     62 
     63        document.getElementById("test").style.backgroundSize = "0%";
     64        test(function() {
     65            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
     66                "0% auto", "background-size supporting value");
     67        }, "background-size_percentage_min");
     68 
     69        document.getElementById("test").style.backgroundSize = "50%";
     70        test(function() {
     71            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
     72                "50% auto", "background-size supporting value");
     73        }, "background-size_percentage_normal");
     74 
     75        document.getElementById("test").style.backgroundSize = "100%";
     76        test(function() {
     77            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
     78                "100% auto", "background-size supporting value");
     79        }, "background-size_percentage_max");
     80 
     81        document.getElementById("test").style.backgroundSize = "auto auto";
     82        test(function() {
     83            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
     84                "auto", "background-size supporting value");
     85        }, "background-size_auto_auto");
     86 
     87        document.getElementById("test").style.backgroundSize = "auto 15px";
     88        test(function() {
     89            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
     90                "auto 15px", "background-size supporting value");
     91        }, "background-size_auto_length");
     92 
     93        document.getElementById("test").style.backgroundSize = "auto 50%";
     94        test(function() {
     95            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
     96                "auto 50%", "background-size supporting value");
     97        }, "background-size_auto_percentage");
     98 
     99        document.getElementById("test").style.backgroundSize = "15px auto";
    100        test(function() {
    101            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
    102                "15px auto", "background-size supporting value");
    103        }, "background-size_length_auto");
    104 
    105        document.getElementById("test").style.backgroundSize = "15px 15px";
    106        test(function() {
    107            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
    108                "15px 15px", "background-size supporting value");
    109        }, "background-size_length_length");
    110 
    111        document.getElementById("test").style.backgroundSize = "15px 50%";
    112        test(function() {
    113            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
    114                "15px 50%", "background-size supporting value");
    115        }, "background-size_length_percentage");
    116 
    117        document.getElementById("test").style.backgroundSize = "50% auto";
    118        test(function() {
    119            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
    120                "50% auto", "background-size supporting value");
    121        }, "background-size_percentage_auto");
    122 
    123        document.getElementById("test").style.backgroundSize = "50% 15px";
    124        test(function() {
    125            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
    126                "50% 15px", "background-size supporting value");
    127        }, "background-size_percentage_length");
    128 
    129        document.getElementById("test").style.backgroundSize = "50% 50%";
    130        test(function() {
    131            assert_equals(getComputedStyle(document.getElementById("test"), null).getPropertyValue("background-size"),
    132                "50% 50%", "background-size supporting value");
    133        }, "background-size_percentage_percentage");
    134    </script>
    135  </body>
    136 </html>