Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../../resources/testharness.js"></script> | |
| 3 <script src="../../resources/testharnessreport.js"></script> | |
| 4 <script> | |
| 5 var context_for_menu; | |
| 6 function catchContextMenu(event) { | |
| 7 context_for_menu = event.currentTarget.tagName; | |
| 8 } | |
| 9 </script> | |
| 10 | |
| 11 <body> | |
|
bokan
2017/05/11 22:19:14
Nit: As per layout test style (https://chromium.go
| |
| 12 <input oncontextmenu="catchContextMenu(event);"> | |
| 13 <a href="www" oncontextmenu="catchContextMenu(event);">A link</a> | |
| 14 </body> | |
| 15 | |
| 16 <script> | |
| 17 test(function() { | |
| 18 if (!window.eventSender) { | |
|
yosin_UTC9
2017/05/12 04:25:06
nit: We found shorter one: |assert_exists(window,
| |
| 19 document.write('This test requires eventSender.'); | |
| 20 return false; | |
| 21 } | |
| 22 | |
| 23 document.querySelector('INPUT').focus(); | |
| 24 eventSender.keyDown('ContextMenu'); | |
| 25 assert_equals(context_for_menu, 'INPUT', | |
| 26 'ContextMenu should use the focused input field as context.'); | |
| 27 | |
| 28 // Hide INPUT's context menu before we display A's context menu. | |
| 29 eventSender.keyDown('Escape'); | |
| 30 | |
| 31 document.querySelector('A').focus(); | |
| 32 eventSender.keyDown('ContextMenu'); | |
| 33 assert_equals(context_for_menu, 'A', | |
| 34 'ContextMenu should use the focused link as context.'); | |
| 35 | |
| 36 }, 'ContextMenu should always follow focused element.'); | |
| 37 </script> | |
| OLD | NEW |