Update web-platform-tests to revision 064bb25e5e9ab5e08ec39c4fbd1fe6653520595d

This commit is contained in:
WPT Sync Bot 2020-11-14 08:21:25 +00:00
parent f8ebe03dc2
commit d2586450c0
86 changed files with 1092 additions and 282 deletions

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-counter-styles-3/#counter-style-symbols">
<link rel="author" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/counter-style-testcommon.js"></script>
<script>
function test_valid_additive_symbols(value, expected) {
test_valid_counter_style_descriptor('additive-symbols', value, expected);
}
function test_invalid_additive_symbols(value) {
test_invalid_counter_style_descriptor('additive-symbols', value);
}
// [ <integer [0,]> && <symbol> ]#
test_valid_additive_symbols('1 "X"');
test_valid_additive_symbols('"X" 1', '1 "X"');
test_valid_additive_symbols('5 "V", 1 "I"');
test_invalid_additive_symbols('');
// Weights must be non-negative
test_invalid_additive_symbols('-1 "X"');
// Weights must be in strictly decreasing order
test_invalid_additive_symbols('1 "I", 5 "V"');
test_invalid_additive_symbols('1 "X", 1 "Y"');
</script>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-counter-styles-3/#counter-style-fallback">
<link rel="author" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/counter-style-testcommon.js"></script>
<script>
function test_valid_fallback(value) {
test_valid_counter_style_descriptor('fallback', value);
}
function test_invalid_fallback(value) {
test_invalid_counter_style_descriptor('fallback', value);
}
// <counter-style-name>
test_valid_fallback('bar');
// Counter style names are custom identifiers, not strings
test_invalid_fallback('"bar"');
// The following are not valid counter style names
test_invalid_fallback('none');
test_invalid_fallback('initial');
test_invalid_fallback('inherit');
test_invalid_fallback('unset');
</script>

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-counter-styles-3/#the-counter-style-rule">
<link rel="author" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/counter-style-testcommon.js"></script>
<script>
test_valid_name('foo');
test_invalid_name('');
test_invalid_name('none');
test_invalid_name('initial');
test_invalid_name('inherit');
test_invalid_name('unset');
test_invalid_name('decimal');
test_invalid_name('disc');
</script>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-counter-styles-3/#counter-style-negative">
<link rel="author" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/counter-style-testcommon.js"></script>
<script>
function test_valid_negative(value) {
test_valid_counter_style_descriptor('negative', value);
}
function test_invalid_negative(value) {
test_invalid_counter_style_descriptor('negative', value);
}
// <symbol> <symbol>?
test_valid_negative('"X"');
test_valid_negative('"X" "X"');
test_invalid_negative('"X" "X" "X"');
</script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-counter-styles-3/#counter-style-pad">
<link rel="author" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/counter-style-testcommon.js"></script>
<script>
function test_valid_pad(value, expected) {
test_valid_counter_style_descriptor('pad', value, expected);
}
function test_invalid_pad(value) {
test_invalid_counter_style_descriptor('pad', value);
}
// <integer [0,]> && <symbol>
test_invalid_pad('10');
test_invalid_pad('"X"');
test_valid_pad('10 "X"');
test_valid_pad('"X" 10', '10 "X"');
test_invalid_pad('-1 "X"');
test_invalid_pad('"X" -1');
test_invalid_pad('10 "X" "Y"');
test_invalid_pad('10 10 "X"');
</script>

View file

@ -0,0 +1,43 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-counter-styles-3/#counter-style-prefix">
<link rel="help" href="https://drafts.csswg.org/css-counter-styles-3/#counter-style-suffix">
<link rel="author" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/counter-style-testcommon.js"></script>
<script>
function test_valid_prefix_suffix(value, expected) {
test_valid_counter_style_descriptor('prefix', value, expected);
test_valid_counter_style_descriptor('suffix', value, expected);
}
function test_invalid_prefix_suffix(value) {
test_invalid_counter_style_descriptor('prefix', value);
test_invalid_counter_style_descriptor('suffix', value);
}
// <symbol>
// <symbol> = <string> | <image> | <custom-ident>
// string values
test_valid_prefix_suffix('"string"');
test_valid_prefix_suffix('"initial"');
test_valid_prefix_suffix('"inherit"');
test_valid_prefix_suffix('"unset"');
// custom-ident values
test_valid_prefix_suffix('custom-ident')
test_invalid_prefix_suffix('initial');
test_invalid_prefix_suffix('inherit');
test_invalid_prefix_suffix('unset');
// image values
test_valid_prefix_suffix('url("https://example.com/foo.png")');
test_valid_prefix_suffix('url(https://example.com/foo.png)', 'url("https://example.com/foo.png")');
test_valid_prefix_suffix('linear-gradient(yellow, blue)');
// Must be exactly one symbol
test_invalid_prefix_suffix('');
test_invalid_prefix_suffix('foo bar');
</script>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-counter-styles-3/#counter-style-range">
<link rel="author" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/counter-style-testcommon.js"></script>
<script>
function test_valid_range(value) {
test_valid_counter_style_descriptor('range', value);
}
function test_invalid_range(value) {
test_invalid_counter_style_descriptor('range', value);
}
// [ <integer> | infinite ]{2} ]# | auto
test_valid_range('auto');
test_valid_range('infinite infinite');
test_valid_range('infinite 0');
test_valid_range('0 infinite');
test_valid_range('infinite 0, 5 10, 100 infinite');
test_valid_range('infinite 10, 5 20, 15 infinite');
test_invalid_range('');
test_invalid_range('0 -1');
</script>

