Index: LayoutTests/fast/events/frame-click-clear-focus.html |
diff --git a/LayoutTests/fast/events/frame-click-clear-focus.html b/LayoutTests/fast/events/frame-click-clear-focus.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5cac5cf854103e8ca3fadaf457b17f50db2f5111 |
--- /dev/null |
+++ b/LayoutTests/fast/events/frame-click-clear-focus.html |
@@ -0,0 +1,32 @@ |
+<!DOCTYPE html> |
+<html> |
+<body> |
+<script src="../../resources/js-test.js"></script> |
+<iframe id="frame1" src="data:text/html,<input>" width="800" height="600"></iframe> |
+<iframe id="frame2" src="data:text/html,<input>" width="800" height="600"></iframe> |
+<script> |
+description('Make sure that clicking on an inactive frame clears existing element focus.'); |
+jsTestIsAsync = true; |
+var doc; |
+var innerInput; |
+window.onload = function() { |
+ doc = window.frames['frame1'].document; |
+ innerInput = doc.querySelector('input'); |
+ innerInput.focus(); |
+ debug('===> Making a frame with a focused element inactive.'); |
+ window.frames['frame2'].focus(); |
+ // The following check is not important. activeElement is innerInput in IE, |
+ // and is body in Firefox in this case. |
+ shouldBe('doc.activeElement', 'innerInput'); |
+ |
+ debug('===> Making the frame active again clicking by a non-focusable element.'); |
+ var iframe1 = document.getElementById('frame1'); |
+ eventSender.mouseMoveTo(iframe1.offsetLeft + iframe1.offsetWidth / 2, iframe1.offsetTop + iframe1.offsetHeight / 2); |
+ eventSender.mouseDown(); |
+ eventSender.mouseUp(); |
+ shouldBe('doc.activeElement', 'doc.body'); |
+ finishJSTest(); |
+}; |
+</script> |
+</body> |
+</html> |