| <!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"> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script src="../resources/testhelper.js"></script> |
| <script> |
| 'use strict'; |
| |
| test(() => { |
| assert_equals(new CSSUnparsedValue('auto').toString(), 'auto'); |
| assert_equals(new CSSUnparsedValue('lemon', 'ade').toString(), 'lemonade'); |
| }, 'CSSUnparsedValue constructed from IDL with strings serializes correctly'); |
| |
| test(() => { |
| assert_equals(new CSSUnparsedValue(new CSSVariableReferenceValue('--A')).toString(), 'var(--A)'); |
| assert_equals(new CSSUnparsedValue( |
| new CSSVariableReferenceValue('--A'), |
| new CSSVariableReferenceValue('--B')).toString(), |
| 'var(--A)var(--B)'); |
| assert_equals(new CSSUnparsedValue( |
| new CSSVariableReferenceValue('--A', |
| new CSSUnparsedValue(new CSSVariableReferenceValue('--B'))), |
| new CSSVariableReferenceValue('--C')).toString(), |
| 'var(--A,var(--B))var(--C)'); |
| }, 'CSSUnparsedValue constructed from IDL with CSSVariableReferenceValues serializes correctly'); |
| |
| test(() => { |
| assert_equals(new CSSUnparsedValue('foo', 'bar ', |
| new CSSVariableReferenceValue('--A', |
| new CSSUnparsedValue('baz ', new CSSVariableReferenceValue('--B'), 'lemon')), |
| new CSSVariableReferenceValue('--C', |
| new CSSUnparsedValue('ade'))).toString(), |
| 'foobar var(--A,baz var(--B)lemon)var(--C,ade)'); |
| }, 'CSSUnparsedValue constructed from IDL with mix of strings and CSSVariableReferenceValues serializes correctly'); |
| |
| </script> |