Index: LayoutTests/fast/events/menu-key-context-menu-element-focus.html |
diff --git a/LayoutTests/fast/events/menu-key-context-menu.html b/LayoutTests/fast/events/menu-key-context-menu-element-focus.html |
similarity index 62% |
copy from LayoutTests/fast/events/menu-key-context-menu.html |
copy to LayoutTests/fast/events/menu-key-context-menu-element-focus.html |
index 586d182d1835610bf03992353490617fb8199ecf..01889b447e357e8e6d7d68a794f6148dd0d6aba4 100644 |
--- a/LayoutTests/fast/events/menu-key-context-menu.html |
+++ b/LayoutTests/fast/events/menu-key-context-menu-element-focus.html |
@@ -5,18 +5,21 @@ 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> |
+<p>This test checks if focus is on same element after dismissing context menu |
+ by esc key context menu came by menu key selection, so that when menu key is |
+ selected context menu will come on that element.</p> |
<a href="" id="anchor" oncontextmenu="handleContextMenu(event);">Test</a> |
<div id="result">FAIL</div> |
<script> |
var count = 0; |
+var anchorNode; |
function handleContextMenu(e) { |
count++; |
- if(count === 2) |
+ if(count === 2 && (e.currentTarget == anchorNode)) { |
Rick Byers
2014/12/10 03:09:24
Does this test actually fail without your patch?
Deepak
2014/12/10 06:40:27
No , This test is not failing without my changes.
|
document.getElementById("result").innerHTML = "PASS"; |
+ } |
return false; |
} |
- |
function test() { |
if (window.testRunner) |
testRunner.dumpAsText(); |
@@ -24,18 +27,12 @@ function test() { |
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(); |
+ anchorNode = document.getElementById("anchor"); |
+ anchor.focus(); |
+ eventSender.keyDown("menu"); |
// Esc key to hide context menu |
eventSender.keyDown("escape"); |
- anchor.focus(); |
eventSender.keyDown("menu"); |
- |
} |
</script> |
</body> |