Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(890)

Unified Diff: third_party/WebKit/LayoutTests/custom-properties/register-property.html

Issue 2310823002: Skeleton implementation of CSS Properties and Values API (Closed)
Patch Set: fix stylevardata copy ctor Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/custom-properties/unregister-property.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/custom-properties/unregister-property.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698