1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
<!doctype html>
<meta charset="utf-8">
<title>CSSUnparsedValue Constructor</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-cssunparsedvalue-cssunparsedvalue">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/testhelper.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
const gTestArguments = [
{
description: 'no arguments',
fragments: [],
},
{
description: 'a single empty string',
fragments: [''],
},
{
description: 'a single CSSVariableReferenceValue',
fragments: [new CSSVariableReferenceValue('--foo')],
},
{
description: 'a mix of strings and CSSVariableReferenceValues',
fragments: [
'foo',
'bar',
new CSSVariableReferenceValue('--A'),
'baz',
new CSSVariableReferenceValue('--B')
],
},
];
for (const args of gTestArguments) {
test(() => {
const result = new CSSUnparsedValue(args.fragments);
assert_not_equals(result, null, 'a CSSUnparsedValue is created');
assert_style_value_array_equals(result, args.fragments,
'fragments are same as given by constructor');
}, `CSSUnparsedValue can be constructed from ${args.description}`);
}
</script>
|