summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-grid/support
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/css/css-grid/support
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-grid/support')
-rw-r--r--testing/web-platform/tests/css/css-grid/support/colors-8x16.pngbin0 -> 92 bytes
-rw-r--r--testing/web-platform/tests/css/css-grid/support/grid-child-utils.js45
2 files changed, 45 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-grid/support/colors-8x16.png b/testing/web-platform/tests/css/css-grid/support/colors-8x16.png
new file mode 100644
index 0000000000..596fdb389d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-grid/support/colors-8x16.png
Binary files differ
diff --git a/testing/web-platform/tests/css/css-grid/support/grid-child-utils.js b/testing/web-platform/tests/css/css-grid/support/grid-child-utils.js
new file mode 100644
index 0000000000..5e0c5caad1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-grid/support/grid-child-utils.js
@@ -0,0 +1,45 @@
+// Any copyright is dedicated to the Public Domain.
+// https://creativecommons.org/publicdomain/zero/1.0/
+
+const gridChildHelperRow = "row";
+const gridChildHelperCol = "col";
+
+// Helper for building testcases for grid-template-* with a child div in
+// multiple positions. Prop is expected to be one of gridChildHelperRow or
+// gridChildHelperCol, to select testing grid rows or grid columns,
+// respectively.
+// The child div is found by the id of 'child'.
+function GridChildHelper(prop, style){
+ this.child = document.getElementById("child");
+ this.style = style;
+ this.prop = prop;
+}
+
+// Runs a test for computed values on the property the helper object was
+// constructed with. The childStyle is used for choosing the grid row/column
+// of the child div.
+// expected is passed as-is to the computed value test.
+// The child style is appended to the test name in such a way that different
+// tests for the same parent style but different child style values will have
+// different test names.
+GridChildHelper.prototype.runTest = function(childStyle, expected) {
+ 'use strict';
+ const childProps = {
+ [gridChildHelperCol]:"gridColumn",
+ [gridChildHelperRow]:"gridRow"
+ };
+ const childProp = childProps[this.prop];
+
+ const parentProps = {
+ [gridChildHelperCol]:"grid-template-columns",
+ [gridChildHelperRow]:"grid-template-rows"
+ };
+ const parentProp = parentProps[this.prop];
+
+ const oldChildStyle = this.child[childProp];
+ this.child.style[childProp] = childStyle;
+
+ test_computed_value(parentProp, this.style, expected, childProp + " = " + childStyle);
+
+ this.child[childProp] = oldChildStyle;
+}