Update web-platform-tests to revision 8ae1ddbc812733c3a73b103eafad56fb43a2f4b5

This commit is contained in:
WPT Sync Bot 2019-01-26 20:37:16 -05:00
parent d44e9aced2
commit 0e5e5db397
109 changed files with 2053 additions and 708 deletions

View file

@ -3,12 +3,22 @@
<head>
<meta charset="utf-8">
<title>css-conditional IDL tests</title>
<title>CSS Conditional Rules IDL tests</title>
<link rel="help" href="https://drafts.csswg.org/css-conditional/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
<!-- used to provide objects -->
<style>
div { display: block; }
</style>
<style>
@media print { }
</style>
<style>
@supports (display: block) { }
</style>
</head>
<body>
@ -16,16 +26,20 @@
<script>
'use strict';
promise_test(async () => {
const idl = await fetch('/interfaces/css-conditional.idl').then(r => r.text());
const cssom = await fetch('/interfaces/cssom.idl').then(r => r.text());
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
const idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_dependency_idls(cssom);
idl_array.add_dependency_idls(dom);
idl_array.test();
}, 'Test css-conditional IDL implementation');
idl_test(
['css-conditional'],
['cssom', 'dom'],
idl_array => {
idl_array.add_objects({
CSSRule: ['cssRule'],
CSSMediaRule: ['cssMediaRule'],
CSSSupportsRule: ['cssSupportsRule'],
});
self.cssRule = document.styleSheets[0].cssRules[0];
self.cssMediaRule = document.styleSheets[1].cssRules[0];
self.cssSupportsRule = document.styleSheets[2].cssRules[0];
}
);
</script>
</body>

View file

@ -1,19 +1,34 @@
<!doctype html>
<title>css-fonts IDL tests</title>
<title>CSS Fonts IDL tests</title>
<link rel="help" href="https://drafts.csswg.org/css-fonts-4/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
<style>
div { display: block; }
</style>
<style>
@font-face {
font-family: fwf;
src: url(support/fonts/FontWithFancyFeatures.otf);
}
</style>
<script>
"use strict";
promise_test(async () => {
const idl_array = new IdlArray();
const idl = await fetch("/interfaces/css-fonts.idl").then(r => r.text());
const cssom = await fetch("/interfaces/cssom.idl").then(r => r.text());
idl_array.add_idls(idl);
idl_array.add_dependency_idls(cssom);
idl_array.test();
}, "Test IDL implementation of css-fonts API");
idl_test(
["css-fonts"],
["cssom"],
idl_array => {
idl_array.add_objects({
CSSRule: ['cssRule'],
CSSFontFaceRule: ['cssFontFaceRule'],
});
self.cssRule = document.styleSheets[0].cssRules[0];
self.cssFontFaceRule = document.styleSheets[1].cssRules[0];
}
);
</script>

View file

@ -8,19 +8,9 @@
<script>
"use strict";
promise_test(async () => {
const idl_array = new IdlArray();
const idl = await fetch("/interfaces/css-paint-api.idl").then(r => r.text());
const cssom = await fetch("/interfaces/cssom.idl").then(r => r.text());
const html = await fetch("/interfaces/html.idl").then(r => r.text());
idl_array.add_idls(idl);
idl_array.add_dependency_idls(cssom);
idl_array.add_dependency_idls(html);
idl_array.add_untested_idls(`
[Exposed=Worklet]
interface WorkletGlobalScope {
attribute Console console;
};`);
idl_array.test();
}, "Test IDL implementation of CSS Painting API");
idl_test(
["css-paint-api"],
["cssom", "html", "worklets"]
// No objects in Window global
);
</script>

View file

@ -8,13 +8,9 @@
<script>
"use strict";
promise_test(async () => {
const idl = await fetch("/interfaces/css-properties-values-api.idl").then(r => r.text());
const cssom = await fetch("/interfaces/cssom.idl").then(r => r.text());
const idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_dependency_idls(cssom);
idl_array.test();
}, "Test IDL implementation of CSS Properties Values API");
idl_test(
["css-properties-values-api"],
["cssom"]
// No objects
);
</script>

View file

