| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Test Context Menu Key, Shift+F10 with Modifiers</title> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <a href="#" id="anchor">Anchor</a> |
| 6 <script> |
| 7 test(function() { |
| 8 assert_not_equals(window.eventSender, undefined, 'This test requires eventSe
nder.'); |
| 9 |
| 10 var contextMenuFired = false; |
| 11 var anchor = document.getElementById('anchor'); |
| 12 anchor.addEventListener('contextmenu', () => contextMenuFired = true); |
| 13 |
| 14 function testContextMenuEvent(key, modifiers, shouldFire) { |
| 15 contextMenuFired = false; |
| 16 anchor.focus(); |
| 17 eventSender.keyDown(key, modifiers); |
| 18 // Esc key to hide context menu |
| 19 eventSender.keyDown("Escape"); |
| 20 assert_equals(contextMenuFired, shouldFire, `${key}+${modifiers} opens C
ontext Menu:${shouldFire}.`); |
| 21 } |
| 22 |
| 23 testContextMenuEvent('ContextMenu', [], true); |
| 24 testContextMenuEvent('ContextMenu', ['numLockOn'], true); |
| 25 testContextMenuEvent('ContextMenu', ['capsLockOn'], true); |
| 26 testContextMenuEvent('ContextMenu', ['altKey'], false); |
| 27 testContextMenuEvent('ContextMenu', ['ctrlKey'], false); |
| 28 testContextMenuEvent('ContextMenu', ['shiftKey'], false); |
| 29 |
| 30 testContextMenuEvent('F10', ['shiftKey'], true); |
| 31 testContextMenuEvent('F10', ['shiftKey', 'numLockOn'], true); |
| 32 testContextMenuEvent('F10', ['shiftKey', 'capsLockOn'], true); |
| 33 testContextMenuEvent('F10', ['shiftKey', 'altKey'], false); |
| 34 testContextMenuEvent('F10', ['shiftKey', 'ctrlKey'], false); |
| 35 }, 'Context Menu keys should allow NumLock/CapsLock/etc but not other modifiers.
'); |
| 36 </script> |
| OLD | NEW |