Index: LayoutTests/fast/forms/text/text-window-lost-focus-change-event.html |
diff --git a/LayoutTests/fast/forms/text/text-window-lost-focus-change-event.html b/LayoutTests/fast/forms/text/text-window-lost-focus-change-event.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..28c7829ccc981d96476613c41fadfb3e059ef96d |
--- /dev/null |
+++ b/LayoutTests/fast/forms/text/text-window-lost-focus-change-event.html |
@@ -0,0 +1,35 @@ |
+<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); |
+ window.testRunner.setMainFrameIsFirstResponder(true); |
+ window.testRunner.setWindowIsKey(false); |
+} |
+if (window.testRunner) |
+ window.jsTestIsAsync = true; |
+</script> |
+</body> |
+</html> |