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
48
49
50
|
<!doctype html>
<meta charset="utf-8">
<title>CSSStyleValue.parseAll</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#dom-cssstylevalue-parseall">
<meta name="assert" content="Test CSSStyleValue.parseAll returns CSSStyleValues" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
test(() => {
const result = CSSStyleValue.parseAll('width', '10px');
assert_equals(result.length, 1, 'Result must be a list with one element');
assert_true(result[0] instanceof CSSStyleValue,
'Only element in result must be a subclass of CSSStyleValue');
}, 'CSSStyleValue.parseAll() with a valid property returns a list with a single CSSStyleValue');
test(() => {
const result = CSSStyleValue.parseAll('WiDtH', '10px');
assert_equals(result.length, 1, 'Result must be a list with one element');
assert_true(result[0] instanceof CSSStyleValue,
'Only element in result must be a subclass of CSSStyleValue');
}, 'CSSStyleValue.parseAll() is not case sensitive');
test(() => {
const result = CSSStyleValue.parseAll('transition-duration', '1s, 2s, 3s');
assert_equals(result.length, 3, 'Result must be a list with three elements');
for (const item of result) {
assert_true(item instanceof CSSStyleValue,
'All elements in result must be a subclass of CSSStyleValue');
}
}, 'CSSStyleValue.parseAll() with a valid list-valued property returns a list with a single CSSStyleValue');
test(() => {
const result = CSSStyleValue.parseAll('margin', '1px 2px 3px 4px');
assert_equals(result.length, 1, 'Result must be a list with one element');
assert_true(result[0] instanceof CSSStyleValue,
'Only element in result must be a subclass of CSSStyleValue');
}, 'CSSStyleValue.parseAll() with a valid shorthand property returns a CSSStyleValue');
test(() => {
const result = CSSStyleValue.parseAll('--foo', 'auto');
assert_equals(result.length, 1, 'Result must be a list with one element');
assert_true(result[0] instanceof CSSStyleValue,
'Only element in result must be a subclass of CSSStyleValue');
}, 'CSSStyleValue.parseAll() with a valid custom property returns a list with a single CSSStyleValue');
</script>
|