Index: LayoutTests/fast/events/menu-key-context-menu.html |
diff --git a/LayoutTests/fast/events/menu-key-context-menu.html b/LayoutTests/fast/events/menu-key-context-menu.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..83f0a5574d32ab1f797043c772cc743ec210b583 |
--- /dev/null |
+++ b/LayoutTests/fast/events/menu-key-context-menu.html |
@@ -0,0 +1,42 @@ |
+<html> |
+<head> |
+<title> |
+Test for contextmenu event target |
+</title> |
+</head> |
+<body onload="test()"> |
+<p>This test checks if contextmenu event target is correct when triggered from menu key.</p> |
+<a href="" id="anchor" oncontextmenu="handleContextMenu(event);">Test</a> |
+<div id="result">FAIL</div> |
+<script> |
+var count = 0; |
+function handleContextMenu(e) { |
+ count++; |
+ if(count === 2) |
+ document.getElementById("result").innerHTML = "PASS"; |
+ return false; |
+} |
+ |
+function test() { |
+ if (window.testRunner) |
+ testRunner.dumpAsText(); |
+ |
+ if (!window.eventSender) |
+ return; |
+ |
+ var anchor = document.getElementById("anchor"); |
+ |
+ var r = anchor.getBoundingClientRect(); |
+ var x = (r.left + r.right) / 2 |
+ var y = (r.top + r.bottom) / 2; |
+ eventSender.mouseMoveTo(x, y); |
+ eventSender.contextClick(); |
+ // Esc key to hide context menu |
+ eventSender.keyDown(String.fromCharCode(0x001B)); |
+ anchor.focus(); |
+ eventSender.keyDown("menu"); |
+ |
+} |
+</script> |
+</body> |
+</html> |