| Index: third_party/WebKit/LayoutTests/custom-properties/register-property.html
|
| diff --git a/third_party/WebKit/LayoutTests/custom-properties/register-property.html b/third_party/WebKit/LayoutTests/custom-properties/register-property.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7a5aadadcdd834a21a1c346d951ba2f0f8e9885c
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/custom-properties/register-property.html
|
| @@ -0,0 +1,35 @@
|
| +<!DOCTYPE HTML>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<script>
|
| +// Tests for error checking during property registration
|
| +
|
| +test(function() {
|
| + assert_throws(new TypeError(), () => CSS.registerProperty());
|
| + assert_throws(new TypeError(), () => CSS.registerProperty(undefined));
|
| + assert_throws(new TypeError(), () => CSS.registerProperty(true));
|
| + assert_throws(new TypeError(), () => CSS.registerProperty(2));
|
| + assert_throws(new TypeError(), () => CSS.registerProperty("css"));
|
| + assert_throws(new TypeError(), () => CSS.registerProperty(null));
|
| +}, "registerProperty requires a Dictionary type");
|
| +
|
| +test(function() {
|
| + // Valid property names, shouldn't throw
|
| + CSS.registerProperty({name: '--name1'});
|
| + CSS.registerProperty({name: '--name2, no need for escapes'});
|
| + CSS.registerProperty({name: ['--name', 3]});
|
| +
|
| + // Invalid property names
|
| + assert_throws(new TypeError(), () => CSS.registerProperty({}));
|
| + assert_throws(new SyntaxError(), () => CSS.registerProperty({name: 'no-leading-dash'}));
|
| + assert_throws(new SyntaxError(), () => CSS.registerProperty({name: ''}));
|
| + assert_throws(new SyntaxError(), () => CSS.registerProperty({name: '\\--name'}));
|
| +}, "registerProperty requires a name matching <custom-property-name>");
|
| +
|
| +test(function() {
|
| + CSS.registerProperty({name: '--syntax-test-1', syntax: '*'});
|
| + CSS.registerProperty({name: '--syntax-test-2', syntax: ' * '});
|
| + assert_throws(new SyntaxError(),
|
| + () => CSS.registerProperty({name: '--syntax-test-3', syntax: 'length'}));
|
| +}, "registerProperty only allows omitting initialValue is syntax is '*'");
|
| +</script>
|
|
|