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

Unified Diff: third_party/WebKit/LayoutTests/typedcssom/inlinestyle/inlineStylePropertyMap_delete.html

Issue 1590193002: Partial implementation of inline StylePropertyMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@maps
Patch Set: Created 4 years, 8 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/typedcssom/inlinestyle/inlineStylePropertyMap_delete.html
diff --git a/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/inlineStylePropertyMap_delete.html b/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/inlineStylePropertyMap_delete.html
new file mode 100644
index 0000000000000000000000000000000000000000..9c15a843e93b93ad734e87c78410500fa9e84003
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/inlineStylePropertyMap_delete.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+
+<div id="testElement"></div>
+
+<script>
+
+// Delete
+test(function() {
+ testElement.style.width = '80px';
+ assert_equals(testElement.styleMap.get('width').cssString, '80px');
+
+ testElement.styleMap.delete('width');
+ assert_equals(testElement.styleMap.get('width'), null);
+ assert_equals(testElement.style.width, '');
+}, "delete() removes the value from the property when set in element.style");
+
+test(function() {
+ testElement.styleMap.set('width', new SimpleLength(100, 'px'));
+ assert_equals(testElement.styleMap.get('width').cssString, '100px');
+
+ testElement.styleMap.delete('width');
+ assert_equals(testElement.styleMap.get('width'), null);
+ assert_equals(testElement.style.width, '');
+}, "delete() removes the value from the property when set in element.styleMap");
+
+test(function() {
+ testElement.style.width = '90px';
+ assert_equals(testElement.styleMap.get('width').cssString, '90px');
+
+ testElement.styleMap.delete('WIdtH');
+ assert_equals(testElement.styleMap.get('width'), null);
+ assert_equals(testElement.style.width, '');
+}, "delete() works when mixed case is used for the property name");
+
+test(function() {
+ assert_equals(testElement.styleMap.get('height'), null);
+ testElement.styleMap.delete('height');
+ assert_equals(testElement.styleMap.get('height'), null);
+}, "delete() does nothing if the property isn't set");
+
+test(function() {
+ assert_throws(new TypeError(), function() {
+ testElement.styleMap.delete('lemons');
+ });
+}, "Attempting to delete an invalid property throws");
+
+// TODO(meade): Test deleting a property containing multiple values once that has been implemented.
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698