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

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

Issue 2755213002: MD WebUI: fix action menu initial focus to be more like context menus (Closed)
Patch Set: fix tests Created 3 years, 9 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.html » ('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 15dd8e0da2cc483f4da159d6918634e5d4040342..635bd09c53790da842d12813214dc175c48d99f5 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
@@ -36,38 +36,43 @@ suite('CrActionMenu', function() {
menu.close();
});
- test('focus after showing', function() {
+ function down() {
+ MockInteractions.keyDownOn(menu, 'ArrowDown', [], 'ArrowDown');
+ }
+
+ test('hidden or disabled items', function() {
menu.showAt(document.querySelector('#dots'));
+ down();
assertEquals(menu.root.activeElement, items[0]);
menu.close();
items[0].hidden = true;
menu.showAt(document.querySelector('#dots'));
+ down();
assertEquals(menu.root.activeElement, items[1]);
menu.close();
- items[1].hidden = true;
+ items[1].disabled = true;
menu.showAt(document.querySelector('#dots'));
+ down();
assertEquals(menu.root.activeElement, items[2]);
-
- menu.close();
- items[2].disabled = true;
- menu.showAt(document.querySelector('#dots'));
- assertEquals(null, menu.root.activeElement);
});
test('focus after down/up arrow', function() {
- function down() {
- MockInteractions.keyDownOn(menu, 'ArrowDown', [], 'ArrowDown');
- }
-
function up() {
MockInteractions.keyDownOn(menu, 'ArrowUp', [], 'ArrowUp');
}
menu.showAt(document.querySelector('#dots'));
- assertEquals(items[0], menu.root.activeElement);
+ // The menu should be focused when shown, but not on any of the items.
+ assertEquals(menu, document.activeElement);
+ assertNotEquals(items[0], menu.root.activeElement);
dpapad 2017/03/18 01:03:05 Optional nit: What is the value of menu.root.activ
Dan Beam 2017/03/18 17:55:06 it's not null, it's a wrapper in the shadow DOM an
+ assertNotEquals(items[1], menu.root.activeElement);
+ assertNotEquals(items[2], menu.root.activeElement);
+
+ down();
+ assertEquals(items[0], menu.root.activeElement);
down();
assertEquals(items[1], menu.root.activeElement);
down();
« no previous file with comments | « no previous file | ui/webui/resources/cr_elements/cr_action_menu/cr_action_menu.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698