summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-tabindex.html
blob: 8833e52749c35065bd3a76d6d9934c71fa18abe0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<html>
<body>
<script src="../../js/resources/js-test-pre.js"></script>
<script src="../resources/common.js"></script>

<input id="tabindex30" tabindex="30">
<input id="tabindex20-1" tabindex="20">
<input id="time-with-tabindex20" tabindex="20" type="time">
<input id="tabindex20-3" tabindex="20">
<input id="tabindex10" tabindex="10">

<script>
if (!window.eventSender || !window.internals)
    debug('This requires DRT/WRT.');

var firstSubField = "-webkit-datetime-edit-hour-field";
var lastSubField = "-webkit-datetime-edit-ampm-field";
var tab = '\t';
var shift = ['shiftKey'];

$('tabindex10').focus();
var shadowRoot = internals.youngestShadowRoot($('time-with-tabindex20'));

debug('Forword:');
shouldBeEqualToString('eventSender.keyDown(tab); document.activeElement.id', 'tabindex20-1');
shouldBeEqualToString('eventSender.keyDown(tab); document.activeElement.id', 'time-with-tabindex20');
shouldBe('shadowRoot.activeElement.getAttribute("part")', 'firstSubField');
shouldBe('eventSender.keyDown(tab); eventSender.keyDown(tab); shadowRoot.activeElement.getAttribute("part")', 'lastSubField');
shouldBeEqualToString('eventSender.keyDown(tab); document.activeElement.id', 'tabindex20-3');
shouldBeEqualToString('eventSender.keyDown(tab); document.activeElement.id', 'tabindex30');

debug('');
debug('Backword:');
shouldBeEqualToString('eventSender.keyDown(tab, shift); document.activeElement.id', 'tabindex20-3');
shouldBeEqualToString('eventSender.keyDown(tab, shift); document.activeElement.id', 'time-with-tabindex20');
shouldBe('shadowRoot.activeElement.getAttribute("part")', 'lastSubField');
shouldBe('eventSender.keyDown(tab, shift); eventSender.keyDown(tab, shift); shadowRoot.activeElement.getAttribute("part")', 'firstSubField');
shouldBeEqualToString('eventSender.keyDown(tab, shift); document.activeElement.id', 'tabindex20-1');


</script>
<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>