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

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

Issue 2869713003: Make context menu aware of hidden selection (Closed)
Patch Set: Add test as NeverFixTests for Mac 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/NeverFixTests ('k') | third_party/WebKit/Source/core/input/EventHandler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/events/contextmenu-follows-focus.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/contextmenu-follows-focus.html b/third_party/WebKit/LayoutTests/fast/events/contextmenu-follows-focus.html
new file mode 100644
index 0000000000000000000000000000000000000000..2ae04bc5cddeaab04a6eed3adfa59fddc7388c13
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/contextmenu-follows-focus.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+var contextForMenu;
+function catchContextMenu(event) {
+ contextForMenu = event.currentTarget.tagName;
+}
+</script>
+
+<input oncontextmenu="catchContextMenu(event);">
+<a href="www" oncontextmenu="catchContextMenu(event);">A link</a>
+
+<script>
+test(function() {
+ assert_exists(window, 'eventSender', 'This test requires eventSender.');
+
+ document.querySelector('INPUT').focus();
+ eventSender.keyDown('ContextMenu');
+ assert_equals(contextForMenu, 'INPUT',
+ 'ContextMenu should use the focused input field as context.');
+
+ // Hide INPUT's context menu before we display A's context menu.
+ eventSender.keyDown('Escape');
+
+ document.querySelector('A').focus();
+ eventSender.keyDown('ContextMenu');
+ assert_equals(contextForMenu, 'A',
+ 'ContextMenu should use the focused link as context.');
+
+}, 'ContextMenu should always follow focused element.');
+</script>
« no previous file with comments | « third_party/WebKit/LayoutTests/NeverFixTests ('k') | third_party/WebKit/Source/core/input/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698