Skip to content

Commit

Permalink
[css-typed-om] Allow CSSVariableReferenceValue.fallback to be nullable.
Browse files Browse the repository at this point in the history
Spec change:
w3c/css-houdini-drafts@c9d9c29

Bug: 814487
Change-Id: Idb15d8edc4dc7aba4cf40ac13b69ea13ef7d8f60
  • Loading branch information
darrnshn authored and chromium-wpt-export-bot committed Feb 22, 2018
1 parent e925327 commit 9ce909c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@
'Fallback member should be null');
}, 'CSSVariableReferenceValue can be constructed with no fallback');

test(() => {
const result = new CSSVariableReferenceValue('--foo', null);

assert_not_equals(result, null,
'A CSSVariableReferenceValue should be created');
assert_equals(result.variable, '--foo',
'Variable member should be same as passed in the constructor');
assert_equals(result.fallback, null, 'Fallback member should be null');
}, 'CSSVariableReferenceValue can be constructed with null fallback');

test(() => {
const result = new CSSVariableReferenceValue('--foo',
new CSSUnparsedValue(['lemon']));
Expand All @@ -32,7 +42,7 @@
'Fallback member should not be null');
assert_style_value_equals(result.fallback, new CSSUnparsedValue(['lemon']),
'Fallback member should be as same as passed in the constructor');
}, 'CSSVariableReferenceValue can be constructed with fallback');
}, 'CSSVariableReferenceValue can be constructed with valid fallback');

test(() => {
let result = new CSSVariableReferenceValue('--foo');
Expand Down
2 changes: 1 addition & 1 deletion interfaces/css-typed-om.idl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ interface CSSUnparsedValue : CSSStyleValue {
typedef (DOMString or CSSVariableReferenceValue) CSSUnparsedSegment;

[Exposed=(Window, Worker, PaintWorklet, LayoutWorklet),
Constructor(DOMString variable, optional CSSUnparsedValue fallback)]
Constructor(DOMString variable, optional CSSUnparsedValue? fallback)]
interface CSSVariableReferenceValue {
attribute DOMString variable;
readonly attribute CSSUnparsedValue? fallback;
Expand Down

0 comments on commit 9ce909c

Please sign in to comment.