diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/css/css-typed-om/stylevalue-serialization/cssUnparsedValue.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-typed-om/stylevalue-serialization/cssUnparsedValue.html')
-rw-r--r-- | testing/web-platform/tests/css/css-typed-om/stylevalue-serialization/cssUnparsedValue.html | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-typed-om/stylevalue-serialization/cssUnparsedValue.html b/testing/web-platform/tests/css/css-typed-om/stylevalue-serialization/cssUnparsedValue.html new file mode 100644 index 0000000000..c87553dd91 --- /dev/null +++ b/testing/web-platform/tests/css/css-typed-om/stylevalue-serialization/cssUnparsedValue.html @@ -0,0 +1,44 @@ +<!doctype html> +<meta charset="utf-8"> +<title>IDL-constructed CSSUnparsedValue serialization tests</title> +<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#unparsedvalue-serialization"> +<meta name="assert" content="Test CSSUnparsedValue are serialized similar to getComputedStyle()" /> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<div id="tag"></div> +<div id="elem" style="color-scheme: bar/*comment*/var(--foo)"></div> +<script> +'use strict'; + +test(() => { + assert_equals(new CSSUnparsedValue(['lem', 'on', 'ade']).toString(), 'lem/**/on/**/ade'); +}, 'CSSUnparsedValue containing strings serializes to its tokenized contents'); + +test(() => { + assert_equals(new CSSUnparsedValue([ + new CSSVariableReferenceValue('--A', + new CSSUnparsedValue([new CSSVariableReferenceValue('--B')])), + new CSSVariableReferenceValue('--C')]).toString(), + 'var(--A,var(--B))var(--C)'); +}, 'CSSUnparsedValue containing variable references serializes its ' + + 'tokenized contents'); + +test(() => { + assert_equals(new CSSUnparsedValue(['foo', 'bar ', + new CSSVariableReferenceValue('--A', + new CSSUnparsedValue(['baz ', + new CSSVariableReferenceValue('--B'), 'lemon'])), + new CSSVariableReferenceValue('--C', + new CSSUnparsedValue(['ade']))]).toString(), + 'foo/**/bar var(--A,baz var(--B)lemon)var(--C,ade)'); +}, 'CSSUnparsedValue containing mix of strings and variable references ' + + 'serializes to its tokenized contents'); + +test(() => { + assert_equals( + elem.attributeStyleMap.get("color-scheme").toString(), + 'bar/**/var(--foo)'); +}, 'attributeStyleMap round-trips correctly, though the comment is gone'); + +</script> |