Title: [136413] trunk/LayoutTests
Revision
136413
Author
[email protected]
Date
2012-12-03 10:42:51 -0800 (Mon, 03 Dec 2012)

Log Message

[style scoped]: style scoped needs more tests.
https://bugs.webkit.org/show_bug.cgi?id=99821

Reviewed by Dimitri Glazkov.

Test cases in this patch validate dynamically creating, moving and
removing a scoped style works well.

* fast/css/style-scoped/style-scoped-with-dom-operation-expected.txt: Added.
* fast/css/style-scoped/style-scoped-with-dom-operation.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (136412 => 136413)


--- trunk/LayoutTests/ChangeLog	2012-12-03 18:23:56 UTC (rev 136412)
+++ trunk/LayoutTests/ChangeLog	2012-12-03 18:42:51 UTC (rev 136413)
@@ -1,3 +1,16 @@
+2012-12-03  Takashi Sakamoto  <[email protected]>
+
+        [style scoped]: style scoped needs more tests.
+        https://bugs.webkit.org/show_bug.cgi?id=99821
+
+        Reviewed by Dimitri Glazkov.
+
+        Test cases in this patch validate dynamically creating, moving and
+        removing a scoped style works well.
+
+        * fast/css/style-scoped/style-scoped-with-dom-operation-expected.txt: Added.
+        * fast/css/style-scoped/style-scoped-with-dom-operation.html: Added.
+
 2012-12-03  Anton Vayvod  <[email protected]>
 
         Text Autosizing: don't autosize horizontal menu items implemented via floating list items

Added: trunk/LayoutTests/fast/css/style-scoped/style-scoped-with-dom-operation-expected.txt (0 => 136413)


--- trunk/LayoutTests/fast/css/style-scoped/style-scoped-with-dom-operation-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/style-scoped/style-scoped-with-dom-operation-expected.txt	2012-12-03 18:42:51 UTC (rev 136413)
@@ -0,0 +1,19 @@
+Tests that <style scoped> is correctly applied after DOM operations, i.e. insertBefore, appendChild, and removeChild.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Insert a new scoped style before an existing scoped style.
+PASS window.getComputedStyle(target).backgroundColor is "rgb(255, 0, 0)"
+Move an inserted scoped style after an existing scoped style.
+PASS window.getComputedStyle(target).backgroundColor is "rgb(0, 0, 255)"
+Move an inserted scoped style into grandparent of an existing scoped style.
+PASS window.getComputedStyle(target).backgroundColor is "rgb(255, 0, 0)"
+Remove an inserted scoped style.
+PASS window.getComputedStyle(target).backgroundColor is "rgb(255, 0, 0)"
+Remove an existing scoped style.
+PASS window.getComputedStyle(target).backgroundColor is "rgb(0, 128, 0)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Hello, World!

Added: trunk/LayoutTests/fast/css/style-scoped/style-scoped-with-dom-operation.html (0 => 136413)


--- trunk/LayoutTests/fast/css/style-scoped/style-scoped-with-dom-operation.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/style-scoped/style-scoped-with-dom-operation.html	2012-12-03 18:42:51 UTC (rev 136413)
@@ -0,0 +1,53 @@
+<!doctype html>
+<html>
+<head>
+<style>
+span {
+    background-color: green;     
+}
+</style>
+<script src=""
+</head>
+<body>
+  <div>
+    <div>
+      <style id="existingStyle" scoped>
+	.target { background-color: red; }
+      </style>
+      <span id="target" class="target">Hello, World!</span>
+    </div>
+  </div>
+</body>
+<script>
+description("Tests that &lt;style scoped&gt; is correctly applied after DOM operations, i.e. insertBefore, appendChild, and removeChild.");
+
+var target = document.getElementById('target');
+
+var existingStyle = document.getElementById('existingStyle');
+var newStyle = document.createElement('style');
+
+newStyle.setAttribute('scoped', 'scoped');
+newStyle.innerHTML = ".target { background-color: blue; }";
+
+debug("Insert a new scoped style before an existing scoped style.");
+existingStyle.parentNode.insertBefore(newStyle, existingStyle);
+shouldBe("window.getComputedStyle(target).backgroundColor", '"rgb(255, 0, 0)"');
+
+debug("Move an inserted scoped style after an existing scoped style.");
+existingStyle.parentNode.appendChild(newStyle);
+shouldBe("window.getComputedStyle(target).backgroundColor", '"rgb(0, 0, 255)"');
+
+debug("Move an inserted scoped style into grandparent of an existing scoped style.");
+document.body.children[0].appendChild(newStyle);
+shouldBe("window.getComputedStyle(target).backgroundColor", '"rgb(255, 0, 0)"');
+
+debug("Remove an inserted scoped style.");
+newStyle.parentNode.removeChild(newStyle);
+shouldBe("window.getComputedStyle(target).backgroundColor", '"rgb(255, 0, 0)"');
+
+debug("Remove an existing scoped style.");
+existingStyle.parentNode.removeChild(existingStyle);
+shouldBe("window.getComputedStyle(target).backgroundColor", '"rgb(0, 128, 0)"');
+</script>
+<script src=""
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to