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

Unified 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 side-by-side diff with in-line comments
Download patch
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..c5943c2c9c9194d4132f4ad5725d7d036451d6e5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/contextmenu-follows-focus.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+var context_for_menu;
+function catchContextMenu(event) {
+ context_for_menu = event.currentTarget.tagName;
+}
+</script>
+
+<body>
bokan 2017/05/11 22:19:14 Nit: As per layout test style (https://chromium.go
+<input oncontextmenu="catchContextMenu(event);">
+<a href="www" oncontextmenu="catchContextMenu(event);">A link</a>
+</body>
+
+<script>
+test(function() {
+ if (!window.eventSender) {
yosin_UTC9 2017/05/12 04:25:06 nit: We found shorter one: |assert_exists(window,
+ document.write('This test requires eventSender.');
+ return false;
+ }
+
+ document.querySelector('INPUT').focus();
+ eventSender.keyDown('ContextMenu');
+ assert_equals(context_for_menu, '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(context_for_menu, 'A',
+ 'ContextMenu should use the focused link as context.');
+
+}, 'ContextMenu should always follow focused element.');
+</script>

Powered by Google App Engine
This is Rietveld 408576698