Commit cf158e84 authored by JunHo Seo's avatar JunHo Seo Committed by Commit Bot

Snav: Convert some legacy js-tests to testharness - 2

Convert list:
snav-display-contents-crash
snav-div-in-anchor
snav-fully-aligned-horizontally
snav-fully-aligned-vertically
snav-hidden-focusable-element
snav-imagemap-area-not-focusable
snav-imagemap-area-without-image
snav-imagemap-overlapped-areas
snav-imagemap-simple
snav-media-elements

Bug: 803086

Change-Id: Iebe20bba5868fec1e1c38f2a188346432c42d568
Reviewed-on: https://chromium-review.googlesource.com/1184945Reviewed-by: default avatarHugo Holgersson <hugoh@vewd.com>
Commit-Queue: JunHo Seo <junho0924.seo@lge.com>
Cr-Commit-Position: refs/heads/master@{#585694}
parent 041042ec
<div style="display: contents"><a href="#"></a></div>
Shouldn't crash.
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
testRunner.dumpAsText();
testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);
testRunner.overridePreference("WebKitSpatialNavigationEnabled", 1);
function runTest() {
test(() => {
assert_true(!!window.testRunner);
testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);
testRunner.overridePreference("WebKitSpatialNavigationEnabled", 1);
eventSender.keyDown("ArrowLeft");
}
window.onload = runTest;
}, "No crash or assertion failure");
</script>
DivInLinkA
DivInLinkB
PASS successfullyParsed is true
TEST COMPLETE
PASS gFocusedDocument.activeElement.getAttribute("id") is "e1"
This test is testing that we can navigate on links with divs inside.
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="resources/spatial-navigation-utils.js"></script>
<script type="application/javascript">
<a href="#" id="start"><div>DivInLinkA</div></a>
<a href="#" id="e1"><div>DivInLinkB</div></a>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/snav-testharness.js"></script>
<script>
var resultMap = [
["Down", "e1"],
["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.
// Start at a known place.
document.getElementById("start").focus();
initTest(resultMap, testCompleted);
}
function testCompleted()
{
if (window.testRunner)
testRunner.notifyDone();
}
window.onload = runTest;
</script>
</head>
<body id="some-content" xmlns="http://www.w3.org/1999/xhtml" style="padding:20px">
<a href="#" id="start"><div>DivInLinkA</div></a>
<a href="#" id="e1"><div>DivInLinkB</div></a>
<div id="console"></div>
This test is testing that we can navigate on links with divs inside.
</body>
</html>
snav.assertFocusMoves(resultMap);
</script>
test
H                               ow Now Brown Cow
Ho                                w Now Brown Cow
How                                 Now Brown Cow
How N                                ow Brown Cow
How No                                w Brown Cow
How Now                                 Brown Cow
How Now B                                rown Cow
How Now Br                                own Cow
How Now Bro                                wn Cow
How Now Brow                                n Cow
How Now Brown                                 Cow
How Now Brown C                                ow
How Now Brown Co                                w
How Now Brown Cow
test
PASS successfullyParsed is true
TEST COMPLETE
PASS gFocusedDocument.activeElement.getAttribute("id") is "1"
PASS gFocusedDocument.activeElement.getAttribute("id") is "2"
PASS gFocusedDocument.activeElement.getAttribute("id") is "4"
PASS gFocusedDocument.activeElement.getAttribute("id") is "3"
PASS gFocusedDocument.activeElement.getAttribute("id") is "5"
PASS gFocusedDocument.activeElement.getAttribute("id") is "6"
PASS gFocusedDocument.activeElement.getAttribute("id") is "8"
PASS gFocusedDocument.activeElement.getAttribute("id") is "7"
PASS gFocusedDocument.activeElement.getAttribute("id") is "9"
PASS gFocusedDocument.activeElement.getAttribute("id") is "10"
PASS gFocusedDocument.activeElement.getAttribute("id") is "12"
PASS gFocusedDocument.activeElement.getAttribute("id") is "11"
PASS gFocusedDocument.activeElement.getAttribute("id") is "13"
PASS gFocusedDocument.activeElement.getAttribute("id") is "14"
PASS gFocusedDocument.activeElement.getAttribute("id") is "16"
PASS gFocusedDocument.activeElement.getAttribute("id") is "15"
PASS gFocusedDocument.activeElement.getAttribute("id") is "17"
PASS gFocusedDocument.activeElement.getAttribute("id") is "18"
PASS gFocusedDocument.activeElement.getAttribute("id") is "20"
PASS gFocusedDocument.activeElement.getAttribute("id") is "19"
PASS gFocusedDocument.activeElement.getAttribute("id") is "21"
PASS gFocusedDocument.activeElement.getAttribute("id") is "22"
PASS gFocusedDocument.activeElement.getAttribute("id") is "24"
PASS gFocusedDocument.activeElement.getAttribute("id") is "23"
PASS gFocusedDocument.activeElement.getAttribute("id") is "25"
PASS gFocusedDocument.activeElement.getAttribute("id") is "26"
PASS gFocusedDocument.activeElement.getAttribute("id") is "27"
PASS gFocusedDocument.activeElement.getAttribute("id") is "end"
<html>
<!--
This test ensures the correctness of the "Fully aligned" precedence
logic implemented by Spatial Navigation algorithm in an horizontal direction:
targets whose middle falls between the top and bottom of the current focused
element are preferably to move focus to, even if it is not the shortest distance.
* Pre-conditions:
1) DRT support for SNav enable/disable.
* Navigation steps:
1) Loads this page, focus goes to "start" automatically.
2) Focus moves preferably to elements right up or above the
current focused element, even when there are some other closer
but not vertically aligned elements in the same direction.
-->
<head>
<script src="../../resources/js-test.js"></script>
<script src="resources/spatial-navigation-utils.js"></script>
<script type="application/javascript">
<a id="start" href="a">test<br></a>
<a id="1" href="a">H</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<a id="2" href="p">ow Now Brown Cow</a><br>
<a id="3" href="a">Ho</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <a id="4" href="p">w Now Brown Cow</a><br>
<a id="5" href="a">How</a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a id="6" href="p">Now Brown Cow</a><br>
<a id="7" href="a">How N</a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; <a id="8" href="p">ow Brown Cow</a><br>
<a id="9" href="a">How No</a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <a id="10" href="p">w Brown Cow</a><br>
<a id="11" href="a">How Now </a>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <a id="12" href="p">Brown Cow</a><br>
<a id="13" href="a">How Now B</a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <a id="14" href="p">rown Cow</a><br>
<a id="15" href="a">How Now Br</a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <a id="16" href="p">own Cow</a><br>
<a id="17" href="a">How Now Bro</a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <a id="18" href="p">wn Cow</a><br>
<a id="19" href="a">How Now Brow</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a id="20" href="p">n Cow</a><br>
<a id="21" href="a">How Now Brown</a> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; <a id="22" href="p">Cow</a><br>
<a id="23" href="a">How Now Brown C</a> &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <a id="24" href="p">ow</a><br>
<a id="25" href="a">How Now Brown Co</a> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <a id="26" href="p">w</a><br>
<a id="27" href="a">How Now Brown Cow</a><br><br>
<a id="end" href="a">test<br></a>
<p>This test ensures the correctness of the "Fully aligned" precedence logic implemented by Spatial Navigation algorithm in an horizontal direction: targets whose middle falls between the top and bottom of the current focused element are preferably to move focus to, even if it is not the shortest distance.</p>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/snav-testharness.js"></script>
<script>
var resultMap = [
["Down", "1"],
["Right", "2"],
......@@ -48,51 +50,9 @@
["Right", "26"],
["Down", "27"],
["Down", "end"],
["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.
// Start at a known place.
document.getElementById("start").focus();
initTest(resultMap, testCompleted);
}
function testCompleted()
{
if (window.testRunner)
testRunner.notifyDone();
}
window.onload = runTest;
</script>
</head>
<body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
<a id="start" href="a">test<br></a>
<a id="1" href="a">H</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<a id="2" href="p">ow Now Brown Cow</a><br>
<a id="3" href="a">Ho</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <a id="4" href="p">w Now Brown Cow</a><br>
<a id="5" href="a">How</a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a id="6" href="p">Now Brown Cow</a><br>
<a id="7" href="a">How N</a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; <a id="8" href="p">ow Brown Cow</a><br>
<a id="9" href="a">How No</a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <a id="10" href="p">w Brown Cow</a><br>
<a id="11" href="a">How Now </a>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <a id="12" href="p">Brown Cow</a><br>
<a id="13" href="a">How Now B</a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <a id="14" href="p">rown Cow</a><br>
<a id="15" href="a">How Now Br</a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <a id="16" href="p">own Cow</a><br>
<a id="17" href="a">How Now Bro</a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <a id="18" href="p">wn Cow</a><br>
<a id="19" href="a">How Now Brow</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a id="20" href="p">n Cow</a><br>
<a id="21" href="a">How Now Brown</a> &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; <a id="22" href="p">Cow</a><br>
<a id="23" href="a">How Now Brown C</a> &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <a id="24" href="p">ow</a><br>
<a id="25" href="a">How Now Brown Co</a> &nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <a id="26" href="p">w</a><br>
<a id="27" href="a">How Now Brown Cow</a><br><br>
<a id="end" href="a">test<br></a>
<div id="console"></div>
</body>
</html>
snav.assertFocusMoves(resultMap);
</script>
test
test             test
test
test
test
test
test
test
PASS successfullyParsed is true
TEST COMPLETE
PASS gFocusedDocument.activeElement.getAttribute("id") is "4"
PASS gFocusedDocument.activeElement.getAttribute("id") is "6"
PASS gFocusedDocument.activeElement.getAttribute("id") is "7"
PASS gFocusedDocument.activeElement.getAttribute("id") is "end"
PASS gFocusedDocument.activeElement.getAttribute("id") is "8"
PASS gFocusedDocument.activeElement.getAttribute("id") is "6"
<html>
<!--
This test ensures the correctness of the "Fully aligned" precedence
logic implemented by Spatial Navigation algorithm in an vertical direction:
targets whose middle falls between the top and bottom of the current focused
element are preferably to move focus to, even if it is not the shortest distance.
* Pre-conditions:
1) DRT support for SNav enable/disable.
* Navigation steps:
1) Loads this page, focus goes to "start" automatically.
2) Focus moves preferably to elements right up or above the
current focused element, even when there are some other closer
but not vertically aligned elements in the same direction.
-->
<head>
<script src="../../resources/js-test.js"></script>
<script src="resources/spatial-navigation-utils.js"></script>
<script type="application/javascript">
var resultMap = [
["Down", "4"],
["Down", "6"],
["Down", "7"],
["Down", "end"],
["Up", "8"],
["Up", "6"],
["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()
{
if (window.testRunner)
testRunner.notifyDone();
}
window.onload = runTest;
</script>
</head>
<body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
<div style="margin-left: 40px; text-align: left;">
<div style="margin-left: 40px; text-align: left;">
<div style="margin-left: 40px;">
<a id="start" href="a">test<br></a>
</div>
......@@ -74,8 +18,24 @@
<a id="8" href="a">test<br></a>
</div>
<a id="end" href="a">test<br></a>
</div>
<div id="console"></div>
</body>
</html>
</div>
<p>This test ensures the correctness of the "Fully aligned" precedence logic implemented by Spatial Navigation algorithm in an vertical direction: targets whose middle falls between the top and bottom of the current focused element are preferably to move focus to, even if it is not the shortest distance.</p>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/snav-testharness.js"></script>
<script>
var resultMap = [
["Down", "4"],
["Down", "6"],
["Down", "7"],
["Down", "end"],
["Up", "8"],
["Up", "6"],
];
// Start at a known place.
document.getElementById("start").focus();
snav.assertFocusMoves(resultMap);
</script>
This is link_1.
This is hidden link.
This is link_2.
PASS successfullyParsed is true
TEST COMPLETE
PASS gFocusedDocument.activeElement.getAttribute("id") is "end"
This test is to test that focusable elements with display:none do not grab the focus.
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="resources/spatial-navigation-utils.js"></script>
<script type="application/javascript">
<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>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/snav-testharness.js"></script>
<script>
var resultMap = [
["Down", "end"],
["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.
// Start at a known place.
document.getElementById("start").focus();
initTest(resultMap, testCompleted);
}
function testCompleted()
{
if (window.testRunner)
testRunner.notifyDone();
}
window.onload = runTest;
</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>
snav.assertFocusMoves(resultMap);
</script>
PASS successfullyParsed is true
TEST COMPLETE
PASS gFocusedDocument.activeElement.getAttribute("id") is "1"
PASS gFocusedDocument.activeElement.getAttribute("id") is "3"
PASS gFocusedDocument.activeElement.getAttribute("id") is "1"
PASS gFocusedDocument.activeElement.getAttribute("id") is "start"
This test tests that areas of an imagemap without an href are not focusable, thus can not be reached with spatial navigation.
<html>
<head>
<map name="map" title="map" id="firstmap">
<area shape="rect" coords="20,20,70,70" href="#" id="1">
<area shape="rect" coords="20,130,70,180" id="2">
</map>
<a id="start" href="a"><img src="resources/green.png" width=50px height=50px></a>
<div>
<img src="resources/green.png" width=200px height=200px usemap="#map"><a id="6" href="a"><img src="resources/green.png" width=50px height=50px></a>
</div>
<a id="3" href="a"><img src="resources/green.png" width=50px height=50px></a>
<script src="../../resources/js-test.js"></script>
<script src="resources/spatial-navigation-utils.js"></script>
<script type="application/javascript">
<p>This test tests that areas of an imagemap without an href are not focusable, thus can not be reached with spatial navigation.</p>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/snav-testharness.js"></script>
<script>
var resultMap = [
["Down", "1"],
["Down", "3"],
["Up", "1"],
["Up", "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.
// Start at a known place.
document.getElementById("start").focus();
initTest(resultMap, testCompleted);
}
function testCompleted()
{
if (window.testRunner)
testRunner.notifyDone();
}
window.onload = runTest;
</script>
</head>
<body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
<map name="map" title="map" id="firstmap">
<area shape="rect" coords="20,20,70,70" href="#" id="1">
<area shape="rect" coords="20,130,70,180" id="2">
</map>
<a id="start" href="a"><img src="resources/green.png" width=50px height=50px></a>
<div>
<img src="resources/green.png" width=200px height=200px usemap="#map"><a id="6" href="a"><img src="resources/green.png" width=50px height=50px></a>
</div>
<a id="3" href="a"><img src="resources/green.png" width=50px height=50px></a>
<div id="console"></div>
<div>This test tests that areas of an imagemap without an href are not focusable, thus can not be reached with spatial navigation.</div>
</body>
</html>
snav.assertFocusMoves(resultMap);
</script>
PASS successfullyParsed is true
TEST COMPLETE
PASS gFocusedDocument.activeElement.getAttribute("id") is "3"
PASS gFocusedDocument.activeElement.getAttribute("id") is "start"
This test tests that areas of an imagemap without an image using it, are not focusable, thus can not be reached with spatial navigation.
<html>
<head>
<map name="map" title="map" id="firstmap">
<area shape="rect" coords="20,20,70,70" href="#" id="1">
<area shape="rect" coords="20,130,70,180" href="#" id="2">
</map>
<a id="start" href="a"><img src="resources/green.png" width=50px height=50px></a>
<div>
<img src="resources/green.png" width=200px height=200px usemap="#othermap"><a id="6" href="a"><img src="resources/green.png" width=50px height=50px></a>
</div>
<a id="3" href="a"><img src="resources/green.png" width=50px height=50px></a>
<script src="../../resources/js-test.js"></script>
<script src="resources/spatial-navigation-utils.js"></script>
<script type="application/javascript">
<p>This test tests that areas of an imagemap without an image using it, are not focusable, thus can not be reached with spatial navigation.</p>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/snav-testharness.js"></script>
<script>
var resultMap = [
["Down", "3"],
["Up", "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.
// Start at a known place.
document.getElementById("start").focus();
initTest(resultMap, testCompleted);
}
function testCompleted()
{
if (window.testRunner)
testRunner.notifyDone();
}
window.onload = runTest;
</script>
</head>
<body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
<map name="map" title="map" id="firstmap">
<area shape="rect" coords="20,20,70,70" href="#" id="1">
<area shape="rect" coords="20,130,70,180" href="#" id="2">
</map>
<a id="start" href="a"><img src="resources/green.png" width=50px height=50px></a>
<div>
<img src="resources/green.png" width=200px height=200px usemap="#othermap"><a id="6" href="a"><img src="resources/green.png" width=50px height=50px></a>
</div>
<a id="3" href="a"><img src="resources/green.png" width=50px height=50px></a>
<div id="console"></div>
<div>This test tests that areas of an imagemap without an image using it, are not focusable, thus can not be reached with spatial navigation.</div>
</body>
</html>
snav.assertFocusMoves(resultMap);
</script>
PASS successfullyParsed is true
TEST COMPLETE
PASS gFocusedDocument.activeElement.getAttribute("id") is "4"
PASS gFocusedDocument.activeElement.getAttribute("id") is "1"
PASS gFocusedDocument.activeElement.getAttribute("id") is "2"
PASS gFocusedDocument.activeElement.getAttribute("id") is "5"
PASS gFocusedDocument.activeElement.getAttribute("id") is "4"
PASS gFocusedDocument.activeElement.getAttribute("id") is "3"
PASS gFocusedDocument.activeElement.getAttribute("id") is "2"
PASS gFocusedDocument.activeElement.getAttribute("id") is "1"
PASS gFocusedDocument.activeElement.getAttribute("id") is "3"
PASS gFocusedDocument.activeElement.getAttribute("id") is "2"
PASS gFocusedDocument.activeElement.getAttribute("id") is "1"
PASS gFocusedDocument.activeElement.getAttribute("id") is "start"
This test tests that areas of an imagemap can be reached with spatial navigation even if they are overlapped.
<html>
<head>
<map name="map" title="map" id="firstmap">
<area shape="circle" coords="45,45,25" href="#" id="1">
<area shape="rect" coords="45,60,95,110" href="#" id="2">
<area shape="poly" coords="80,20,130,20,130,180,30,180,30,130,80,130" href="#" id="3">
<area shape="default" href="#" id="4">
</map>
<a id="start" href="a"><img src="resources/green.png" width=50px height=50px></a>
<div>
<img src="resources/green.png" width=200px height=200px usemap="#map">
</div>
<a id="5" href="a"><img src="resources/green.png" width=50px height=50px></a>
<script src="../../resources/js-test.js"></script>
<script src="resources/spatial-navigation-utils.js"></script>
<script type="application/javascript">
<p>This test tests that areas of an imagemap can be reached with spatial navigation even if they are overlapped.</p>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/snav-testharness.js"></script>
<script>
var resultMap = [
["Down", "4"],
["Down", "1"],
......@@ -18,50 +30,9 @@
["Left", "2"],
["Up", "1"],
["Up", "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.
// Start at a known place.
document.getElementById("start").focus();
initTest(resultMap, testCompleted);
}
function testCompleted()
{
if (window.testRunner)
testRunner.notifyDone();
}
window.onload = runTest;
</script>
</head>
<body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
<map name="map" title="map" id="firstmap">
<area shape="circle" coords="45,45,25" href="#" id="1">
<area shape="rect" coords="45,60,95,110" href="#" id="2">
<area shape="poly" coords="80,20,130,20,130,180,30,180,30,130,80,130" href="#" id="3">
<area shape="default" href="#" id="4">
</map>
<a id="start" href="a"><img src="resources/green.png" width=50px height=50px></a>
<div>
<img src="resources/green.png" width=200px height=200px usemap="#map">
</div>
<a id="5" href="a"><img src="resources/green.png" width=50px height=50px></a>
<div id="console"></div>
<div>This test tests that areas of an imagemap can be reached with spatial navigation even if they are overlapped.</div>
</body>
</html>
snav.assertFocusMoves(resultMap);
</script>
PASS successfullyParsed is true
TEST COMPLETE
PASS gFocusedDocument.activeElement.getAttribute("id") is "1"
PASS gFocusedDocument.activeElement.getAttribute("id") is "3"
PASS gFocusedDocument.activeElement.getAttribute("id") is "5"
PASS gFocusedDocument.activeElement.getAttribute("id") is "3"
PASS gFocusedDocument.activeElement.getAttribute("id") is "4"
PASS gFocusedDocument.activeElement.getAttribute("id") is "6"
PASS gFocusedDocument.activeElement.getAttribute("id") is "4"
PASS gFocusedDocument.activeElement.getAttribute("id") is "2"
PASS gFocusedDocument.activeElement.getAttribute("id") is "1"
PASS gFocusedDocument.activeElement.getAttribute("id") is "start"
This test tests that areas of an imagemap can be reached with spatial navigation.
<html>
<head>
<map name="map" title="map" id="firstmap">
<area shape="rect" coords="20,20,70,70" href="#" id="1">
<area shape="rect" coords="130,20,180,70" href="#" id="2">
<area shape="rect" coords="20,130,70,180" href="#" id="3">
<area shape="rect" coords="130,130,180,180" href="#" id="4">
</map>
<a id="start" href="a"><img src="resources/green.png" width=50px height=50px></a>
<div>
<img src="resources/green.png" width=200px height=200px usemap="#map"><a id="6" href="a"><img src="resources/green.png" width=50px height=50px></a>
</div>
<a id="5" href="a"><img src="resources/green.png" width=50px height=50px></a>
<script src="../../resources/js-test.js"></script>
<script src="resources/spatial-navigation-utils.js"></script>
<script type="application/javascript">
<p>This test tests that areas of an imagemap can be reached with spatial navigation.</p>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/snav-testharness.js"></script>
<script>
var resultMap = [
["Down", "1"],
["Down", "3"],
......@@ -16,50 +28,9 @@
["Up", "2"],
["Left", "1"],
["Up", "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.
// Start at a known place.
document.getElementById("start").focus();
initTest(resultMap, testCompleted);
}
function testCompleted()
{
if (window.testRunner)
testRunner.notifyDone();
}
window.onload = runTest;
</script>
</head>
<body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
<map name="map" title="map" id="firstmap">
<area shape="rect" coords="20,20,70,70" href="#" id="1">
<area shape="rect" coords="130,20,180,70" href="#" id="2">
<area shape="rect" coords="20,130,70,180" href="#" id="3">
<area shape="rect" coords="130,130,180,180" href="#" id="4">
</map>
<a id="start" href="a"><img src="resources/green.png" width=50px height=50px></a>
<div>
<img src="resources/green.png" width=200px height=200px usemap="#map"><a id="6" href="a"><img src="resources/green.png" width=50px height=50px></a>
</div>
<a id="5" href="a"><img src="resources/green.png" width=50px height=50px></a>
<div id="console"></div>
<div>This test tests that areas of an imagemap can be reached with spatial navigation.</div>
</body>
</html>
snav.assertFocusMoves(resultMap);
</script>
This is a link start of Test.
This is a link i2.
This is a link i4.
This is a link i6.
This is a link i8.
This is a link End of Test.
PASS gFocusedDocument.activeElement.getAttribute("id") is "start"
PASS gFocusedDocument.activeElement.getAttribute("id") is "v1"
PASS gFocusedDocument.activeElement.getAttribute("id") is "i2"
PASS gFocusedDocument.activeElement.getAttribute("id") is "v3"
PASS gFocusedDocument.activeElement.getAttribute("id") is "i4"
PASS gFocusedDocument.activeElement.getAttribute("id") is "v5"
PASS gFocusedDocument.activeElement.getAttribute("id") is "i6"
PASS gFocusedDocument.activeElement.getAttribute("id") is "a7"
PASS gFocusedDocument.activeElement.getAttribute("id") is "i8"
PASS gFocusedDocument.activeElement.getAttribute("id") is "end"
PASS gFocusedDocument.activeElement.getAttribute("id") is "i8"
PASS gFocusedDocument.activeElement.getAttribute("id") is "end"
PASS successfullyParsed is true
TEST COMPLETE
This tests that a media elements ie: <Audio> or <video>, without tabindex are able to be reached through keyboard access
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="resources/spatial-navigation-utils.js"></script>
<script type="application/javascript">
<p>This is a link <a id="start" href="a">start of Test</a>.</p>
<video id="v1" controls tabindex="0" src="../../media/content/test.mp4"></video>
<p>This is a link <a id="i2" href="a">i2</a>.</p>
<video id="v3" controls src="../../media/content/test.mp4"></video>
<p>This is a link <a id="i4" href="a">i4</a>.</p>
<video id="v5" tabindex="0" src="../../media/content/test.mp4"></video>
<p>This is a link <a id="i6" href="a">i6</a>.</p>
<audio id="a7" controls src="../../media/content/test.wav"></audio>
<p>This is a link <a id="i8" href="a">i8</a>.</p>
<!-- 'a9' is not focussable: no controls attribute as well no tab index.
Key down from 'i8' should go to 'end'. -->
<audio id="a9" src="../../media/content/test.mp4"></audio>
<p>This is a link <a id="end" href="a">End of Test</a>.</p>
<p>This tests that a media elements ie: <code>&lt;Audio&gt;</code> or <code>&lt;video&gt;</code>, without tabindex are able to be reached through keyboard access</p>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/snav-testharness.js"></script>
<script>
var resultMap = [
["Up", "start"],
["Down", "v1"],
......@@ -18,55 +31,9 @@
["Down", "end"],
["Up", "i8"],
["Down", "end"],
["DONE", "DONE"]
];
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);
testRunner.overridePreference("WebKitSpatialNavigationEnabled", 1);
}
function runTest()
{
// starting the test itself: get to a known place.
// Start at a known place.
document.getElementById("start").focus();
initTest(resultMap, testCompleted);
}
function testCompleted()
{
finishJSTest();
}
window.onload = runTest;
jsTestIsAsync = true;
</script>
</head>
<body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
<p>This is a link <a id="start" href="a">start of Test</a>.</p>
<video id="v1" controls tabindex="0" src="../../media/content/test.mp4"></video>
<p>This is a link <a id="i2" href="a">i2</a>.</p>
<video id="v3" controls src="../../media/content/test.mp4"></video>
<p>This is a link <a id="i4" href="a">i4</a>.</p>
<video id="v5" tabindex="0" src="../../media/content/test.mp4"></video>
<p>This is a link <a id="i6" href="a">i6</a>.</p>
<audio id="a7" controls src="../../media/content/test.wav"></audio>
<p>This is a link <a id="i8" href="a">i8</a>.</p>
<!-- 'a9' is not focussable: no controls attribute as well no tab index.
Key down from 'i8' should go to 'end'. -->
<audio id="a9" src="../../media/content/test.mp4"></audio>
<p>This is a link <a id="end" href="a">End of Test</a>.</p>
<div id="console"></div>
<p>This tests that a media elements ie: <code>&lt;Audio&gt;</code> or <code>&lt;video&gt;</code>, without tabindex are able to be reached through keyboard access</p>
</body>
</html>
snav.assertFocusMoves(resultMap);
</script>
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