зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1444011 [wpt PR 9914] - [css-typed-om] Clean up CSSUnparsedValue & CSSVariableRefValue tests., a=testonly
Automatic update from web-platform-tests[css-typed-om] Clean up CSSUnparsedValue & CSSVariableRefValue tests. This patch: - Splits existing tests into different files testing different parts of the IDL (e.g. separate file for cssUnparsedValue.length) - Fix some stylistic issues. Bug: 774887 Change-Id: I8b37679b96d1b1b6e44c4eb596036dcafa88264b Reviewed-on: https://chromium-review.googlesource.com/954525 Reviewed-by: nainar <nainar@chromium.org> Commit-Queue: Darren Shen <shend@chromium.org> Cr-Commit-Position: refs/heads/master@{#542012} wpt-commits: 68c1f9a88c22efb81b62f9e2365bf294996a3adf wpt-pr: 9914 wpt-commits: 68c1f9a88c22efb81b62f9e2365bf294996a3adf wpt-pr: 9914
This commit is contained in:
Родитель
245fb2027e
Коммит
e11df15978
|
@ -316195,6 +316195,24 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-indexed-getter-setter.html": [
|
||||
[
|
||||
"/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-indexed-getter-setter.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-iterable.html": [
|
||||
[
|
||||
"/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-iterable.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-length.html": [
|
||||
[
|
||||
"/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-length.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/css-typed-om/stylevalue-subclasses/cssUnparsedValue.html": [
|
||||
[
|
||||
"/css/css-typed-om/stylevalue-subclasses/cssUnparsedValue.html",
|
||||
|
@ -316207,6 +316225,12 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-variable.html": [
|
||||
[
|
||||
"/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-variable.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue.html": [
|
||||
[
|
||||
"/css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue.html",
|
||||
|
@ -521006,16 +521030,32 @@
|
|||
"700fae462f258404f3d0b8fad290613fc1929e1d",
|
||||
"testharness"
|
||||
],
|
||||
"css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-indexed-getter-setter.html": [
|
||||
"49fe1442d98ad498f3e0e6ce497a6f1ee6e62c31",
|
||||
"testharness"
|
||||
],
|
||||
"css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-iterable.html": [
|
||||
"d91a7d0e8ee2cc40fa1b2747bee392a2cc2deae2",
|
||||
"testharness"
|
||||
],
|
||||
"css/css-typed-om/stylevalue-subclasses/cssUnparsedValue-length.html": [
|
||||
"592897dad11ef8c6aa6ad42b9d779421cdda1a5c",
|
||||
"testharness"
|
||||
],
|
||||
"css/css-typed-om/stylevalue-subclasses/cssUnparsedValue.html": [
|
||||
"46d36ae2dc68f3f3f1cee5d85cb5f496b7c3fa67",
|
||||
"c6dc634947afd7b84a6feda270ebac6ac2fa29c7",
|
||||
"testharness"
|
||||
],
|
||||
"css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-invalid.html": [
|
||||
"ba012ace40e63718694a8cd91ba74039787ff666",
|
||||
"89a261a071b9719cb44a03d9cdbf2e8f869b2c23",
|
||||
"testharness"
|
||||
],
|
||||
"css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue-variable.html": [
|
||||
"b089be0bb5186c545f432b48c38abed458437129",
|
||||
"testharness"
|
||||
],
|
||||
"css/css-typed-om/stylevalue-subclasses/cssVariableReferenceValue.html": [
|
||||
"25b5d1108e4030ad8420a271bfaa85ce68d8bf59",
|
||||
"dbf9e28846ef3246dabc72ef2266871393f6187a",
|
||||
"testharness"
|
||||
],
|
||||
"css/css-typed-om/stylevalue-subclasses/numeric-objects/add-two-types.tentative.html": [
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSSUnparsedValue Indexed Getter and Setter</title>
|
||||
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-cssunparsedvalue-__getter__-index-index">
|
||||
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-cssunparsedvalue-__setter__-index-val-val">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/testhelper.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
test(() => {
|
||||
const result = new CSSUnparsedValue(['foo', 'bar']);
|
||||
assert_equals(result[3], undefined, 'result from out of range index');
|
||||
assert_equals(result[-1], undefined, 'result from negative index');
|
||||
}, 'Getting invalid index in CSSUnparsedValue returns undefined');
|
||||
|
||||
test(() => {
|
||||
let result = new CSSUnparsedValue([new CSSVariableReferenceValue('--foo')]);
|
||||
result[0] = 'A';
|
||||
assert_equals(result[0], 'A', 'fragment reflects new value');
|
||||
}, 'Can update fragment in CSSUnparsedValue to a String');
|
||||
|
||||
test(() => {
|
||||
let result = new CSSUnparsedValue(['foo']);
|
||||
result[0] = new CSSVariableReferenceValue('--A');
|
||||
assert_style_value_equals(result[0], new CSSVariableReferenceValue('--A'),
|
||||
'fragment reflects new value');
|
||||
}, 'Can update fragment in CSSUnparsedValue to a CSSVariableReference');
|
||||
|
||||
test(() => {
|
||||
let result = new CSSUnparsedValue([]);
|
||||
result[0] = 'foo';
|
||||
assert_equals(result[0], 'foo', 'new fragment is appended');
|
||||
}, 'Setting one past the last fragment in a CSSUnparsedValue to a String ' +
|
||||
'appends the new fragment');
|
||||
|
||||
test(() => {
|
||||
let result = new CSSUnparsedValue([' ']);
|
||||
result[1] = new CSSVariableReferenceValue('--A');
|
||||
assert_style_value_equals(result[1], new CSSVariableReferenceValue('--A'),
|
||||
'new fragment is appended');
|
||||
}, 'Setting one past the last fragment in a CSSUnparsedValue to a ' +
|
||||
'CSSVariableReferenceValue appends the new fragment');
|
||||
|
||||
test(() => {
|
||||
let result = new CSSUnparsedValue(['foo', 'bar']);
|
||||
assert_throws(new RangeError(), () => result[3] = 'foo');
|
||||
assert_equals(result[3], undefined, 'fragment does not change');
|
||||
}, 'Setting out of range index in CSSUnparsedValue throws RangeError');
|
||||
|
||||
</script>
|
|
@ -0,0 +1,24 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSSUnparsedValue Iterable Declaration</title>
|
||||
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#cssunparsedvalue">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/testhelper.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
test(() => {
|
||||
const result = new CSSUnparsedValue([]);
|
||||
assert_array_equals([...result], [], 'result of iterating');
|
||||
}, 'Iterating over an empty CSSUnparsedValue produces nothing');
|
||||
|
||||
test(() => {
|
||||
const args = [' ', new CSSVariableReferenceValue('--A')];
|
||||
const result = new CSSUnparsedValue(args);
|
||||
assert_style_value_array_equals([...result], args, 'result of iterating');
|
||||
}, 'Iterating over a CSSUnparsedValue produces all fragments');
|
||||
|
||||
</script>
|
|
@ -0,0 +1,47 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSSUnparsedValue.length</title>
|
||||
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-cssunparsedvalue-length">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
test(() => {
|
||||
const result = new CSSUnparsedValue([]);
|
||||
assert_equals(result.length, 0, 'length');
|
||||
}, 'Length of CSSUnparsedValue with no fragments is zero');
|
||||
|
||||
test(() => {
|
||||
const result = new CSSUnparsedValue([
|
||||
' ', new CSSVariableReferenceValue('--A')
|
||||
]);
|
||||
assert_equals(result.length, 2, 'length');
|
||||
}, 'Length of CSSUnparsedValue with multiple fragments is the number of ' +
|
||||
'fragments');
|
||||
|
||||
test(() => {
|
||||
let result = new CSSUnparsedValue([' ']);
|
||||
assert_equals(result.length, 1, 'initial length');
|
||||
|
||||
result[1] = new CSSVariableReferenceValue('--A');
|
||||
assert_equals(result.length, 2, 'length after appending once');
|
||||
|
||||
result[2] = 'lemon';
|
||||
assert_equals(result.length, 3, 'length after appending twice');
|
||||
}, 'Length of CSSUnparsedValue updates when fragments are appended');
|
||||
|
||||
test(() => {
|
||||
let result = new CSSUnparsedValue([' ']);
|
||||
assert_equals(result.length, 1, 'initial length');
|
||||
|
||||
result[0] = new CSSVariableReferenceValue('--A');
|
||||
assert_equals(result.length, 1, 'length after modification');
|
||||
|
||||
result[0] = 'lemon';
|
||||
assert_equals(result.length, 1, 'length after modification');
|
||||
}, 'Length of CSSUnparsedValue does not change when fragments are modified');
|
||||
|
||||
</script>
|
|
@ -1,32 +1,31 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSSUnparsedValue</title>
|
||||
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#unparsedvalue-objects">
|
||||
<meta name="assert" content="Test CSSUnparsedValue constructor and members">
|
||||
<title>CSSUnparsedValue Constructor</title>
|
||||
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-cssunparsedvalue-cssunparsedvalue">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/testhelper.js"></script>
|
||||
<body>
|
||||
<div id="log">
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
const gTestArguments = [
|
||||
{
|
||||
description: 'no arguments',
|
||||
args: [],
|
||||
fragments: [],
|
||||
},
|
||||
{
|
||||
description: 'an empty string',
|
||||
args: [''],
|
||||
description: 'a single empty string',
|
||||
fragments: [''],
|
||||
},
|
||||
{
|
||||
description: 'a CSSVariableReferenceValue',
|
||||
args: [new CSSVariableReferenceValue('--foo')],
|
||||
description: 'a single CSSVariableReferenceValue',
|
||||
fragments: [new CSSVariableReferenceValue('--foo')],
|
||||
},
|
||||
{
|
||||
description: 'mix of strings and CSSVariableReferenceValues',
|
||||
args: [
|
||||
description: 'a mix of strings and CSSVariableReferenceValues',
|
||||
fragments: [
|
||||
'foo',
|
||||
'bar',
|
||||
new CSSVariableReferenceValue('--A'),
|
||||
|
@ -36,56 +35,13 @@ const gTestArguments = [
|
|||
},
|
||||
];
|
||||
|
||||
for (const {args, description} of gTestArguments) {
|
||||
for (const args of gTestArguments) {
|
||||
test(() => {
|
||||
const result = new CSSUnparsedValue(args);
|
||||
|
||||
assert_not_equals(result, null,
|
||||
'A CSSUnparsedValue should be created');
|
||||
assert_array_equals(result, args,
|
||||
'Content of CSSUnparsedValue should be same as the arguments ' +
|
||||
'passed in the constructor');
|
||||
}, 'CSSUnparsedValue can be constructed from ' + description);
|
||||
const result = new CSSUnparsedValue(args.fragments);
|
||||
assert_not_equals(result, null, 'a CSSUnparsedValue is created');
|
||||
assert_style_value_array_equals(result, args.fragments,
|
||||
'fragments are same as given by constructor');
|
||||
}, `CSSUnparsedValue can be constructed from ${args.description}`);
|
||||
}
|
||||
|
||||
test(() => {
|
||||
let result = new CSSUnparsedValue([new CSSVariableReferenceValue('--foo')]);
|
||||
|
||||
result[0] = 'A';
|
||||
assert_equals(result[0], 'A', 'Item should be updated to new value');
|
||||
}, 'Can update item in CSSUnparsedValue to a string');
|
||||
|
||||
test(() => {
|
||||
let result = new CSSUnparsedValue(['foo']);
|
||||
|
||||
result[0] = new CSSVariableReferenceValue('--A');
|
||||
assert_style_value_equals(result[0], new CSSVariableReferenceValue('--A'),
|
||||
'Item should be updated to new value');
|
||||
}, 'Can update item in CSSUnparsedValue to a variable reference');
|
||||
|
||||
test(() => {
|
||||
let result = new CSSUnparsedValue([]);
|
||||
|
||||
result[0] = new CSSVariableReferenceValue('--A');
|
||||
assert_equals(result.length, 1,
|
||||
'Length of CSSUnparsedValue should have increased');
|
||||
assert_style_value_equals(result[0], new CSSVariableReferenceValue('--A'),
|
||||
'New item should be appended');
|
||||
|
||||
result[1] = 'foo';
|
||||
assert_equals(result.length, 2,
|
||||
'Length of CSSUnparsedValue should have increased');
|
||||
assert_equals(result[1], 'foo', 'New item should be appended');
|
||||
}, 'Can append items to CSSUnparsedValue');
|
||||
|
||||
test(() => {
|
||||
const result = new CSSUnparsedValue(['foo', 'bar']);
|
||||
assert_equals(result[3], undefined);
|
||||
}, 'Getting invalid index in CSSUnparsedValue returns undefined');
|
||||
|
||||
test(() => {
|
||||
let result = new CSSUnparsedValue(['foo', 'bar']);
|
||||
assert_throws(new RangeError(), () => result[3] = 'foo');
|
||||
}, 'Setting invalid index in CSSUnparsedValue throws RangeError');
|
||||
|
||||
</script>
|
||||
|
|
|
@ -20,22 +20,4 @@ test(() => {
|
|||
}, 'Constructing a CSSVariableReferenceValue with an invalid variable name ' +
|
||||
'throws SyntaxError');
|
||||
|
||||
test(() => {
|
||||
let result = new CSSVariableReferenceValue('--foo');
|
||||
assert_throws(new TypeError(), () => result.variable = '');
|
||||
|
||||
assert_equals(result.variable, '--foo',
|
||||
'Variable member should not have changed');
|
||||
}, 'Updating CSSVariableReferenceValue.variable to an empty variable name ' +
|
||||
'throws TypeError');
|
||||
|
||||
test(() => {
|
||||
let result = new CSSVariableReferenceValue('--foo');
|
||||
assert_throws(new TypeError(), () => result.variable = 'bar');
|
||||
|
||||
assert_equals(result.variable, '--foo',
|
||||
'Variable member should not have changed');
|
||||
}, 'Updating CSSVariableReferenceValue.variable to an invalid variable name ' +
|
||||
'throws TypeError');
|
||||
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSSVariableReferenceValue.variable</title>
|
||||
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-cssvariablereferencevalue-variable">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
test(() => {
|
||||
let result = new CSSVariableReferenceValue('--foo');
|
||||
result.variable = '--bar';
|
||||
assert_equals(result.variable, '--bar', 'variable reflects new value');
|
||||
}, 'CSSVariableReferenceValue.variable can updated to a valid custom ' +
|
||||
'property name');
|
||||
|
||||
test(() => {
|
||||
let result = new CSSVariableReferenceValue('--foo');
|
||||
assert_throws(new TypeError(), () => result.variable = '');
|
||||
assert_equals(result.variable, '--foo', 'variable does not change');
|
||||
}, 'Updating CSSVariableReferenceValue.variable to the empty string ' +
|
||||
'throws TypeError');
|
||||
|
||||
test(() => {
|
||||
let result = new CSSVariableReferenceValue('--foo');
|
||||
assert_throws(new TypeError(), () => result.variable = 'bar');
|
||||
assert_equals(result.variable, '--foo', 'variable does not change');
|
||||
}, 'Updating CSSVariableReferenceValue.variable to an invalid custom ' +
|
||||
'property name throws TypeError');
|
||||
|
||||
</script>
|
|
@ -1,55 +1,40 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSSVariableReferenceValue tests</title>
|
||||
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#cssvariablereferencevalue">
|
||||
<meta name="assert" content="Test CSSVariableReferenceValue constructor and attributes" />
|
||||
<title>CSSVariableReferenceValue Constructor</title>
|
||||
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-cssvariablereferencevalue-cssvariablereferencevalue">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../resources/testhelper.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
test(() => {
|
||||
const result = new CSSVariableReferenceValue('--foo');
|
||||
|
||||
assert_not_equals(result, null,
|
||||
'A CSSVariableReferenceValue should be created');
|
||||
assert_not_equals(result, null, 'a CSSVariableReferenceValue is created');
|
||||
assert_equals(result.variable, '--foo',
|
||||
'Variable member should be same as passed in the constructor');
|
||||
assert_equals(result.fallback, null,
|
||||
'Fallback member should be null');
|
||||
'variable is same as passed by constructor');
|
||||
assert_equals(result.fallback, null, 'fallback');
|
||||
}, 'CSSVariableReferenceValue can be constructed with no fallback');
|
||||
|
||||
test(() => {
|
||||
const result = new CSSVariableReferenceValue('--foo', null);
|
||||
|
||||
assert_not_equals(result, null,
|
||||
'A CSSVariableReferenceValue should be created');
|
||||
assert_not_equals(result, null, 'a CSSVariableReferenceValue is created');
|
||||
assert_equals(result.variable, '--foo',
|
||||
'Variable member should be same as passed in the constructor');
|
||||
assert_equals(result.fallback, null, 'Fallback member should be null');
|
||||
'variable is same as passed by constructor');
|
||||
assert_equals(result.fallback, null, 'fallback');
|
||||
}, 'CSSVariableReferenceValue can be constructed with null fallback');
|
||||
|
||||
test(() => {
|
||||
const result = new CSSVariableReferenceValue('--foo',
|
||||
new CSSUnparsedValue(['lemon']));
|
||||
|
||||
assert_not_equals(result, null,
|
||||
'A CSSVariableReferenceValue should be created');
|
||||
assert_not_equals(result, null, 'a CSSVariableReferenceValue is created');
|
||||
assert_equals(result.variable, '--foo',
|
||||
'Variable member should be same as passed in the constructor');
|
||||
assert_not_equals(result.fallback, null,
|
||||
'Fallback member should not be null');
|
||||
'variable is same as passed by constructor');
|
||||
assert_not_equals(result.fallback, null, 'fallback');
|
||||
assert_style_value_equals(result.fallback, new CSSUnparsedValue(['lemon']),
|
||||
'Fallback member should be as same as passed in the constructor');
|
||||
'fallback is same as passed by constructor');
|
||||
}, 'CSSVariableReferenceValue can be constructed with valid fallback');
|
||||
|
||||
test(() => {
|
||||
let result = new CSSVariableReferenceValue('--foo');
|
||||
result.variable = '--bar';
|
||||
|
||||
assert_equals(result.variable, '--bar',
|
||||
'Variable member should be updated to new value');
|
||||
}, 'CSSVariableReferenceValue.variable can updated to a valid variable name');
|
||||
|
||||
</script>
|
||||
|
|
Загрузка…
Ссылка в новой задаче