summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/suggestion-picker/month-suggestion-picker-reset-value-after-reload.html
blob: 677870da36886d52e46a56108c561d75b1275d4d (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE html>
<html>
<head>
<script src="../../js/resources/js-test-pre.js"></script>
<script src="../../forms/resources/picker-common.js"></script>
<script src="resources/suggestion-picker-common.js"></script>
</head>
<body>
<script>
description('Checks reloading page resets input values');

var iframe;
var testInput1;
var testInput2;

function runOnOpenPopup1() {
    iframe = document.getElementById('iframe');

    popupWindow.focus();

    shouldBeNull('highlightedEntry()');
    eventSender.keyDown('downArrow');
    shouldBeEqualToString('highlightedEntry()', '2012-01');
    eventSender.keyDown("\n");
    waitUntilClosing(runOnOpenPopup1AfterClosing);
}

function runOnOpenPopup1AfterClosing() {
    shouldBeNull('document.getElementById("mock-page-popup")');
    shouldBeEqualToString('iframe.contentDocument.getElementById("test1").value', '2012-01');

    openPicker(iframe.contentDocument.getElementById('test2'), runOnOpenPopup2);
}

function runOnOpenPopup2() {
    popupWindow.focus();

    shouldBeNull('highlightedEntry()');
    eventSender.keyDown('downArrow');
    shouldBeEqualToString('highlightedEntry()', '2012-01');
    eventSender.keyDown("\n");
    waitUntilClosing(runOnOpenPopup2AfterClosing);
}

function runOnOpenPopup2AfterClosing() {
    shouldBeNull('document.getElementById("mock-page-popup")');
    shouldBeEqualToString('iframe.contentDocument.getElementById("test2").value', '2012-01');

    iframe.addEventListener("load", function () { parent.runOnIFrameLoad(); });
    iframe.contentWindow.location.reload();
}

function runOnIFrameLoad()
{
    testInput1 = iframe.contentDocument.getElementById('test1');
    testInput2 = iframe.contentDocument.getElementById('test2');
    shouldBeEqualToString('testInput1.value', '');
    shouldBeEqualToString('testInput2.value', '2002-02');
    iframe.parentNode.removeChild(iframe);
    waitUntilClosing(finishJSTest);
}
</script>
<iframe id=iframe onload="openPicker(event.target.contentDocument.getElementById('test1'), runOnOpenPopup1);" srcdoc="<input type=month id=test1 list=suggestions><input type=month id=test2 value=2002-02 list=suggestions><datalist id=suggestions><option>2012-01</option></datalist>"></iframe>
<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>