Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/contextmenu-follows-focus.html

Issue 2869713003: Make context menu aware of hidden selection (Closed)
Patch Set: Added a test Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698