tor-browser

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

test_moz_prefixed_properties.html (1869B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test animations of all properties that have -moz prefix</title>
      5  <script src="/resources/testharness.js"></script>
      6  <script src="/resources/testharnessreport.js"></script>
      7  <script src="../testcommon.js"></script>
      8  <script src="../property_database.js"></script>
      9 </head>
     10 <body>
     11 <div id="log"></div>
     12 <script>
     13 "use strict";
     14 
     15 const testcases = [
     16  {
     17    property: "-moz-box-align"
     18  },
     19  {
     20    property: "-moz-box-direction"
     21  },
     22  {
     23    property: "-moz-box-ordinal-group"
     24  },
     25  {
     26    property: "-moz-box-orient",
     27  },
     28  {
     29    property: "-moz-box-pack"
     30  },
     31  {
     32    property: "-moz-float-edge"
     33  },
     34  {
     35    property: "-moz-force-broken-image-icon"
     36  },
     37  {
     38    property: "-moz-orient"
     39  },
     40  {
     41    property: "-moz-osx-font-smoothing",
     42    pref: "layout.css.osx-font-smoothing.enabled"
     43  },
     44  {
     45    property: "-moz-text-size-adjust"
     46  },
     47 ];
     48 
     49 testcases.forEach(testcase => {
     50  if (testcase.pref && !IsCSSPropertyPrefEnabled(testcase.pref)) {
     51    return;
     52  }
     53 
     54  const property = gCSSProperties[testcase.property];
     55  const values = property.initial_values.concat(property.other_values);
     56  values.forEach(value => {
     57    test(function(t) {
     58      const container = addDiv(t);
     59      const target = document.createElement("div");
     60      container.appendChild(target);
     61 
     62      container.style[property.domProp] = value;
     63 
     64      const animation =
     65        target.animate({ [property.domProp]: [value, "inherit"] },
     66                       { duration: 1000, delay: -500 } );
     67 
     68      const expectedValue = getComputedStyle(container)[property.domProp];
     69      assert_equals(getComputedStyle(target)[property.domProp], expectedValue,
     70                    `Computed style shoud be "${ expectedValue }"`);
     71    }, `Test inherit value for "${ testcase.property }" `
     72       + `(Parent element style is "${ value }")`);
     73  });
     74 });
     75 </script>
     76 </body>
     77 </html>