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

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

Issue 1874623002: Implement iterable<DOMString, (StyleValue or sequence<StyleValue>)> for InlineStylePropertyMap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@computed-stylepropertymap-2
Patch Set: Address review comments 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_iterationWithModification.html
diff --git a/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/inlineStylePropertyMap_iterationWithModification.html b/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/inlineStylePropertyMap_iterationWithModification.html
new file mode 100644
index 0000000000000000000000000000000000000000..19289bb018d220ce3672a8e0bd0c9fb7ac19ca28
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/inlineStylePropertyMap_iterationWithModification.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+
+<div id="testElement"></div>
+
+<script>
+
+test(function() {
+ testElement.style = "width: 60px; border-left-width: 30px;";
+
+ var iterator = testElement.styleMap.entries();
+ var entry = iterator.next();
+ assert_equals(entry.value[0], 'width');
+ assert_true(entry.value[1] instanceof SimpleLength);
+ assert_equals(entry.value[1].cssString, '60px');
+
+ // This shouldn't appear in the iterator.
+ testElement.style.borderTopWidth = '10px';
+
+ entry = iterator.next();
+ assert_equals(entry.value[0], 'border-left-width');
+ assert_true(entry.value[1] instanceof SimpleLength);
+ assert_equals(entry.value[1].cssString, '30px');
+
+ assert_true(iterator.next().done);
+}, 'Adding a property while iterating over entries() doesn\'t affect iterator');
Timothy Loh 2016/05/13 04:57:45 use a double-quoted string here and elsewhere to a
meade_UTC10 2016/05/13 05:46:34 Done.
+
+test(function() {
+ testElement.style = "width: 60px; border-left-width: 30px;";
+
+ var iterator = testElement.styleMap.values();
+ var entry = iterator.next();
+ assert_true(entry.value instanceof SimpleLength);
+ assert_equals(entry.value.cssString, '60px');
+
+ // This shouldn't appear in the iterator.
+ testElement.style.borderTopWidth = '10px';
+
+ entry = iterator.next();
+ assert_true(entry.value instanceof SimpleLength);
+ assert_equals(entry.value.cssString, '30px');
+
+ assert_true(iterator.next().done);
+}, 'Adding a property while iterating over values() doesn\'t affect current iterator');
+
+test(function() {
+ testElement.style = "width: 60px; border-left-width: 30px;";
+
+ var iterator = testElement.styleMap.keys();
+ var entry = iterator.next();
+ assert_equals(entry.value, 'width');
+
+ // This shouldn't appear in the iterator.
+ testElement.style.borderTopWidth = '10px';
+
+ entry = iterator.next();
+ assert_equals(entry.value, 'border-left-width');
+
+ assert_true(iterator.next().done);
+}, 'Adding a property while iterating over keys() doesn\'t affect iterator');
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698