blob: 3b11c95f8eaba280b9e3a2a0c7e790bb036bb9a8 [file] [log] [blame]
<html>
<head>
<script src = "../../../resources/js-test.js"> </script>
</head>
<body onload="runTest()">
<input type="text" id="text"/>
<script>
var blurEventCounter = 0;
var changeEventCounter = 0;
function runTest() {
description('Test when window out of focus, should dispatch both blur and change event');
var text = document.getElementById('text');
text.addEventListener('change', function() {
changeEventCounter++;
});
text.addEventListener('blur', function() {
blurEventCounter++;
shouldEvaluateTo('blurEventCounter', 1);
shouldEvaluateTo('changeEventCounter', 1);
finishJSTest();
});
text.focus();
document.execCommand('InsertText', false, 'hello world');
shouldEvaluateTo('blurEventCounter', 0);
shouldEvaluateTo('changeEventCounter', 0);
testRunner.setMainFrameIsFirstResponder(true);
testRunner.setWindowFocus(false);
}
if (window.testRunner)
window.jsTestIsAsync = true;
</script>
</body>
</html>