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

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

Issue 2803543003: WebUI: fix cr-action-menu keyboard off-by-one issue (Closed)
Patch Set: merge Created 3 years, 8 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 | « 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 d36f8e9c47b9e936c56bd78e9109ae95af8b265d..9715fba33f54b0568f705bc7bed33a9e220c61ef 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
@@ -40,6 +40,10 @@ suite('CrActionMenu', function() {
MockInteractions.keyDownOn(menu, 'ArrowDown', [], 'ArrowDown');
}
+ function up() {
+ MockInteractions.keyDownOn(menu, 'ArrowUp', [], 'ArrowUp');
+ }
+
test('hidden or disabled items', function() {
menu.showAt(document.querySelector('#dots'));
down();
@@ -59,10 +63,6 @@ suite('CrActionMenu', function() {
});
test('focus after down/up arrow', function() {
- function up() {
- MockInteractions.keyDownOn(menu, 'ArrowUp', [], 'ArrowUp');
- }
-
menu.showAt(document.querySelector('#dots'));
// The menu should be focused when shown, but not on any of the items.
@@ -93,6 +93,14 @@ suite('CrActionMenu', function() {
assertEquals(items[0], menu.root.activeElement);
});
+ test('pressing up arrow when no focus will focus last item', function(){
+ menu.showAt(document.querySelector('#dots'));
+ assertEquals(menu, document.activeElement);
+
+ up();
+ assertEquals(items[items.length - 1], menu.root.activeElement);
+ });
+
test('close on resize', function() {
menu.showAt(document.querySelector('#dots'));
assertTrue(menu.open);
« 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