summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/calendar-picker/datetimelocal-open-picker-with-f4-key.html
blob: 11b373720d282a5dde9328c1dc618e4ee614e087 (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
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/calendar-picker-common.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<input type=datetime-local id=test>
<script>
description("Tests if pressing F4 opens the calendar picker.");

debug('Check that page popup doesn\'t exist at first.');
shouldBeNull('internals.pagePopupWindow');

debug('Press F4 key.');
sendKey(document.getElementById('test'), 'F4');
shouldBeNonNull('internals.pagePopupWindow');

function sendKey(input, keyName, ctrlKey, altKey) {
    var event = document.createEvent('KeyboardEvent');
    event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName, 0, ctrlKey, altKey);
    input.focus();
    input.dispatchEvent(event);
}
</script>
</body>
</html>