summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-focus-style.html
blob: e78ee7b57aafd72c596a84f6e237a9ae58f36653 (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
46
47
48
49
50
<!DOCTYPE html>
<html>
<head>
<script src="../../js/resources/js-test-pre.js"></script>
<script src="../resources/common.js"></script>
</head>
<body>
Please run this test within DumpRenderTree.
<script>
function keyDown(key, modifiers)
{
    if (!window.eventSender)
        return;
    eventSender.keyDown(key, modifiers);
}
description('Check focus style for multiple fields time input UI');
var testInput = document.createElement("input");
testInput.setAttribute("type", "time");
testInput.setAttribute("step", "0.001");
document.body.appendChild(testInput);

var sample = document.createElement("span");
sample.style.backgroundColor = "highlight";
sample.style.color = "highlighttext";
document.body.appendChild(sample);
var sampleStyle = getComputedStyle(sample);
var highlighttext = sampleStyle.color;
var highlight = sampleStyle.backgroundColor;

testInput.focus();
var shadowRoot = internals.oldestShadowRoot(testInput);
var fields = getElementByPseudoId(shadowRoot, "-webkit-datetime-edit-fields-wrapper").childNodes;
for (var index = 0; index < fields.length; ++index) {
    var field = fields[index];
    if (field.nodeType != 1)
        continue;
    var id = internals.shadowPseudoId(field);
    if (id.indexOf('-field') < 0)
        continue;
    var style = getComputedStyle(field);
    shouldBe('"' + id + '"; style.backgroundColor', 'highlight');
    shouldBe('"' + id + '"; style.color', 'highlighttext');
    keyDown('rightArrow');
}
debug('');
testInput.parentElement.removeChild(testInput);
sample.parentElement.removeChild(sample);
</script>
</body>
</html>