<html>
    <head>
        <title></title>
        <script src="../../../resources/js-test-pre.js"></script>
    </head>
    <body>
        <p id="description"></p>
        <div id="console"></div>
        <select name="switcher" id="switcher">
            <option value="one">One</option>
            <option value="two">Two</option>
        </select>
        <input id="text"></input>

        <script>
            function test()
            {
                if (!window.testRunner || !window.internals)
                    return;

                testRunner.dumpAsText();

                description('Test for <i><a href="http://bugs.webkit.org/show_bug.cgi?id=113220">http://bugs.webkit.org/show_bug.cgi?id=113220</a>: ensures select popup closes when focus changes</i>.');

                popup = document.getElementById("switcher");
                popup.focus();

                eventSender.keyDown(" ", null);

                shouldBeTrue("internals.isSelectPopupVisible(popup)");

                var text = document.getElementById("text");
                text.focus();

                shouldBeFalse("internals.isSelectPopupVisible(popup)");
            }
            test();
        </script>
        <script src="../../../resources/js-test-post.js"></script>
    </body>
</html>
