Add a test for queries whose leftmost selector matches the root node
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Nov 2013 08:13:33 +0000 (08:13 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Nov 2013 08:13:33 +0000 (08:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=123877

Reviewed by Andreas Kling.

Merge https://chromium.googlesource.com/chromium/blink/+/22981c70bf93e8a07ee7b4d68a4522aee21b26ce
so that we won't introduce the regression they had.

* fast/selectors/querySelector-leftmost-selector-matches-rootNode-expected.txt: Added.
* fast/selectors/querySelector-leftmost-selector-matches-rootNode.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158731 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/selectors/querySelector-leftmost-selector-matches-rootNode-expected.txt [new file with mode: 0644]
LayoutTests/fast/selectors/querySelector-leftmost-selector-matches-rootNode.html [new file with mode: 0644]

index c7cf106..4203a1c 100644 (file)
@@ -1,5 +1,18 @@
 2013-11-06  Ryosuke Niwa  <rniwa@webkit.org>
 
+        Add a test for queries whose leftmost selector matches the root node
+        https://bugs.webkit.org/show_bug.cgi?id=123877
+
+        Reviewed by Andreas Kling.
+
+        Merge https://chromium.googlesource.com/chromium/blink/+/22981c70bf93e8a07ee7b4d68a4522aee21b26ce
+        so that we won't introduce the regression they had.
+
+        * fast/selectors/querySelector-leftmost-selector-matches-rootNode-expected.txt: Added.
+        * fast/selectors/querySelector-leftmost-selector-matches-rootNode.html: Added.
+
+2013-11-06  Ryosuke Niwa  <rniwa@webkit.org>
+
         Assertion failure end < m_runCount in WebCore::BidiRunList<WebCore::BidiRun>::reverseRuns
         https://bugs.webkit.org/show_bug.cgi?id=123863
 
diff --git a/LayoutTests/fast/selectors/querySelector-leftmost-selector-matches-rootNode-expected.txt b/LayoutTests/fast/selectors/querySelector-leftmost-selector-matches-rootNode-expected.txt
new file mode 100644 (file)
index 0000000..5f53f06
--- /dev/null
@@ -0,0 +1,18 @@
+Test queries whose leftmost selector matches the root node.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.body.querySelectorAll('#target > div').length is 6
+PASS document.body.querySelectorAll('#target').length is 0
+PASS document.body.querySelectorAll('.target > div').length is 6
+PASS document.body.querySelectorAll('.target').length is 0
+PASS document.body.querySelectorAll('body > div').length is 6
+PASS document.body.querySelectorAll('body').length is 0
+PASS document.body.querySelector('#target') is null
+PASS document.body.querySelector('.target') is null
+PASS document.body.querySelector('body') is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/selectors/querySelector-leftmost-selector-matches-rootNode.html b/LayoutTests/fast/selectors/querySelector-leftmost-selector-matches-rootNode.html
new file mode 100644 (file)
index 0000000..3e0781f
--- /dev/null
@@ -0,0 +1,28 @@
+<!doctype html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body id="target" class="target">
+  <div></div>
+  <div></div>
+  <div></div>
+  <div></div>
+  <div></div>
+  <div></div>
+  <pre id='console'></pre>
+</body>
+<script>
+description('Test queries whose leftmost selector matches the root node.');
+shouldBe("document.body.querySelectorAll('#target > div').length", "6");
+shouldBe("document.body.querySelectorAll('#target').length", "0");
+shouldBe("document.body.querySelectorAll('.target > div').length", "6");
+shouldBe("document.body.querySelectorAll('.target').length", "0");
+shouldBe("document.body.querySelectorAll('body > div').length", "6");
+shouldBe("document.body.querySelectorAll('body').length", "0");
+shouldBeNull("document.body.querySelector('#target')");
+shouldBeNull("document.body.querySelector('.target')");
+shouldBeNull("document.body.querySelector('body')");
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</html>