2010-12-09 Yael Aharon <yael.aharon@nokia.com>
authoryael.aharon@nokia.com <yael.aharon@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Dec 2010 16:22:26 +0000 (16:22 +0000)
committeryael.aharon@nokia.com <yael.aharon@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Dec 2010 16:22:26 +0000 (16:22 +0000)
        Reviewed by Antonio Gomes.

        Spatial Navigation: more tests.
        https://bugs.webkit.org/show_bug.cgi?id=50728

        * fast/spatial-navigation/snav-hidden-focusable-element-expected.txt: Added.
        * fast/spatial-navigation/snav-hidden-focusable-element.html: Added.
        * fast/spatial-navigation/snav-hidden-iframe-expected.txt: Added.
        * fast/spatial-navigation/snav-hidden-iframe.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/spatial-navigation/snav-hidden-focusable-element-expected.txt [new file with mode: 0644]
LayoutTests/fast/spatial-navigation/snav-hidden-focusable-element.html [new file with mode: 0644]
LayoutTests/fast/spatial-navigation/snav-hidden-iframe-expected.txt [new file with mode: 0644]
LayoutTests/fast/spatial-navigation/snav-hidden-iframe.html [new file with mode: 0644]

index 17e278d..00407d0 100644 (file)
@@ -1,3 +1,15 @@
+2010-12-09  Yael Aharon  <yael.aharon@nokia.com>
+
+        Reviewed by Antonio Gomes.
+
+        Spatial Navigation: more tests.
+        https://bugs.webkit.org/show_bug.cgi?id=50728
+
+        * fast/spatial-navigation/snav-hidden-focusable-element-expected.txt: Added.
+        * fast/spatial-navigation/snav-hidden-focusable-element.html: Added.
+        * fast/spatial-navigation/snav-hidden-iframe-expected.txt: Added.
+        * fast/spatial-navigation/snav-hidden-iframe.html: Added.
+
 2010-12-09  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         Unreviewed.
diff --git a/LayoutTests/fast/spatial-navigation/snav-hidden-focusable-element-expected.txt b/LayoutTests/fast/spatial-navigation/snav-hidden-focusable-element-expected.txt
new file mode 100644 (file)
index 0000000..bf34a44
--- /dev/null
@@ -0,0 +1,8 @@
+This is link_1.
+
+
+This is hidden link.
+This is link_2.
+
+PASS gFocusedDocument.activeElement.getAttribute("id") is "end"
+This test is to test that focusable elements with display:none do not grab the focus.
diff --git a/LayoutTests/fast/spatial-navigation/snav-hidden-focusable-element.html b/LayoutTests/fast/spatial-navigation/snav-hidden-focusable-element.html
new file mode 100644 (file)
index 0000000..b4b3e28
--- /dev/null
@@ -0,0 +1,46 @@
+<html>
+  <head>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/spatial-navigation-utils.js"></script>
+    <script type="application/javascript">
+
+    var resultMap = [
+      ["Down", "end"],
+      ["DONE", "DONE"]
+    ];
+
+    if (window.layoutTestController) {
+      layoutTestController.dumpAsText();
+      layoutTestController.setSpatialNavigationEnabled(true);
+      layoutTestController.overridePreference("WebKitTabToLinksPreferenceKey", 1);
+      layoutTestController.waitUntilDone();
+    }
+
+    function runTest()
+    {
+      // starting the test itself: get to a known place.
+      document.getElementById("start").focus();
+
+      initTest(resultMap, testCompleted);
+    }
+
+    function testCompleted()
+    {
+      if (window.layoutTestController)
+        layoutTestController.notifyDone();
+    }
+
+    window.onload = runTest;
+
+    </script>
+    <script src="js/resources/js-test-post.js"></script>
+  </head>
+
+  <body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
+      <p>This is <a id="start" href="a">link_1</a>.</p>
+      <br>This is <a id="1" style="display:none;" href="a">you should not see me</a> hidden link.<br>
+      <p>This is <a id="end" href="a">link_2</a>.</p>
+    <div id="console"></div>
+    <p>This test is to test that focusable elements with display:none do not grab the focus.</p>
+  </body>
+</html>
diff --git a/LayoutTests/fast/spatial-navigation/snav-hidden-iframe-expected.txt b/LayoutTests/fast/spatial-navigation/snav-hidden-iframe-expected.txt
new file mode 100644 (file)
index 0000000..e14b471
--- /dev/null
@@ -0,0 +1,9 @@
+This is link_1.
+
+
+This is 
+hidden iframe.
+This is link_2.
+
+PASS gFocusedDocument.activeElement.getAttribute("id") is "end"
+This test is to test that iframe with display:none does not get focus, and neither do its descendants
diff --git a/LayoutTests/fast/spatial-navigation/snav-hidden-iframe.html b/LayoutTests/fast/spatial-navigation/snav-hidden-iframe.html
new file mode 100644 (file)
index 0000000..492a196
--- /dev/null
@@ -0,0 +1,52 @@
+<html>
+  <head>
+    <script src="../js/resources/js-test-pre.js"></script>
+    <script src="resources/spatial-navigation-utils.js"></script>
+    <script type="application/javascript">
+
+    var resultMap = [
+      ["Down", "end"],
+      ["DONE", "DONE"]
+    ];
+
+    if (window.layoutTestController) {
+      layoutTestController.dumpAsText();
+      layoutTestController.setSpatialNavigationEnabled(true);
+      layoutTestController.overridePreference("WebKitTabToLinksPreferenceKey", 1);
+      layoutTestController.waitUntilDone();
+    }
+
+    function runTest()
+    {
+      // starting the test itself: get to a known place.
+      document.getElementById("start").focus();
+
+      initTest(resultMap, testCompleted);
+    }
+
+    function testCompleted()
+    {
+      if (window.layoutTestController)
+        layoutTestController.notifyDone();
+    }
+
+    window.onload = runTest;
+
+    </script>
+    <script src="js/resources/js-test-post.js"></script>
+  </head>
+
+  <body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
+      <p>This is <a id="start" href="a">link_1</a>.</p>
+      <br>This is <iframe id="1" width=100 height=100 style="display:none"  src="data:text/html,
+        <body>
+          <a id='11' href='http://a'>b</a>
+          <a id='12' href='http://a'>c</a>
+          <a id='13' href='http://a'>d</a>
+        </body>
+        "></iframe><br> hidden iframe.<br>
+      <p>This is <a id="end" href="a">link_2</a>.</p>
+    <div id="console"></div>
+    <p>This test is to test that iframe with display:none does not get focus, and neither do its descendants</p>
+  </body>
+</html>