Bug 1339656: [css-align] Upstream our shorthand serialization tests. r=mats
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 05 Apr 2018 18:38:27 +0200
changeset 412109 4ac4932953254018e6fbd110ab8ab5ca76885069
parent 412108 bbd2f0c18f64d9e0c923040c24291dfe4ce68957
child 412110 e90ac14a383f2a3ae97358d68dfcfc47f68e60c2
push id33784
push usernerli@mozilla.com
push dateFri, 06 Apr 2018 21:54:36 +0000
treeherdermozilla-central@0e0ec6c01e25 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmats
bugs1339656
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 1339656: [css-align] Upstream our shorthand serialization tests. r=mats MozReview-Commit-ID: 2EYnkBavecs
layout/style/test/mochitest.ini
layout/style/test/test_align_shorthand_serialization.html
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/css/css-align/default-alignment/shorthand-serialization-001.html
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -40,17 +40,16 @@ support-files =
   xbl_bindings.xml
 
 [test_acid3_test46.html]
 [test_addSheet.html]
 support-files = additional_sheets_helper.html
 [test_additional_sheets.html]
 support-files = additional_sheets_helper.html
 [test_align_justify_computed_values.html]
-[test_align_shorthand_serialization.html]
 [test_all_shorthand.html]
 [test_animations.html]
 skip-if = (toolkit == 'android')
 [test_animations_async_tests.html]
 support-files = Ahem.ttf file_animations_async_tests.html
 [test_animations_dynamic_changes.html]
 [test_animations_effect_timing_duration.html]
 skip-if = webrender # bug 1424752
deleted file mode 100644
--- a/layout/style/test/test_align_shorthand_serialization.html
+++ /dev/null
@@ -1,131 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta charset=utf-8>
-  <title>Test serialization of CSS Align shorthand properties</title>
-  <link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
-  <script src="/resources/testharness.js"></script>
-  <script src="/resources/testharnessreport.js"></script>
-  <link rel='stylesheet' href='/resources/testharness.css'>
-</head>
-<body>
-
-<script>
-
-var initial_values = {
-    alignContent: "normal",
-    alignItems: "normal",
-    alignSelf: "auto",
-    justifyContent: "normal",
-    justifyItems: "auto",
-    justifySelf: "auto",
-};
-
-var place_content_test_cases = [
-    {
-        alignContent: "center",
-        shorthand: "center normal",
-    },
-    {
-        alignContent: "baseline safe right",
-        shorthand: "",
-    },
-    {
-        justifyContent: "safe start",
-        shorthand: "normal safe start",
-    },
-    {
-        justifyContent: "unsafe start",
-        shorthand: ["normal start", "normal unsafe start"],
-    },
-    {
-        justifyContent: "space-evenly start",
-        shorthand: "",
-    },
-    {
-        alignContent: "start",
-        justifyContent: "end",
-        shorthand: "start end",
-    },
-];
-
-var place_items_test_cases = [
-    {
-        alignItems: "center",
-        shorthand: "center auto",
-    },
-    {
-        alignItems: "baseline",
-        shorthand: "baseline auto",
-    },
-    {
-        justifyItems: "safe start",
-        shorthand: "normal safe start",
-    },
-    {
-        justifyItems: "unsafe start",
-        shorthand: ["normal start", "normal unsafe start"],
-    },
-    {
-        justifyItems: "stretch",
-        shorthand: "normal stretch",
-    },
-    {
-        justifyItems: "left legacy",
-        shorthand: "normal legacy left",
-    },
-    {
-        alignItems: "stretch",
-        justifyItems: "end",
-        shorthand: "stretch end",
-    },
-];
-
-var place_self_test_cases = [
-    {
-        alignSelf: "self-end safe",
-        shorthand: "",
-    },
-    {
-        justifySelf: "unsafe start",
-        shorthand: ["auto start", "auto unsafe start"],
-    },
-    {
-        justifySelf: "last baseline start",
-        shorthand: "",
-    },
-    {
-        alignSelf: "baseline",
-        justifySelf: "last baseline",
-        shorthand: "baseline last baseline",
-    },
-];
-
-function run_tests(test_cases, shorthand, subproperties) {
-    test_cases.forEach(function(test_case) {
-        test(function() {
-            var element = document.createElement('div');
-            document.body.appendChild(element);
-            subproperties.forEach(function(longhand) {
-                element.style[longhand] = test_case[longhand] ||
-                                          initial_values[longhand];
-            });
-            if (Array.isArray(test_case.shorthand)) {
-              assert_in_array(element.style[shorthand], test_case.shorthand);
-            } else {
-              assert_equals(element.style[shorthand], test_case.shorthand);
-            }
-        }, "test shorthand serialization " + JSON.stringify(test_case));
-    });
-}
-
-run_tests(place_content_test_cases, "placeContent", [
-    "alignContent", "justifyContent"]);
-run_tests(place_items_test_cases, "placeItems", [
-    "alignItems", "justifyItems"]);
-run_tests(place_self_test_cases, "placeSelf", [
-    "alignSelf", "justifySelf"]);
-
-</script>
-</body>
-</html>
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -311203,16 +311203,22 @@
     ]
    ],
    "css/css-align/default-alignment/place-items-shorthand-006.html": [
     [
      "/css/css-align/default-alignment/place-items-shorthand-006.html",
      {}
     ]
    ],
