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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/Node/contains-method.html

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 years, 11 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/fast/dom/Node/contains-method.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Node/contains-method.html b/third_party/WebKit/LayoutTests/fast/dom/Node/contains-method.html
index abb6ef2da949d2e603230e42f6d019e379206bea..677165bdd55e739774a8ef5109acdd55036211e7 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Node/contains-method.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/Node/contains-method.html
@@ -4,6 +4,42 @@
<script src="../../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/contains-method.js"></script>
+<script>
+description(
+'This test checks behavior of Node.contains. <div id="test1">[test1 <span id="test2">[test 2]</span>]</div>'
+);
+
+var test1 = document.getElementById('test1');
+var test1TextChild = document.getElementById('test1').firstChild;
+var test2 = document.getElementById('test2');
+
+shouldBeEqualToString("typeof document.contains", "function");
+shouldBeTrue("test1.contains(test2)");
+shouldBeTrue("test1.contains(test1TextChild)");
+shouldBeTrue("document.contains(test1)");
+shouldBeTrue("document.contains(test1TextChild)");
+shouldBeTrue("document.contains(document)");
+shouldBeTrue("test1.contains(test1)");
+shouldBeTrue("test1TextChild.contains(test1TextChild)");
+shouldThrow("test1.contains(123)");
+shouldBeFalse("test1.contains(null)");
+
+// Cross document tests
+var iframe = document.createElement("iframe");
+
+shouldBeFalse("document.contains(iframe)"); // Not in document
+shouldBeTrue("iframe.contains(iframe)");
+
+document.body.appendChild(iframe);
+debug('iframe is now in document');
+shouldBeTrue("document.contains(iframe)");
+
+var iframeDoc = iframe.contentDocument;
+var iframeBody = iframeDoc.body;
+
+shouldBeFalse("document.contains(iframeDoc)");
+shouldBeTrue("iframeDoc.contains(iframeBody)");
+shouldBeFalse("document.contains(iframeBody)");
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698