Chromium Code Reviews| 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 254336070c26f9198296d3127c8c629791417e4e..6b9a375a2bb0812d87a4e6d9cdd78d9ea2c6b6f2 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,13 @@ 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')); |
|
dpapad
2017/04/05 21:49:13
assertEquals(menu, document.activeElement);
scottchen
2017/04/06 17:54:02
Done.
|
| + |
| + up(); |
| + assertEquals(items[2], menu.root.activeElement); |
|
dpapad
2017/04/05 21:49:13
Nit (optional): Make it more explicit that we expe
scottchen
2017/04/06 17:54:02
Done.
|
| + }); |
| + |
| test('close on resize', function() { |
| menu.showAt(document.querySelector('#dots')); |
| assertTrue(menu.open); |