Skip to content

Commit bac0802

Browse files
author
Jihye Hong
committed
Add the test case for a transformed element
Test case about the heuristic spatial navigation behavior for a transformed element.
1 parent b461388 commit bac0802

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!doctype html>
2+
<meta charset="utf-8">
3+
<title>Spatnav sanity check</title>
4+
<link rel="author" title="Jihye Hong" href="jh.hong@lge.com">
5+
<meta name=flags content="">
6+
<link rel=help href="https://wicg.github.io/spatial-navigation/#high-level-api">
7+
8+
<script src="../resources/testharness.js"></script>
9+
<script src="../resources/testharnessreport.js"></script>
10+
11+
<!--load polyfill. To be removed before submitting to WPT-->
12+
<script src="../polyfill/spatnav-heuristic.js"></script>
13+
14+
<style>
15+
:focus {
16+
outline: 4px #3582ff solid;
17+
}
18+
19+
.container {
20+
margin: 10px;
21+
position: relative;
22+
border: 1px solid black;
23+
width: 500px;
24+
height: 300px;
25+
}
26+
27+
.box {
28+
position: absolute;
29+
box-sizing: border-box;
30+
width: 50px;
31+
height: 50px;
32+
border: 1px black solid;
33+
background: #6ac;
34+
}
35+
36+
#initial_focus {
37+
background: #F08080;
38+
}
39+
40+
</style>
41+
42+
<body>
43+
<div class="container">
44+
<div tabindex="0" class="box" id="initial_focus" style="width: 300px; left: 50px; top: 50px;"></div>
45+
<div tabindex="0" class="box" style="left: 50px; top: 140px;"></div>
46+
<div tabindex="0" class="box" id="down_focus" style="transform: rotateZ(-30deg); left: 200px; top: 140px;"></div>
47+
</div>
48+
</body>
49+
50+
<script>
51+
test(function() {
52+
document.getElementById("initial_focus").focus();
53+
window.navigate("down");
54+
assert_equals(document.activeElement.id, "down_focus");
55+
}, "Move focus down from the staring point")
56+
</script>
57+
</html>

0 commit comments

Comments
 (0)