Index: LayoutTests/fast/frames/frame-focus-send-blur.html |
diff --git a/LayoutTests/fast/frames/frame-focus-send-blur.html b/LayoutTests/fast/frames/frame-focus-send-blur.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e4b00d9025ae723bd634f06457af263acefd83a1 |
--- /dev/null |
+++ b/LayoutTests/fast/frames/frame-focus-send-blur.html |
@@ -0,0 +1,35 @@ |
+<!DOCTYPE html> |
+<html> |
+<body> |
+<script src="../../resources/js-test.js"></script> |
+<iframe id="frame1" src="data:text/html,<input id='input'>" ></iframe> |
+<iframe id="frame2" src="data:text/html,<div>This is a iframe element</div>"></iframe> |
+<script> |
+description('Make sure that moving focus on an inactive frame fires blur event on existing element focus.'); |
+var doc; |
+var input; |
+window.onload = function() |
+{ |
+ var frame1 = document.getElementById('frame1'); |
+ var frame2 = document.getElementById('frame2'); |
+ |
+ doc = frame1.contentDocument; |
+ input = doc.querySelector('input'); |
+ input.onblur = function() { |
+ testPassed('A blur event was dispatched on frame1 input element.'); |
+ } |
+ input.onfocus = function() { |
+ testPassed('A focus event was dispatched on frame1 input element.'); |
+ } |
+ input.focus(); |
+ |
+ debug('===> Making a first frame with a focused element inactive by focus() for second frame.'); |
+ frame2.contentWindow.focus(); |
+ shouldBe('frame1.contentDocument.activeElement', 'input'); |
+ debug('===> Making the first frame active again by focus() for first frame.'); |
+ frame1.contentWindow.focus(); |
+ shouldBe('frame1.contentDocument.activeElement', 'input'); |
+} |
+</script> |
+</body> |
+</html> |