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

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

Issue 2405153002: Remove CSS.unregisterProperty as the WG resolved to remove it for now (Closed)
Patch Set: Created 4 years, 2 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
deleted file mode 100644
index 2a9bfb5858458a11240c58e1e6397e420326a0dd..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/custom-properties/unregister-property.html
+++ /dev/null
@@ -1,78 +0,0 @@
-<!DOCTYPE HTML>
-<script src="../resources/testharness.js"></script>
-<script src="../resources/testharnessreport.js"></script>
-
-<style>
-#div1 {
- --length: 5px;
- --color: notacolor;
-}
-#div2 {
- --color: pink;
-}
-</style>
-
-<div id=div1></div>
-<div id=div2></div>
-<div id=div3></div>
-
-<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");
-
-test(function() {
- computedStyle1 = getComputedStyle(div1);
- computedStyle2 = getComputedStyle(div2);
- assert_equals(computedStyle1.getPropertyValue('--length'), ' 5px');
- assert_equals(computedStyle1.getPropertyValue('--color'), ' notacolor');
- assert_equals(computedStyle2.getPropertyValue('--length'), '');
- assert_equals(computedStyle2.getPropertyValue('--color'), ' pink');
-
- CSS.registerProperty({name: '--length', syntax: '<length>', initialValue: '10px'});
- CSS.registerProperty({name: '--color', syntax: '<color>', initialValue: 'red'});
- assert_equals(computedStyle1.getPropertyValue('--length'), '5px');
- assert_equals(computedStyle1.getPropertyValue('--color'), 'red');
- assert_equals(computedStyle2.getPropertyValue('--length'), '10px');
- assert_equals(computedStyle2.getPropertyValue('--color'), 'pink');
-
- CSS.unregisterProperty('--length');
- CSS.unregisterProperty('--color');
- assert_equals(computedStyle1.getPropertyValue('--length'), ' 5px');
- assert_equals(computedStyle1.getPropertyValue('--color'), ' notacolor');
- assert_equals(computedStyle2.getPropertyValue('--length'), '');
- assert_equals(computedStyle2.getPropertyValue('--color'), ' pink');
-}, "Unregistration correctly updates computed style");
-
-test(function() {
- computedStyle = getComputedStyle(div3);
- assert_equals(computedStyle.getPropertyValue('--x'), '');
-
- CSS.registerProperty({name: '--x', syntax: '<length>', initialValue: '10px'});
- assert_equals(computedStyle.getPropertyValue('--x'), '10px');
-
- CSS.unregisterProperty('--x');
- assert_equals(computedStyle.getPropertyValue('--x'), '');
-
- CSS.registerProperty({name: '--x', syntax: '<color>', initialValue: 'purple'});
- div3.style.setProperty('--x', '5px');
- assert_equals(computedStyle.getPropertyValue('--x'), 'purple');
-}, "Property can be re-registered with different type");
-</script>

Powered by Google App Engine
This is Rietveld 408576698