Bug 1445437 [wpt PR 10014] - Rewrite CSSOM index tests, a=testonly
authorChris Nardi <christopherncarmel@hotmail.com>
Mon, 09 Apr 2018 21:35:50 +0000
changeset 467256 df33b6b95b927efc35f4c2d1cd7e477971c69824
parent 467255 6b04eaf54eecd8fcf3094b6bfaa71f83c558dfac
child 467257 6150e3eabf75813c20fadce80985ade85669ce9b
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1445437, 10014
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1445437 [wpt PR 10014] - Rewrite CSSOM index tests, a=testonly Automatic update from web-platform-testsRewrite CSSOM index tests index-001.html and index-002.html had nondescript names, and index-002.html used generate_tests. Merge index-001.html into shorthand-serialization.html, and create shorthand-values.html from index-002.html. Builds off the work of #5331. -- Correct serialization of overflow wpt-commits: d30e62092787a340b4cfbeb0434a75e15028f69d, 09329e8bb6498a74cc8c054a263b2698a72d2f8e wpt-pr: 10014 wpt-commits: d30e62092787a340b4cfbeb0434a75e15028f69d, 09329e8bb6498a74cc8c054a263b2698a72d2f8e wpt-pr: 10014
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/css/cssom/index-001.html
testing/web-platform/tests/css/cssom/index-002.html
testing/web-platform/tests/css/cssom/shorthand-serialization.html
testing/web-platform/tests/css/cssom/shorthand-values.html
testing/web-platform/tests/lint.whitelist
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -319812,28 +319812,16 @@
     ]
    ],
    "css/cssom/historical.html": [
     [
      "/css/cssom/historical.html",
      {}
     ]
    ],
-   "css/cssom/index-001.html": [
-    [
-     "/css/cssom/index-001.html",
-     {}
-    ]
-   ],
-   "css/cssom/index-002.html": [
-    [
-     "/css/cssom/index-002.html",
-     {}
-    ]
-   ],
    "css/cssom/inline-style-001.html": [
     [
      "/css/cssom/inline-style-001.html",
      {}
     ]
    ],
    "css/cssom/insertRule-charset-no-index.html": [
     [
@@ -319944,16 +319932,22 @@
     ]
    ],
    "css/cssom/shorthand-serialization.html": [
     [
      "/css/cssom/shorthand-serialization.html",
      {}
     ]
    ],
