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

Unified Diff: third_party/WebKit/LayoutTests/custom-properties/unregister-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
Index: third_party/WebKit/LayoutTests/custom-properties/unregister-property.html
diff --git a/third_party/WebKit/LayoutTests/custom-properties/unregister-property.html b/third_party/WebKit/LayoutTests/custom-properties/unregister-property.html
new file mode 100644
index 0000000000000000000000000000000000000000..9419bc9312805d63601a02521f2f72d716dd077d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/custom-properties/unregister-property.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+
+<script>
+test(function() {
+ var reregisterError = {name: 'InvalidModificationError'};
+ var unregisterError = {name: 'NotFoundError'};
+ CSS.registerProperty({name: '--property'});
+ assert_throws(reregisterError, () => CSS.registerProperty({name: '--property'}));
+ assert_throws(unregisterError, () => CSS.unregisterProperty({name: '--property2'}));
+
+ CSS.registerProperty({name: '--property2', syntax: '<length>', initialValue: '5px'});
+ assert_throws(reregisterError, () => CSS.registerProperty({name: '--property2'}));
+ assert_throws(reregisterError, () => CSS.registerProperty({name: '--property'}));
+
+ CSS.unregisterProperty('--property');
+ assert_throws(unregisterError, () => CSS.unregisterProperty({name: '--property'}));
+ assert_throws(reregisterError, () => CSS.registerProperty({name: '--property2'}));
+ CSS.registerProperty({name: '--property'});
+ assert_throws(reregisterError, () => CSS.registerProperty({name: '--property'}));
+
+ CSS.unregisterProperty('--property2');
+ assert_throws(unregisterError, () => CSS.unregisterProperty({name: '--property2'}));
+}, "Registration state is correctly managed and correct errors are thrown");
+</script>

Powered by Google App Engine
This is Rietveld 408576698