@ -0,0 +1,125 @@
<!doctype html>
<title>An+B Parsing</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
foo { color: blue; }
</style>
<meta name="author" title="Tab Atkins-Bittner">
<link rel=help href="https://drafts.csswg.org/css-syntax/#the-anb-type">
<script>
function roundtripANB(str) {
const rule = document.styleSheets[0].cssRules[0];
rule.selectorText = "foo";
rule.selectorText = `:nth-child(${str})`;
// Check for parse error.
if(rule.selectorText == "foo") return "parse error";
return rule.selectorText.slice(11, -1);
}
function testANB(input, expected) {
test(()=>{
assert_equals(roundtripANB(input), expected);
}, `"${input}" becomes "${expected}"`);
}
/* Just going down all the syntax clauses one-by-one */
// odd | even |
testANB("odd", "2n+1");
testANB("even", "2n");
// <integer> |
testANB("1", "1");
testANB("+1", "1");
testANB("-1", "-1");
//
// <n-dimension> |
testANB("5n", "5n");
testANB("5N", "5n");
// '+'?† n |
testANB("+n", "n");
testANB("n", "n");
testANB("N", "n");
testANB("+ n", "parse error");
// -n |
testANB("-n", "-n");
testANB("-N", "-n");
//
// <ndashdigit-dimension> |
testANB("5n-5", "5n-5");
// '+'?† <ndashdigit-ident> |
testANB("+n-5", "n-5");
testANB("n-5", "n-5");
testANB("+ n-5", "parse error");
// <dashndashdigit-ident> |
testANB("-n-5", "-n-5");
//
// <n-dimension> <signed-integer> |
testANB("5n +5", "5n+5");
testANB("5n -5", "5n-5");
// '+'?† n <signed-integer> |
testANB("+n +5", "n+5");
testANB("n +5", "n+5");
testANB("+n -5", "n-5");
testANB("+ n +5", "parse error");
testANB("n 5", "parse error");
// -n <signed-integer> |
testANB("-n +5", "-n+5");
testANB("-n -5", "-n-5");
testANB("-n 5", "parse error");
//
// <ndash-dimension> <signless-integer> |
testANB("5n- 5", "5n-5");
testANB("5n- -5", "parse error");
testANB("5n- +5", "parse error");
testANB("-5n- 5", "-5n-5");
// '+'?† n- <signless-integer> |
testANB("+n- 5", "n-5");
testANB("n- 5", "n-5");
testANB("+ n- 5", "parse error");
testANB("n- +5", "parse error");
testANB("n- -5", "parse error");
// -n- <signless-integer> |
testANB("-n- 5", "-n-5");
testANB("-n- +5", "parse error");
testANB("-n- -5", "parse error");
//
// <n-dimension> ['+' | '-'] <signless-integer>
testANB("5n + 5", "5n+5");
testANB("5n - 5", "5n-5");
testANB("5n + +5", "parse error");
testANB("5n + -5", "parse error");
testANB("5n - +5", "parse error");
testANB("5n - -5", "parse error");
// '+'?† n ['+' | '-'] <signless-integer> |
testANB("+n + 5", "n+5");
testANB("n + 5", "n+5");
testANB("+ n + 5", "parse error");
testANB("+n - 5", "n-5");
testANB("+n + +5", "parse error");
testANB("+n + -5", "parse error");
testANB("+n - +5", "parse error");
testANB("+n - -5", "parse error");
// -n ['+' | '-'] <signless-integer>
testANB("-n + 5", "-n+5");
testANB("-n - 5", "-n-5");
testANB("-n + +5", "parse error");
testANB("-n + -5", "parse error");
testANB("-n - +5", "parse error");
testANB("-n - -5", "parse error");
/* Swapped ordering is invalid */
testANB("1 - n", "parse error");
testANB("0 - n", "parse error");
testANB("-1 + n", "parse error");
/* Odd space usage */
testANB("2 n + 2", "parse error");
testANB("- 2n", "parse error");
testANB("+ 2n", "parse error");
testANB("+2 n", "parse error");
</script>

View file

