Bug 1523562 [wpt PR 15092] - Escaped EOF, a=testonly

Automatic update from web-platform-tests
Escaped EOF

Tests <https://github.com/w3c/csswg-drafts/issues/3182> and <https://github.com/w3c/csswg-drafts/issues/1821>
--
Use assert_throws, etc

Per @domenic's advice, go ahead and use assert_throws on the throwing call, and then just make the should-succeed call directly, as a throw will cause the test to fail anyway.
--
Merge pull request #15092 from web-platform-tests/tabatkins-patch-1

Escaped EOF

--

wpt-commits: 26f39eb230185a804fabc398810cdcdddefc49ac, f44998b147858a8a2832f66dd32bc9d1ecefb1b3, fc57d7ad7a2942cfa363d5a9b8c6c7d74f5bb693
wpt-pr: 15092
This commit is contained in:
Tab Atkins Jr 2019-02-01 11:40:35 +00:00 коммит произвёл James Graham
Родитель 5067a01b6d
Коммит ac878a5ea4
1 изменённых файлов: 46 добавлений и 0 удалений

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

@ -0,0 +1,46 @@
<!doctype html>
<title>Escaped EOF</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/#consume-escaped-code-point">
<link rel=help href="https://drafts.csswg.org/css-syntax/#consume-string-token">
<link rel=help href="https://drafts.csswg.org/css-syntax/#consume-token">
<style>foo { --foo:foo\</style>
<style>foo { --foo:1foo\</style>
<style>foo { --foo:url(foo\</style>
<style>foo { --foo:"foo\</style>
<script>
test(()=>{
assert_throws(new SyntaxError, ()=>{document.querySelector("#123");}, "numeric hash token is invalid in a selector");
document.querySelector("#foo\\"); // escaped-EOF in a hash token is valid in a selector
}, "Escaped EOF turns into a U+FFFD in a hash token, makes it 'ID' type.");
test(()=>{
const sh = document.styleSheets[0];
const val = sh.cssRules[0].style.getPropertyValue("--foo");
assert_equals("foo\ufffd", val);
}, "Escaped EOF turns into a U+FFFD in an ident token.");
test(()=>{
const sh = document.styleSheets[1];
const val = sh.cssRules[0].style.getPropertyValue("--foo");
assert_equals("1foo\ufffd", val);
}, "Escaped EOF turns into a U+FFFD in a dimension token.");
test(()=>{
const sh = document.styleSheets[2];
const val = sh.cssRules[0].style.getPropertyValue("--foo");
assert_equals("url(foo\ufffd)", val);
}, "Escaped EOF turns into a U+FFFD in a url token.");
test(()=>{
const sh = document.styleSheets[3];
const val = sh.cssRules[0].style.getPropertyValue("--foo");
assert_equals(`"foo"`, val);
}, "Escaped EOF in a string is ignored.");
</script>