View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-counter-styles-3/#counter-style-speak_as">
<link rel="author" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/counter-style-testcommon.js"></script>
<script>
function test_valid_speak_as(value) {
test_valid_counter_style_descriptor('speak-as', value);
}
function test_invalid_speak_as(value) {
test_invalid_counter_style_descriptor('speak-as', value);
}
// auto | bullets | numbers | words | spell-out | <counter-style-name>
test_valid_speak_as('auto');
test_valid_speak_as('bullets');
test_valid_speak_as('numbers');
test_valid_speak_as('words');
test_valid_speak_as('spell-out');
test_valid_speak_as('bar');
test_valid_speak_as('spellout'); // 'spellout' is a valid counter style name
test_invalid_speak_as('bullets numbers');
// The following are not valid counter style names
test_invalid_speak_as('none');
test_invalid_speak_as('initial');
test_invalid_speak_as('inherit');
test_invalid_speak_as('unset');
</script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-counter-styles-3/#counter-style-symbols">
<link rel="author" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/counter-style-testcommon.js"></script>
<script>
function test_valid_symbols(value, expected) {
test_valid_counter_style_descriptor('symbols', value, expected);
}
function test_invalid_symbols(value) {
test_invalid_counter_style_descriptor('symbols', value);
}
// <symbol>+
test_valid_symbols('"X"');
test_valid_symbols('"X" "X"');
test_valid_symbols('ident "X"');
test_valid_symbols('ident "X" url("foo.jpg")');
test_invalid_symbols('');
test_invalid_symbols('initial "X" "X"');
test_invalid_symbols('inherit "X" "X"');
test_invalid_symbols('unset "X" "X"');
</script>

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-counter-styles-3/#counter-style-system">
<link rel="author" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/counter-style-testcommon.js"></script>
<script>
function test_valid_system(value) {
test_valid_counter_style_descriptor('system', value);
}
function test_invalid_system(value) {
test_invalid_counter_style_descriptor('system', value);
}
// cyclic | numeric | alphabetic | symbolic | additive |
// [fixed <integer>?] | [ extends <counter-style-name> ]
test_valid_system('cyclic');
test_valid_system('fixed');
test_valid_system('fixed 100');
test_valid_system('fixed -1');
test_valid_system('symbolic');
test_valid_system('alphabetic');
test_valid_system('numeric');
test_valid_system('additive');
test_valid_system('extends bar');
test_invalid_system('float');
test_invalid_system('cyclic cyclic');
// The following are not valid counter style names
test_invalid_system('extends none');
test_invalid_system('extends initial');
test_invalid_system('extends inherit');
test_invalid_system('extends unset');
</script>

View file

@ -0,0 +1,83 @@
function test_counter_style_descriptor(descriptor, value, expected) {
let descriptors = [];
descriptors.push(`${descriptor}: ${value}`);
// Fill out the remaining necessary descriptors
if (descriptor === 'system') {
if (value === 'additive')
descriptors.push('additive-symbols: 1 "I"');
else if (!value.startsWith('extends'))
descriptors.push('symbols: "X" "Y"');
} else if (descriptor === 'symbols') {
descriptors.push('system: symbolic');
} else if (descriptor === 'additive-symbols') {
descriptors.push('system: additive');
} else {
descriptors.push('system: symbolic');
descriptors.push('symbols: "X" "Y"');
}
let style = document.createElement('style');
style.textContent = `@counter-style foo { ${descriptors.join(';')} }`;
document.head.appendChild(style);
test(() => {
let rule = style.sheet.cssRules[0];
// TODO: The spec is inconsistent on when the entire rule is invalid
// (and hence absent from OM), and when only the descriptor is invalid.
// Revise when spec issue is resolved.
// See https://github.com/w3c/csswg-drafts/issues/5717
if (!rule) {
assert_equals(expected, undefined);
return;
}
assert_equals(rule.constructor.name, 'CSSCounterStyleRule');
let text = rule.cssText;
if (expected)
assert_not_equals(text.indexOf(`${descriptor}: ${expected}`), -1);
else
assert_equals(text.indexOf(`${descriptor}:`), -1);
}, `@counter-style '${descriptor}: ${value}' is ${expected ? 'valid' : 'invalid'}`);
style.remove();
}
function test_valid_counter_style_descriptor(descriptor, value, expected) {
expected = expected || value;
test_counter_style_descriptor(descriptor, value, expected);
}
function test_invalid_counter_style_descriptor(descriptor, value) {
test_counter_style_descriptor(descriptor, value, undefined);
}
function test_counter_style_name(name, isValid) {
let style = document.createElement('style');
style.textContent = `@counter-style ${name} { system: symbolic; symbols: 'X' 'Y'; }`;
document.head.appendChild(style);
test(() => {
let rule = style.sheet.cssRules[0];
if (!isValid) {
assert_equals(rule, undefined);
return;
}
assert_not_equals(rule, undefined);
assert_equals(rule.constructor.name, 'CSSCounterStyleRule');
assert_equals(rule.name, name);
}, `@counter-style name ${name} is ${isValid ? 'valid' : 'invalid'}`);
style.remove();
}
function test_valid_name(name) {
test_counter_style_name(name, true);
}
function test_invalid_name(name) {
test_counter_style_name(name, false);
}