@ -0,0 +1,62 @@
<!doctype html>
<title>An+B Serialization</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
foo { color: blue; }
</style>
<meta name="author" title="Tab Atkins-Bittner">
<link rel=help href="https://drafts.csswg.org/css-syntax/#serializing-anb">
<script>
function roundtripANB(str) {
const rule = document.styleSheets[0].cssRules[0];
rule.selectorText = "foo";
rule.selectorText = `:nth-child(${str})`;
// Check for parse error.
if(rule.selectorText == "foo") return "parse error";
return rule.selectorText.slice(11, -1);
}
function testANB(input, expected) {
test(()=>{
assert_equals(roundtripANB(input), expected);
}, `"${input}" becomes "${expected}"`);
}
/* A is 0, or omitted */
testANB("1", "1");
testANB("+1", "1");
testANB("-1", "-1");
testANB("0n + 0", "0");
testANB("0n + 1", "1");
testANB("0n - 1", "-1");
/* A is 1 */
testANB("1n", "n");
testANB("1n - 0", "n");
testANB("1n + 1", "n+1");
testANB("1n - 1", "n-1");
/* A is -1 */
testANB("-1n", "-n");
testANB("-1n - 0", "-n");
testANB("-1n + 1", "-n+1");
testANB("-1n - 1", "-n-1");
/* A is implied via + or - */
testANB("+n+1", "n+1");
testANB("-n-1", "-n-1");
/* B is 0 */
testANB("n + 0", "n");
testANB("n - 0", "n");
/* A & B both nonzero */
testANB("2n + 2", "2n+2");
testANB("-2n - 2", "-2n-2");
</script>

View file

@ -0,0 +1,60 @@
<!doctype html>
<title>Inclusive Ranges</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
foo { z-index: 0; }
</style>
<meta name="author" title="Tab Atkins-Bittner">
<link rel=help href="https://drafts.csswg.org/css-syntax/#digit">
<link rel=help href="https://drafts.csswg.org/css-syntax/#non-printable-code-point">
<script>
function roundtripIdent(str) {
const rule = document.styleSheets[0].cssRules[0];
rule.selectorText = "original-ident";
rule.selectorText = str;
// Check for parse error.
if(rule.selectorText == "original-ident") return "parse error";
return rule.selectorText;
}
function roundtripInteger(str) {
const rule = document.styleSheets[0].cssRules[0];
rule.style.zIndex = "12345";
rule.style.zIndex = str;
// Check for parse error.
if(rule.style.zIndex == "12345") return "parse error";
return rule.style.zIndex;
}
function testInteger(input, expected) {
test(()=>{
assert_equals(roundtripInteger(input), expected);
}, `"${input}" becomes "${expected}"`);
}
function testIdent(input, expected) {
test(()=>{
assert_equals(roundtripIdent(input), expected);
}, `"${input}" becomes "${expected}"`);
}
/* Digits are the inclusive range 0-9 */
for(var i = 0; i <= 9; i++) {
testInteger(i+"", i+"");
}
/* Non-printables are the inclusive ranges 0-8, b, e-1f, or 7f */
// 0 never shows up due to preprocessing, so start at 1
for(var i = 1; i <= 8; i++) {
testIdent("foo"+String.fromCodePoint(i), "parse error");
}
testIdent("foo"+String.fromCodePoint(0xb), "parse error");
for(var i = 0xe; i <= 0x1f; i++) {
testIdent("foo"+String.fromCodePoint(i), "parse error");
}
testIdent("foo" + String.fromCodePoint(0x7f), "parse error");
</script>

View file

@ -0,0 +1,46 @@
<!doctype html>
<title>Input Preprocessing</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
foo { color: blue; }
</style>
<meta name="author" title="Tab Atkins-Bittner">
<link rel=help href="https://drafts.csswg.org/css-syntax/#input-preprocessing">
<script>
function roundtripIdent(str) {
const rule = document.styleSheets[0].cssRules[0];
rule.selectorText = "original-ident";
rule.selectorText = str;
// Check for parse error.
if(rule.selectorText == "original-ident") return "parse error";
return rule.selectorText;
}
function testParsing(input, expected) {
test(()=>{
assert_equals(roundtripIdent(input), expected);
}, `"${input}" becomes "${expected}"`);
}
/* Can't figure out how to test the newline normalization... */
/* NULL becomes FFFD */
testParsing("foo\x00", "foo\ufffd");
testParsing("f\x00oo", "f\ufffdoo");
testParsing("\x00foo", "\ufffdfoo");
testParsing("\x00", "\ufffd");
testParsing("\x00\x00\x00", "\ufffd\ufffd\ufffd");
/* surrogates become FFFD */
testParsing("foo\ud800", "foo\ufffd");
testParsing("f\ud800oo", "f\ufffdoo");
testParsing("\ud800foo", "\ufffdfoo");
testParsing("\ud800", "\ufffd");
testParsing("\ud800\ud800\ud800", "\ufffd\ufffd\ufffd");
</script>

View file

