Skip to content

Commit

Permalink
Bug 1439427 [wpt PR 9572] - [css-typed-om] Allow mutations of CSSUnpa…
Browse files Browse the repository at this point in the history
…rsedValue., a=testonly

Automatic update from web-platform-tests[css-typed-om] Allow mutations of CSSUnparsedValue.

This patch allows CSSUnparsedValue items to be mutated/appended.
See w3c/css-houdini-drafts#664

Bug: 812919
Change-Id: I3e3c1d91fa9bfaa3a1a4adde45202c36c9bdb37f
Reviewed-on: https://chromium-review.googlesource.com/923670
Reviewed-by: nainar <nainar@chromium.org>
Commit-Queue: Darren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537691}

wpt-commits: 8fed98324bc133df221d778c62cbff210d43b0ce
wpt-pr: 9572
wpt-commits: 8fed98324bc133df221d778c62cbff210d43b0ce
wpt-pr: 9572
  • Loading branch information
darrnshn authored and jgraham committed Mar 31, 2018
1 parent d388ed4 commit 78900dc
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
2 changes: 1 addition & 1 deletion testing/web-platform/meta/MANIFEST.json
Original file line number Diff line number Diff line change
Expand Up @@ -518681,7 +518681,7 @@
"testharness"
],
"css/css-typed-om/stylevalue-subclasses/cssUnparsedValue.html": [
"16725f5047477a1a8837e464935af3da0a01deb2",
"46d36ae2dc68f3f3f1cee5d85cb5f496b7c3fa67",
"testharness"
],
"css/css-typed-om/stylevalue-subclasses/cssUrlImageValue-interface.html": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta name="assert" content="Test CSSUnparsedValue constructor and members">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/testhelper.js"></script>
<body>
<div id="log">
<script>
Expand Down Expand Up @@ -47,4 +48,44 @@
}, 'CSSUnparsedValue can be constructed from ' + description);
}

test(() => {
let result = new CSSUnparsedValue([new CSSVariableReferenceValue('--foo')]);

result[0] = 'A';
assert_equals(result[0], 'A', 'Item should be updated to new value');
}, 'Can update item in CSSUnparsedValue to a string');

test(() => {
let result = new CSSUnparsedValue(['foo']);

result[0] = new CSSVariableReferenceValue('--A');
assert_style_value_equals(result[0], new CSSVariableReferenceValue('--A'),
'Item should be updated to new value');
}, 'Can update item in CSSUnparsedValue to a variable reference');

test(() => {
let result = new CSSUnparsedValue([]);

result[0] = new CSSVariableReferenceValue('--A');
assert_equals(result.length, 1,
'Length of CSSUnparsedValue should have increased');
assert_style_value_equals(result[0], new CSSVariableReferenceValue('--A'),
'New item should be appended');

result[1] = 'foo';
assert_equals(result.length, 2,
'Length of CSSUnparsedValue should have increased');
assert_equals(result[1], 'foo', 'New item should be appended');
}, 'Can append items to CSSUnparsedValue');

test(() => {
const result = new CSSUnparsedValue(['foo', 'bar']);
assert_equals(result[3], undefined);
}, 'Getting invalid index in CSSUnparsedValue returns undefined');

test(() => {
let result = new CSSUnparsedValue(['foo', 'bar']);
assert_throws(new RangeError(), () => result[3] = 'foo');
}, 'Setting invalid index in CSSUnparsedValue throws RangeError');

</script>

0 comments on commit 78900dc

Please sign in to comment.