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

Unified Diff: chrome/test/data/webui/cr_elements/cr_action_menu_test.js

Issue 2464873003: WebUI: Return focus to anchor element when cr-action-menu is closed. (Closed)
Patch Set: Resolve conflicts. Created 4 years, 1 month 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 | « no previous file | ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/cr_elements/cr_action_menu_test.js
diff --git a/chrome/test/data/webui/cr_elements/cr_action_menu_test.js b/chrome/test/data/webui/cr_elements/cr_action_menu_test.js
index 86cb9816021bb2615354eca30d2fcd3c2e4ef3b4..233b3ec167765320673481f5fc7b556fabd4b1d2 100644
--- a/chrome/test/data/webui/cr_elements/cr_action_menu_test.js
+++ b/chrome/test/data/webui/cr_elements/cr_action_menu_test.js
@@ -93,11 +93,22 @@ suite('CrActionMenu', function() {
assertFalse(menu.open);
});
- test('close on Tab', function() {
- menu.showAt(document.querySelector('#dots'));
- assertTrue(menu.open);
-
- MockInteractions.keyDownOn(menu, 'Tab', [], 'Tab');
- assertFalse(menu.open);
+ /** @param {string} key The key to use for closing. */
+ function testFocusAfterClosing(key) {
+ return new Promise(function(resolve) {
+ var dots = document.querySelector('#dots');
+ menu.showAt(dots);
+ assertTrue(menu.open);
+
+ // Check that focus returns to the anchor element.
+ dots.addEventListener('focus', resolve);
+ MockInteractions.keyDownOn(menu, key, [], key);
+ assertFalse(menu.open);
+ });
+ }
+
+ test('close on Tab', function() { return testFocusAfterClosing('Tab'); });
+ test('close on Escape', function() {
+ return testFocusAfterClosing('Escape');
});
});
« no previous file with comments | « no previous file | ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698