@ -0,0 +1,36 @@
<!doctype html>
<title>Unclosed Constructs Are Valid</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<meta name="author" title="Tab Atkins-Bittner">
<link rel=help href="https://drafts.csswg.org/css-syntax/#rule-defs">
<!--
Tests that unclosed constructs are valid and match grammars,
because grammar-matching only sees the "block",
not the opening/closing characters themselves.
-->
<script>
function validSelector(str) {
try {
document.querySelector(str);
return true;
} catch(e) {
return false;
}
}
function shouldBeValid(str) {
test(()=>{
assert_true(validSelector(str));
}, `"${str}" is a valid selector`)
}
shouldBeValid("[foo]");
shouldBeValid("[foo");
shouldBeValid(":nth-child(1)");
shouldBeValid(":nth-child(1");
</script>

View file

@ -0,0 +1,62 @@
<!doctype html>
<title>CSS Whitespace</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<meta name="author" title="Tab Atkins-Bittner">
<link rel=help href="https://drafts.csswg.org/css-syntax/#whitespace">
<div class=a><b></b></div>
<div id=foo></div>
<!--
CSS's definition of "whitespace" matches HTML,
and includes only the five ASCII characters
U+0009, U+000A, U+000C, U+000D, and U+0020.
The rest of Unicode's whitespace characters,
many of which are recognized as whitespace by JS,
are not valid whitespace in CSS.
-->
<script>
function isWhitespace(codepoint) {
const char = String.fromCodePoint(codepoint);
const codepointName = "U+" + codepoint.toString(16).padStart(4, "0");
test(()=>{
const withSpace = document.querySelector(".a b");
const withChar = document.querySelector(`.a${char}b`);
assert_equals(withSpace, withChar);
}, `${codepointName} is CSS whitespace`);
}
function isNotWhitespace(codepoint) {
const char = String.fromCodePoint(codepoint);
const codepointName = "U+" + codepoint.toString(16).padStart(4, "0");
test(()=>{
const withSpace = document.querySelector(".a b");
document.querySelector("#foo").setAttribute("class", `.a${char}b`);
try {
var withChar = document.querySelector(`.a${char}b`);
} catch(e) {
assert_true(true, `${codepointName} isn't valid in a selector at all`);
return;
}
assert_not_equals(withSpace, withChar);
}, `${codepointName} is *not* CSS whitespace`);
}
// CSS Whitespace characters
var whitespace = [0x9, 0xa, 0xc, 0xd, 0x20];
// Unicode Whitespace characters not recognized by CSS
// https://en.wikipedia.org/wiki/Whitespace_character#Unicode
var notWhitespace = [0xb, 0x85, 0xa0, 0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x2928, 0x2029, 0x202f, 0x205f, 0x3000, 0x180e, 0x200b, 0x200c, 0x200d, 0x2060, 0xfeff];
for(var codepoint of whitespace) {
isWhitespace(codepoint);
}
for(var codepoint of notWhitespace) {
isNotWhitespace(codepoint);
}
</script>

View file

@ -6,6 +6,7 @@
<link rel="author" title="Marc Bourlon" href="mailto:marc@bourlon.com">
<link rel="help" href="http://www.w3.org/TR/css3-values/#viewport-relative-lengths">
<link rel="match" href="reference/vh_not_refreshing_on_chrome-ref.html">
<meta charset="UTF-8">
<meta name="assert" content="vh-based dimension doesn't change when the element's other dimension doesn't change.">
<!-- This test exhibits a bug for Chrome 19.0.1084.56 / Mac OS X 10.6.8 -->
<script src="/common/reftest-wait.js"></script>

View file

@ -3,6 +3,7 @@
<!-- Submitted from TestTWF Paris -->
<head>
<title>CSS Values and Units Test: Viewport units in scaled viewport</title>
<meta charset="UTF-8">
<meta name="assert" content="viewport relative units scale with viewport.">
<link rel="author" title="Emil A Eklund" href="mailto:eae@chromium.org">
<link rel="help" href="http://www.w3.org/TR/css3-values/#viewport-relative-lengths">

View file

@ -2,6 +2,7 @@
<html>
<head>
<title>CSS Values and Units Test: Checks viewport units against CSS 2.1 properties and the CSSOM</title>
<meta charset="UTF-8">
<meta name="assert" content="Testing what happens when one applies and rereads viewport unit lengths to CSS 2.1 properties that accept length values" />
<link rel="author" title="Christian Schaefer" href="mailto:schaepp@gmx.de">
<link rel="help" href="http://www.w3.org/TR/css3-values/#viewport-relative-lengths">