+   "css/css-align/default-alignment/shorthand-serialization-001.html": [
+    [
+     "/css/css-align/default-alignment/shorthand-serialization-001.html",
+     {}
+    ]
+   ],
    "css/css-align/gaps/column-gap-animation-001.html": [
     [
      "/css/css-align/gaps/column-gap-animation-001.html",
      {}
     ]
    ],
    "css/css-align/gaps/column-gap-animation-002.html": [
     [
@@ -481498,16 +481504,20 @@
   "css/css-align/default-alignment/place-items-shorthand-005.html": [
    "638f5cbcc320477d495b9b0a752e6aaa048fee5e",
    "testharness"
   ],
   "css/css-align/default-alignment/place-items-shorthand-006.html": [
    "b7106d0ee863673c0d9a6160d035706edb3c67a8",
    "testharness"
   ],
+  "css/css-align/default-alignment/shorthand-serialization-001.html": [
+   "0126d0a56ec9af324a886d286563cf8f39fc1b78",
+   "testharness"
+  ],
   "css/css-align/distribution-values/space-evenly-001.html": [
    "6fd28a5bf615ce822ed935de90ce5c1a41d39104",
    "reftest"
   ],
   "css/css-align/gaps/column-gap-animation-001.html": [
    "00023e39b6fafbfb31cabb30ed4ddf77a71b248f",
    "testharness"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-align/default-alignment/shorthand-serialization-001.html
@@ -0,0 +1,132 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta charset=utf-8>
+  <title>Test serialization of CSS Align shorthand properties</title>
+  <link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com">
+  <link rel="help" href="https://drafts.csswg.org/css-align/">
+  <script src="/resources/testharness.js"></script>
+  <script src="/resources/testharnessreport.js"></script>
+  <link rel='stylesheet' href='/resources/testharness.css'>
+</head>
+<body>
+
+<script>
+
+var initial_values = {
+    alignContent: "normal",
+    alignItems: "normal",
+    alignSelf: "auto",
+    justifyContent: "normal",
+    justifyItems: "auto",
+    justifySelf: "auto",
+};
+
+var place_content_test_cases = [
+    {
+        alignContent: "center",
+        shorthand: "center normal",
+    },
+    {
+        alignContent: "baseline safe right",
+        shorthand: "",
+    },
+    {
+        justifyContent: "safe start",
+        shorthand: "normal safe start",
+    },
+    {
+        justifyContent: "unsafe start",
+        shorthand: ["normal start", "normal unsafe start"],
+    },
+    {
+        justifyContent: "space-evenly start",
+        shorthand: "",
+    },
+    {
+        alignContent: "start",
+        justifyContent: "end",
+        shorthand: "start end",
+    },
+];
+
+var place_items_test_cases = [
+    {
+        alignItems: "center",
+        shorthand: "center auto",
+    },
+    {
+        alignItems: "baseline",
+        shorthand: "baseline auto",
+    },
+    {
+        justifyItems: "safe start",
+        shorthand: "normal safe start",
+    },
+    {
+        justifyItems: "unsafe start",
+        shorthand: ["normal start", "normal unsafe start"],
+    },
+    {
+        justifyItems: "stretch",
+        shorthand: "normal stretch",
+    },
+    {
+        justifyItems: "left legacy",
+        shorthand: "normal legacy left",
+    },
+    {
+        alignItems: "stretch",
+        justifyItems: "end",
+        shorthand: "stretch end",
+    },
+];
+
+var place_self_test_cases = [
+    {
+        alignSelf: "self-end safe",
+        shorthand: "",
+    },
+    {
+        justifySelf: "unsafe start",
+        shorthand: ["auto start", "auto unsafe start"],
+    },
+    {
+        justifySelf: "last baseline start",
+        shorthand: "",
+    },
+    {
+        alignSelf: "baseline",
+        justifySelf: "last baseline",
+        shorthand: "baseline last baseline",
+    },
+];
+
+function run_tests(test_cases, shorthand, subproperties) {
+    test_cases.forEach(function(test_case) {
+        test(function() {
+            var element = document.createElement('div');
+            document.body.appendChild(element);
+            subproperties.forEach(function(longhand) {
+                element.style[longhand] = test_case[longhand] ||
+                                          initial_values[longhand];
+            });
+            if (Array.isArray(test_case.shorthand)) {
+              assert_in_array(element.style[shorthand], test_case.shorthand);
+            } else {
+              assert_equals(element.style[shorthand], test_case.shorthand);
+            }
+        }, "test shorthand serialization " + JSON.stringify(test_case));
+    });
+}
+
+run_tests(place_content_test_cases, "placeContent", [
+    "alignContent", "justifyContent"]);
+run_tests(place_items_test_cases, "placeItems", [
+    "alignItems", "justifyItems"]);
+run_tests(place_self_test_cases, "placeSelf", [
+    "alignSelf", "justifySelf"]);
+
+</script>
+</body>
+</html>