OLD | NEW |
---|---|
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <title> | 3 <title> |
4 Test for contextmenu event target | 4 Test for contextmenu event target |
5 </title> | 5 </title> |
6 </head> | 6 </head> |
7 <body onload="test()"> | 7 <body onload="test()"> |
8 <p>This test checks if contextmenu event target is correct when triggered from m enu key.</p> | 8 <p>This test checks if focus is on same element after dismissing context menu |
9 by esc key context menu came by menu key selection, so that when menu key is | |
10 selected context menu will come on that element.</p> | |
9 <a href="" id="anchor" oncontextmenu="handleContextMenu(event);">Test</a> | 11 <a href="" id="anchor" oncontextmenu="handleContextMenu(event);">Test</a> |
10 <div id="result">FAIL</div> | 12 <div id="result">FAIL</div> |
11 <script> | 13 <script> |
12 var count = 0; | 14 var count = 0; |
15 var anchorNode; | |
13 function handleContextMenu(e) { | 16 function handleContextMenu(e) { |
14 count++; | 17 count++; |
15 if(count === 2) | 18 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.
| |
16 document.getElementById("result").innerHTML = "PASS"; | 19 document.getElementById("result").innerHTML = "PASS"; |
20 } | |
17 return false; | 21 return false; |
18 } | 22 } |
19 | |
20 function test() { | 23 function test() { |
21 if (window.testRunner) | 24 if (window.testRunner) |
22 testRunner.dumpAsText(); | 25 testRunner.dumpAsText(); |
23 | 26 |
24 if (!window.eventSender) | 27 if (!window.eventSender) |
25 return; | 28 return; |
26 | 29 |
27 var anchor = document.getElementById("anchor"); | 30 anchorNode = document.getElementById("anchor"); |
28 | 31 anchor.focus(); |
29 var r = anchor.getBoundingClientRect(); | 32 eventSender.keyDown("menu"); |
30 var x = (r.left + r.right) / 2 | |
31 var y = (r.top + r.bottom) / 2; | |
32 eventSender.mouseMoveTo(x, y); | |
33 eventSender.contextClick(); | |
34 // Esc key to hide context menu | 33 // Esc key to hide context menu |
35 eventSender.keyDown("escape"); | 34 eventSender.keyDown("escape"); |
36 anchor.focus(); | |
37 eventSender.keyDown("menu"); | 35 eventSender.keyDown("menu"); |
38 | |
39 } | 36 } |
40 </script> | 37 </script> |
41 </body> | 38 </body> |
42 </html> | 39 </html> |
OLD | NEW |