Bug 1471008 [wpt PR 11661] - Add tests for some logical border shorthand properties, a=testonly

Automatic update from web-platform-testsMerge pull request #11661 from Loirooriol/css-logical-border-shorthands

Add tests for some logical border shorthand properties
--

wpt-commits: c08dc4d39d034249e2061258889c0f20cd820503
wpt-pr: 11661
This commit is contained in:
Manuel Rego Casasnovas 2018-07-06 22:42:05 +00:00 коммит произвёл James Graham
Родитель 4ebef3c0da
Коммит afab041ec4
3 изменённых файлов: 36 добавлений и 8 удалений

Просмотреть файл

@ -319864,6 +319864,12 @@
{}
]
],
"css/css-logical/logical-box-border-shorthands.html": [
[
"/css/css-logical/logical-box-border-shorthands.html",
{}
]
],
"css/css-logical/logical-box-border-style.html": [
[
"/css/css-logical/logical-box-border-style.html",
@ -522585,6 +522591,10 @@
"9e3a2a3796bf840f0e3ff78e54ad0382adff5b36",
"testharness"
],
"css/css-logical/logical-box-border-shorthands.html": [
"c02cf997b0f7046a0332079a57deaea78f132057",
"testharness"
],
"css/css-logical/logical-box-border-style.html": [
"b4e50119630c3b3b82f8ffbd03d7e221d77735f7",
"testharness"
@ -522630,7 +522640,7 @@
"testharness"
],
"css/css-logical/resources/test-box-properties.js": [
"132f6024928641f0cd1f0580e69126a8ab02eba8",
"ce6a045e4afb9992c0ac13312f8b6516162d19a7",
"support"
],
"css/css-masking/META.yml": [

Просмотреть файл

@ -0,0 +1,15 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>CSS Logical Properties: Flow-Relative Border Shorthands</title>
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com" />
<link rel="help" href="https://drafts.csswg.org/css-logical/#border-shorthands">
<meta name="assert" content="This test checks the interaction of the flow-relative border-* shorthand properties with the physical ones in different writing modes." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script src="./resources/test-box-properties.js"></script>
<script>
runTests(createBoxPropertyGroup("border-*", {type: ["length", "border-style", "color"]}));
</script>

Просмотреть файл

@ -90,14 +90,14 @@
* }, logical: {
* inlineStart: "margin-inline-start", inlineEnd: "margin-inline-end",
* blockStart: "margin-block-start", blockEnd: "margin-block-end",
* }, type: "length", prerequisites: "...", property: "'margin-*'" }
* }, type: ["length"], prerequisites: "...", property: "'margin-*'" }
*
* @param {string} property
* A string representing the property names, like "margin-*".
* @param {Object} descriptor
* @param {string} descriptor.type
* @param {string|string[]} descriptor.type
* Describes the kind of values accepted by the property, like "length".
* Must be a key from the `testValues` object.
* Must be a key or a collection of keys from the `testValues` object.
* @param {Object={}} descriptor.prerequisites
* Represents property declarations that are needed by `property` to work.
* For example, border-width properties require a border style.
@ -115,7 +115,8 @@
physical[physicalSide] = isInset ? physicalSide : property.replace("*", physicalSide);
prerequisites += makeDeclaration(descriptor.prerequisites, physicalSide);
}
return {name, logical, physical, type: descriptor.type, prerequisites, property};
const type = [].concat(descriptor.type);
return {name, logical, physical, type, prerequisites, property};
};
/**
@ -134,7 +135,7 @@
horizontal: `${prefix}width`,
vertical: `${prefix}height`,
},
type: "length",
type: ["length"],
prerequisites: makeDeclaration({display: "block"}),
property: (prefix ? prefix.slice(0, -1) + " " : "") + "sizing",
};
@ -147,7 +148,9 @@
* An object returned by createBoxPropertyGroup or createSizingPropertyGroup.
*/
exports.runTests = function(group) {
const values = testValues[group.type];
const values = testValues[group.type[0]].map(function(_, i) {
return group.type.map(type => testValues[type][i]).join(" ");
});
const logicals = Object.values(group.logical);
const physicals = Object.values(group.physical);
@ -158,8 +161,8 @@
expected.push([logicalProp, values[i]]);
}
testCSSValues("logical properties in inline style", testElement.style, expected);
testElement.style.cssText = "";
}, `Test that logical ${group.property} properties are supported.`);
testElement.style.cssText = "";
for (const writingMode of writingModes) {
for (const style of writingMode.styles) {