Update web-platform-tests to revision 04cd5eb8e5c47e4fe341f2fb541d39fa2346f464

This commit is contained in:
WPT Sync Bot 2018-11-16 21:03:13 -05:00
parent 0ab2c3f8a3
commit 1d0624b343
226 changed files with 4495 additions and 903 deletions

View file

@ -2,6 +2,7 @@
<link rel="help" href="https://drafts.css-houdini.org/css-properties-values-api/#dom-css-registerproperty" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./resources/utils.js"></script>
<style>
div {
--registered-length-1: 10px;
@ -135,4 +136,38 @@ test(function(){
element.style = '';
}, 'Lists with relative units are absolutized when substituting');
function test_valid_fallback(syntax, value, fallback) {
test(function(){
let name = generate_property(syntax);
try {
element.style = `${name}: ${value}; --x:var(${name},${fallback})`;
let computedStyle = getComputedStyle(element);
assert_equals(computedStyle.getPropertyValue('--x'), value);
} finally {
element.style = '';
}
}, `Valid fallback does not invalidate var()-reference [${syntax}, ${fallback}]`);
}
function test_invalid_fallback(syntax, value, fallback) {
test(function(){
let name = generate_property(syntax);
try {
element.style = `${name}: ${value}; --x:var(${name},${fallback})`;
let computedStyle = getComputedStyle(element);
assert_equals(computedStyle.getPropertyValue('--x'), '');
} finally {
element.style = '';
}
}, `Invalid fallback invalidates var()-reference [${syntax}, ${fallback}]`);
}
test_valid_fallback('<length>', '40px', '10px');
test_valid_fallback('<length> | <color>', '40px', 'red');
test_valid_fallback('<length> | none', '40px', 'none');
test_invalid_fallback('<length>', '40px', 'red');
test_invalid_fallback('<length> | none', '40px', 'nolength');
test_invalid_fallback('<length>', '40px', 'var(--novar)');
</script>