+   "css/cssom/shorthand-values.html": [
+    [
+     "/css/cssom/shorthand-values.html",
+     {}
+    ]
+   ],
    "css/cssom/style-sheet-interfaces-001.html": [
     [
      "/css/cssom/style-sheet-interfaces-001.html",
      {}
     ]
    ],
    "css/cssom/style-sheet-interfaces-002.html": [
     [
@@ -392426,17 +392420,17 @@
    "f8af4287f3b0f6925a2a6c5c75b3788e24de1680",
    "support"
   ],
   "./config.default.json": [
    "54422ca469a8d54fa4b8252803bb0e2c91459858",
    "support"
   ],
   "./lint.whitelist": [
-   "697da251dd64d990c1ec0603fd252ba6ea11ad26",
+   "904d588326ae339a9b425d549e153cf027da904d",
    "support"
   ],
   "./serve.py": [
    "0efa39b1f26f86d73f2fce4f9e46003d62057b41",
    "support"
   ],
   "./server-side.md": [
    "c51b17fbac2a2e3121dc74f7badbd2873ce92f61",
@@ -534437,24 +534431,16 @@
   "css/cssom/getComputedStyle-pseudo.html": [
    "a2033405d6852cdeb4c3b8cf628f7c1d8f7cd1aa",
    "testharness"
   ],
   "css/cssom/historical.html": [
    "02b135e62439d775d7e8de7ca94c831a8d00e077",
    "testharness"
   ],
-  "css/cssom/index-001.html": [
-   "ab9e9f102f5909d9b5587f2c0ea54c0c6b59868d",
-   "testharness"
-  ],
-  "css/cssom/index-002.html": [
-   "fe12bc0005ccfccfafd4f23644b28fbb5f5e33d1",
-   "testharness"
-  ],
   "css/cssom/inline-style-001.html": [
    "4c58b6153eabe796749dcaf181e03d7dce2c9c07",
    "testharness"
   ],
   "css/cssom/insertRule-charset-no-index.html": [
    "cd3a96351a4c8dcd417fb03963f9d4fb0760c746",
    "testharness"
   ],
@@ -534538,17 +534524,21 @@
    "65054797d336c1a4b77c6f66e7b466dc24095517",
    "testharness"
   ],
   "css/cssom/setproperty-null-undefined.html": [
    "8521d827e1e641c3b856854c38eac66a97ddf690",
    "testharness"
   ],
   "css/cssom/shorthand-serialization.html": [
-   "0240668113cb5c280dcb76d8eabfa28d0ed9cb52",
+   "eac49bf894c81813d3763828cbd1c103b388869d",
+   "testharness"
+  ],
+  "css/cssom/shorthand-values.html": [
+   "8bfc0dff5da1859e17df31ceeca710d17a982109",
    "testharness"
   ],
   "css/cssom/style-sheet-interfaces-001.html": [
    "1614c9a0e4973672b18caf46ad56e6cf188285b5",
    "testharness"
   ],
   "css/cssom/style-sheet-interfaces-002.html": [
    "8fc091c20efd7fc71c6c357278977ee6137fd8d4",
deleted file mode 100644
--- a/testing/web-platform/tests/css/cssom/index-001.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!doctype html>
-<head>
-  <title>CSS OM: CSS Values</title>
-  <link rel="author" title="Divya Manian" href="mailto:manian@adobe.com">
-  <link rel="help" href="http://www.w3.org/TR/cssom-1/#css-values">
-  <meta name="flags" content="dom">
-  <meta name="assert" content="The style value should be serialized to margin: 20px;">
-  <script src="/resources/testharness.js"></script>
-  <script src="/resources/testharnessreport.js"></script>
-</head>
-<body>
-    <div id="cssomtestElm"></div>
-    <div id="log"></div>
-    <script>
-        var testElm = document.getElementById('cssomtestElm');
-        // Set the transform
-        document.getElementById('cssomtestElm').style.margin = "20px 20px 20px 20px";
-
-        // Verify that the transform was set as expected
-        test(function() {assert_equals(
-            document.getElementById('cssomtestElm').style.cssText, //Actual
-            "margin: 20px;",  //Expected
-            "Margin should be serialized as 'margin: 20px;'")}, //Description
-            "margin_20px_20px"); //name
-    </script>
- </body>
- </html>
-
deleted file mode 100644
--- a/testing/web-platform/tests/css/cssom/index-002.html
+++ /dev/null
@@ -1,79 +0,0 @@
-<!doctype html>
-<head>
-  <title>CSS OM: CSS Values</title>
-  <link rel="author" title="Divya Manian" href="mailto:manian@adobe.com">
-  <link rel="help" href="http://www.w3.org/TR/cssom-1/#css-values">
-  <meta name="flags" content="dom">
-  <meta name="assert" content="Testing Serialization of Shorthand Values">
-  <script src="/resources/testharness.js"></script>
-  <script src="/resources/testharnessreport.js"></script>
-</head>
-<body>
-    <div id="cssomtestElm"></div>
-    <div id="log"></div>
-    <script>
-    var tests = {
-      'border': [
-      ['border: 1px; border-top: 1px;', 'border: 1px;'],
-      ['border: 1px solid red;', 'border: 1px solid red;'],
-      ['border: 1px red;', 'border: 1px red;'],
-      ['border: red;', 'border: red;'],
-      ['border-top: 1px; border-right: 1px; border-bottom: 1px; border-left: 1px;', 'border: 1px;', ' (#2)'],
-      ['border-top: 1px; border-right: 2px; border-bottom: 3px; border-left: 4px;', 'border-width: 1px 2px 3px 4px;'],
-      ['border: 1px; border-top: 2px;', 'border-width: 2px 1px 1px;'],
-      ['border: 1px; border-top: 1px !important;',
-      'border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-width: 1px !important;'],
-
-      ['border: 1px; border-top-color: red;', 'border-width: 1px; border-top-color: red;'],
-      ['border: solid; border-style: dotted', 'border: dotted;'],
-      ['border-width: 1px;', 'border-width: 1px;']
-      ],
-
-      'overflow': [
-        ['overflow-x: scroll; overflow-y: hidden;', 'overflow: scroll hidden;'],
-        ['overflow-x: scroll; overflow-y: scroll;', 'overflow: scroll;']
-      ],
-      'outline': [
-        ['outline-width: 2px; outline-style: dotted; outline-color: blue;', 'outline: blue dotted 2px;']
-      ],
-      'margin': [
-        ['margin-top: 1px; margin-right: 2px; margin-bottom: 3px; margin-left: 4px;', 'margin: 1px 2px 3px 4px;']
-      ],
-      'list': [
-        ['list-style-type: circle; list-style-position: inside; list-style-image: initial;', 'list-style: circle inside;'],
-        ['list-style-type: lower-alpha;', 'list-style-type: lower-alpha;']
-      ],
-      'font-family': [
-      ['font-family: sans-serif; line-height: 2em; font-size: 3em; font-style: italic; font-weight: bold;',
-          'font-family: sans-serif; line-height: 2em; font-size: 3em; font-style: italic; font-weight: bold;']
-      ],
-      'padding': [
-        ['padding-top: 1px; padding-right: 2px; padding-bottom: 3px; padding-left: 4px;', 'padding: 1px 2px 3px 4px;'],
-      ]
-    }
-
-    var results = {};
-
-    var testElm = document.getElementById('cssomtestElm');
-    for (var test in tests) {
-      if(tests.hasOwnProperty(test)) {
-        results[test] = [];
-        var propertyTests = tests[test];
-
-        for (i = 0; i < propertyTests.length; i++) {
-          document.getElementById('cssomtestElm').setAttribute('style', propertyTests[i][0]);
-          var titleSuffix = propertyTests[i][2] || "";
-          results[test].push([
-            test + ' is expected to be ' + propertyTests[i][1] + titleSuffix,
-            document.getElementById('cssomtestElm').style.cssText,
-            propertyTests[i][1]
-          ]);
-        }
-
-        generate_tests(assert_equals, results[test]);
-      }
-    }
-
-    </script>
- </body>
- </html>
--- a/testing/web-platform/tests/css/cssom/shorthand-serialization.html
+++ b/testing/web-platform/tests/css/cssom/shorthand-serialization.html
@@ -12,17 +12,18 @@
     <div id="foo1" style="background: red;">foo</div>
     <div id="foo2" style="background-color: blue; background: red !important; background-color: green;">foo</div>
     <div id="foo3" style="background-color: blue; background: red; background-color: green !important;">foo</div>
 
     <div id="foo4" style="margin-right: 10px; margin-left: 10px; margin-top: 10px; margin-bottom: 10px;">foo</div>
     <div id="foo5" style="margin-right: 10px; margin-left: 10px; margin-top: 10px; margin-bottom: 10px!important;">foo</div>
     <div id="foo6" style="margin-right: 10px !important; margin-left: 10px !important; margin-top: 10px !important; margin-bottom: 10px!important;">foo</div>
 
-    <div id="foo7" style="background:var(--a);">foo</a>
+    <div id="foo7" style="background:var(--a);">foo</div>
+    <div id="test"></div>
 
     <script>
         test(function() {
             var elem1 = document.getElementById('foo1');
             var elem2 = document.getElementById('foo2');
             var elem3 = document.getElementById('foo3');
 
             assert_false(elem1.style.cssText.endsWith('!important;'));
@@ -45,11 +46,18 @@
         }, "Shorthand serialization with just longhands.");
 
         test(function() {
           var elem7 = document.getElementById('foo7');
 
           assert_equals(elem7.style.background, 'var(--a)');
           assert_equals(elem7.style.backgroundPosition, '');
         }, "Shorthand serialization with variable and variable from other shorthand.");
+
+        test(function() {
+            var testElem = document.getElementById("test");
+            testElem.style.margin = "20px 20px 20px 20px";
+            assert_equals(testElem.style.margin, "20px");
+            assert_equals(testElem.style.cssText, "margin: 20px;")
+        }, "Shorthand serialization after setting");
     </script>
 </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/cssom/shorthand-values.html
@@ -0,0 +1,50 @@
+<!doctype html>
+<head>
+  <title>CSS OM: CSS Values</title>
+  <link rel="author" title="Divya Manian" href="mailto:manian@adobe.com">
+  <link rel="help" href="https://drafts.csswg.org/cssom/#serialize-a-css-declaration-block">
+  <meta name="flags" content="dom">
+  <meta name="assert" content="Testing Serialization of Shorthand Values">
+  <script src="/resources/testharness.js"></script>
+  <script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+    <div id="test"></div>
+    <script>
+      function test_shorthand_serialization(value, expected) {
+        test(function() {
+          const div = document.getElementById("test");
+          div.style.cssText = value;
+          assert_equals(div.style.cssText, expected);
+        }, "The serialization of " + value + " should be canonical.");
+      }
+
+      var tests = {
+        // specified -> expected
+        'border: 1px; border-top: 1px;': 'border: 1px;',
+        'border: 1px solid red;': 'border: 1px solid red;',
+        'border: 1px red;': 'border: 1px red;',
+        'border: red;': 'border: red;',
+        'border-top: 1px; border-right: 1px; border-bottom: 1px; border-left: 1px;': 'border: 1px;',
+        'border-top: 1px; border-right: 2px; border-bottom: 3px; border-left: 4px;': 'border-width: 1px 2px 3px 4px;',
+        'border: 1px; border-top: 2px;': 'border-width: 2px 1px 1px;',
+        'border: 1px; border-top: 1px !important;': 'border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-width: 1px !important;',
+        'border: 1px; border-top-color: red;': 'border-width: 1px; border-top-color: red;',
+        'border: solid; border-style: dotted': 'border: dotted;',
+        'border-width: 1px;': 'border-width: 1px;',
+        'overflow-x: scroll; overflow-y: hidden;': 'overflow-x: scroll; overflow-y: hidden;',
+        'overflow-x: scroll; overflow-y: scroll;': 'overflow: scroll;',
+        'outline-width: 2px; outline-style: dotted; outline-color: blue;': 'outline: blue dotted 2px;',
+        'margin-top: 1px; margin-right: 2px; margin-bottom: 3px; margin-left: 4px;': 'margin: 1px 2px 3px 4px;',
+        'list-style-type: circle; list-style-position: inside; list-style-image: initial;': 'list-style: circle inside;',
+        'list-style-type: lower-alpha;': 'list-style-type: lower-alpha;',
+        'font-family: sans-serif; line-height: 2em; font-size: 3em; font-style: italic; font-weight: bold;': 'font-family: sans-serif; line-height: 2em; font-size: 3em; font-style: italic; font-weight: bold;',
+        'padding-top: 1px; padding-right: 2px; padding-bottom: 3px; padding-left: 4px;': 'padding: 1px 2px 3px 4px;'
+      }
+
+      for (let test in tests) {
+        test_shorthand_serialization(test, tests[test]);
+      }
+    </script>
+ </body>
+ </html>
--- a/testing/web-platform/tests/lint.whitelist
+++ b/testing/web-platform/tests/lint.whitelist
@@ -272,17 +272,16 @@ GENERATE_TESTS: css/css-tables/width-dis
 GENERATE_TESTS: css/css-tables/width-distribution/computing-table-width-0.html
 GENERATE_TESTS: css/css-tables/width-distribution/computing-table-width-1.html
 GENERATE_TESTS: css/css-tables/width-distribution/distribution-algo-1.html
 GENERATE_TESTS: css/css-tables/width-distribution/distribution-algo-2.html
 GENERATE_TESTS: css/css-tables/width-distribution/distribution-algo-min-content-guess.html
 GENERATE_TESTS: css/css-tables/width-distribution/distribution-algo-min-content-percent-guess.html
 GENERATE_TESTS: css/css-tables/width-distribution/distribution-algo-min-content-specified-guess.1.html
 GENERATE_TESTS: css/css-tables/width-distribution/distribution-algo-min-content-specified-guess.html
-GENERATE_TESTS: css/cssom/index-002.html
 GENERATE_TESTS: dom/nodes/case.js
 GENERATE_TESTS: dom/ranges/Range-cloneRange.html
 GENERATE_TESTS: dom/ranges/Range-collapse.html
 GENERATE_TESTS: dom/ranges/Range-mutations.js
 GENERATE_TESTS: dom/ranges/Range-selectNode.html
 GENERATE_TESTS: dom/ranges/Range-set.html
 GENERATE_TESTS: dom/traversal/NodeIterator.html
 GENERATE_TESTS: dom/traversal/TreeWalker.html
@@ -454,17 +453,16 @@ CONSOLE: css/css-regions/interactivity/s
 CONSOLE: css/css-regions/stacking-context/javascript-stacking-context-002.html
 CONSOLE: css/css-shapes/shape-outside/supported-shapes/support/test-utils.js
 CONSOLE: css/css-transitions/transition-delay-002.html
 CONSOLE: css/css-transitions/transition-delay-003.html
 CONSOLE: css/css-values/viewport-units-css2-001.html
 CONSOLE: css/css-writing-modes/orthogonal-parent-shrink-to-fit-001*.html
 CONSOLE: css/css-writing-modes/tools/generators/gulpfile.js
 CONSOLE: css/css-writing-modes/tools/generators/text-orientation-generator.js
-CONSOLE: css/cssom/index-002.html
 
 TRAILING WHITESPACE: css/CSS2/generated-content/before-after-positioned-002.html
 TRAILING WHITESPACE: css/CSS2/generated-content/before-after-positioned-003.html
 TRAILING WHITESPACE: css/CSS2/generated-content/before-after-positioned-004.html
 TRAILING WHITESPACE: css/css-fonts/support/fonts/gsubtest-lookup3.ufo/features.fea
 TRAILING WHITESPACE: css/css-scoping/css-scoping-shadow-assigned-node-with-before-after.html
 TRAILING WHITESPACE: css/css-scoping/css-scoping-shadow-assigned-node-with-rules.html
 TRAILING WHITESPACE: css/css-scoping/css-scoping-shadow-host-rule.html