summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/select/select-cache-desynchronization.html
blob: a4547ef6303b3fdc4a8c1708853edda20c31d09f (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
<body><form>
<select multiple size=5 onchange="change()"><option>1</option><option>2</option></select>
</form>
<div id=res></div>
<script>

var select = document.forms[0].elements[0];
var res = document.getElementById("res");
select.focus();
if (window.testRunner) {
    testRunner.dumpAsText();
    eventSender.keyDown("downArrow", []);
    eventSender.keyDown("downArrow", ["shiftKey"]);
} else {
    res.textContent = "Press down arrow.";
}

function change() {
    if (select.firstChild.selected && !select.firstChild.nextSibling.selected) {
        select.appendChild(new Option("3", "3", false, false));
        res.textContent = "Press shift + down arrow.";
    } else if (select.firstChild.selected && select.firstChild.nextSibling.selected && !select.lastChild.selected)
        res.textContent = "Success.";
    else
        res.textContent = "Failed.";
}
</script>