Commit 5223c5c8 authored by Hugo Holgersson's avatar Hugo Holgersson Committed by Commit Bot

Snav: Convert snav-only-clipped-overflow-content.html to snav-testharness.js

Let's also assert focus movements to the other focusables. Previously,
the only thing this test tested was that DOWN would _not_ move focus...

Once we've fixed Issue 801162, this test's expectations will change:
We want spatnav to first _focus_ the scroller (before scrolling it).

Bug: 803086, 801162
Change-Id: I5c8a964c2900fb3a550a55ba9a975c7a33ef42dd
Reviewed-on: https://chromium-review.googlesource.com/c/1257832
Commit-Queue: Hugo Holgersson <hugoh@vewd.com>
Reviewed-by: default avatarFredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#596527}
parent 2aba1b0d
That is is a normal link.
This is a scrollable Div created with the CSS property overflow.
... and here we have a clipped overflow link.
And this is another normal link_2.
PASS successfullyParsed is true
TEST COMPLETE
PASS gFocusedDocument.activeElement.getAttribute("id") is "start"
PASS true is true
<html> <!DOCTYPE html>
<!-- <style>
This test ensures the content overflow traversal correctness of spatial navigation: div#scroller {
if an element if clipped overflow in a scrollable container (e.g. <div>), height: 200px;
scroll-in-direction should happen in the container box, not on the outer view. width: 300px;
overflow: auto;
* Pre-conditions: border: 1px solid #666;
1) DRT support for spatial navigation enable/disable. background-color: #ccc;
padding: 8px;
* Navigation steps: }
1) Loads this page, focus goes to "start" automatically. </style>
2) Try to move focus down to the visible focusable element in
scrollable div. <p>That is is a normal <a id="start" href="a">link</a>.</p>
<div id="scroller">
* Expected results: There should have to a scroll action in the container <a style="display: block; margin-top: 200px;" id="a1" href="a">A clipped link.</a>
(div) as an attempt to make the clipped overflow node visible and accessible </div>
via spatial navigation. --> <p>And this is another normal <a id="a2" href="a">link</a>.</p>
<head>
<style type="text/css"> <p>Scroll until the scroller is fully scrolĺed. Focus revealed links on the way down.</p>
div.scroll {
height: 200px; <script src="../../resources/testharness.js"></script>
width: 300px; <script src="../../resources/testharnessreport.js"></script>
overflow: auto; <script src="resources/snav-testharness.js"></script>
border: 1px solid #666; <script>
background-color: #ccc; var resultMap = [
padding: 8px; ["Down", "start"],
} ["Down", "a1"],
</style> ["Down", "a1"], // The div has padding so it can be scrolled a little further.
["Down", "a2"],
<script src="../../resources/js-test.js"></script> ];
<script src="resources/spatial-navigation-utils.js"></script> snav.assertFocusMoves(resultMap);
<script type="application/javascript"> </script>
var resultMap = [
["Down", "start"],
["DONE", "DONE"]
];
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);
testRunner.overridePreference("WebKitSpatialNavigationEnabled", 1);
testRunner.waitUntilDone();
}
function runTest()
{
// starting the test itself: get to a known place.
document.getElementById("start").focus();
initTest(resultMap, testCompleted);
}
function testCompleted()
{
shouldBeTrue(String(document.getElementById("div").scrollTop != 0));
if (window.testRunner)
testRunner.notifyDone();
}
window.onload = runTest;
</script>
</head>
<body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
<p>That is is a normal <a id="start" href="a">link</a>.</p>
<div class="scroll" id="div">
<p>This is a scrollable Div created with the CSS property overflow.</p>
<br><br><br><br><br><br><br><br>
<p> ... and here we have a clipped overflow <a id="1" href="a">link</a>.</p>
</div>
<p>And this is another normal <a id="2" href="a">link_2</a>.</p>
<div id="console"></div>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment