chromium/third_party/blink/web_tests/fast/forms/select/menulist-type-ahead-find-original-item.html

<!DOCTYPE html>
<html>
<head>
<script>
var expectedSelectedIndex;

function recordIt()
{
    var res = document.getElementById("res");
    if (res.innerText != "FAIL")
        res.innerText = "PASS";
}

function testIt(ch, expected)
{
    document.getElementById("sel").focus();
    eventSender.keyDown(ch);
    if (document.getElementById("sel").selectedIndex != expected)
        document.getElementById("res").innerText = "FAIL";
}

function test()
{
    if (!window.testRunner)
        return;

    testRunner.dumpAsText();
    testIt("ArrowDown", 1);
    testIt("ArrowDown", 2);
    testIt("a", 0);
}
</script>
</head>
<body onload="test()">
<h1>Verify type ahead selection fires onchange event.</h1>
<ol>
<li>Set focus to select element</li>
<li>Type down arrow twice and type "a"</li>
<li>You see "apple" in select element and "PASS" below select element.</li>
</ol>
<select id="sel" onchange="recordIt()">
    <option>apple</option>
    <option>banana</option>
    <option>cherry</option>
</select><br />
<div id="res"></div>
</html>