<html>
<head>
<script>
    function log(message) {
        document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
    }

    function setupTest() {
        var isValid = null;
        var select = document.getElementById("validated-select");
        select.focus();
        function showFormValidity() {
            isValid = select.checkValidity();
        }
        showFormValidity();
        select.addEventListener("change", showFormValidity);

        if (window.testRunner) {
            testRunner.dumpAsText();
            log("The select's validity was initially " + isValid);
            eventSender.keyDown("1");
            log("The select's validity was changed to " + isValid);
        }
    }
</script>
</head>

<body onload="setupTest()">
<form>
<select name="validated-select" required="required" id="validated-select">
    <option value="" selected="selected">Select a value</option>
    <option value="1">1</option>
</select>
</form>
<pre id="console"></pre>
</body>
</html>
