fune/testing/web-platform/tests/css/css-grid/support/grid-child-utils.js
Daniel Holbert ac4480af11 Bug 1685231: Fix the typo "ot" in various code-comments (to "to", "of", or "not"). r=mccr8
DONTBUILD because this is a comment-only change and hence doesn't affect
behavior at all.

I ran across this typo in nsPageFrame.cpp, and figured I might as well grep for
it and fix it more comprehensively. And while I'm at it, I also fixed some
neighboring instances of a duplicated word around a linebreak, in
nsXMLContentSerializer.h.

Differential Revision: https://phabricator.services.mozilla.com/D100852
2021-01-06 04:54:51 +00:00

45 lines
1.6 KiB
JavaScript

// 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;
}