author | Anders Hartvoll Ruud <andruud@chromium.org> |
Tue, 28 Apr 2020 11:35:17 +0000 | |
changeset 527546 | 11570b6989c7dd77a05a42ce1a7af44af0e6fc99 |
parent 527545 | e4651ad8076551d9f051e488bb71d4e68416e931 |
child 527547 | 1b2a09e3b4726cb90d9dcfacf7999dd4a1e50d80 |
push id | 37368 |
push user | btara@mozilla.com |
push date | Fri, 01 May 2020 21:45:51 +0000 |
treeherder | mozilla-central@0f9c5a59e45d [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | testonly |
bugs | 1631732, 23135, 973830, 2157071, 761075 |
milestone | 77.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
testing/web-platform/tests/css/css-properties-values-api/determine-registration.html | file | annotate | diff | comparison | revisions |
new file mode 100644 --- /dev/null +++ b/testing/web-platform/tests/css/css-properties-values-api/determine-registration.html @@ -0,0 +1,80 @@ +<!DOCTYPE html> +<link rel="help" href="https://drafts.css-houdini.org/css-properties-values-api-1/#determining-registration"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> +@property --a { + syntax: "<length>"; + inherits: false; + initial-value: 1px; +} + +@property --b { + syntax: "<length>"; + inherits: false; + initial-value: 2px; +} + +@property --c { + syntax: "<length>"; + inherits: false; + initial-value: 3px; +} + +@property --d { + syntax: "<length>"; + inherits: false; + initial-value: 4px; +} + +@property --d { + syntax: "<color>"; + inherits: false; + initial-value: red; +} +</style> +<style> +@property --c { + syntax: "<integer>"; + inherits: false; + initial-value: 6; +} +</style> +<div id=div></div> +<script> + +CSS.registerProperty({ + name: '--b', + syntax: '<color>', + inherits: false, + initialValue: 'green' +}); + +CSS.registerProperty({ + name: '--e', + syntax: '<color>', + inherits: false, + initialValue: 'blue' +}); + +test(() => { + assert_equals(getComputedStyle(div).getPropertyValue('--a'), '1px'); +}, '@property determines the registration when uncontested'); + +test(() => { + assert_equals(getComputedStyle(div).getPropertyValue('--b'), 'rgb(0, 128, 0)'); +}, 'CSS.registerProperty wins over @property'); + +test(() => { + assert_equals(getComputedStyle(div).getPropertyValue('--c'), '6'); +}, '@property later in document order wins'); + +test(() => { + assert_equals(getComputedStyle(div).getPropertyValue('--d'), 'rgb(255, 0, 0)'); +}, '@property later in stylesheet wins'); + +test(() => { + assert_equals(getComputedStyle(div).getPropertyValue('--e'), 'rgb(0, 0, 255)'); +}, 'CSS.registerProperty determines the registration when uncontested'); + +</script>