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

Side by Side Diff: chrome/test/data/webui/cr_elements/cr_action_menu_test.js

Issue 2801453002: MD Settings: mouse movements should focus cr-action-menu items (Closed)
Patch Set: Merge branch 'iron-test-helpers' into hover-menu 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Tests for cr-action-menu element. Runs as an interactive UI 6 * @fileoverview Tests for cr-action-menu element. Runs as an interactive UI
7 * test, since many of these tests check focus behavior. 7 * test, since many of these tests check focus behavior.
8 */ 8 */
9 suite('CrActionMenu', function() { 9 suite('CrActionMenu', function() {
10 /** @type {?CrActionMenuElement} */ 10 /** @type {?CrActionMenuElement} */
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 dots.addEventListener('focus', resolve); 120 dots.addEventListener('focus', resolve);
121 MockInteractions.keyDownOn(menu, key, [], key); 121 MockInteractions.keyDownOn(menu, key, [], key);
122 assertFalse(menu.open); 122 assertFalse(menu.open);
123 }); 123 });
124 } 124 }
125 125
126 test('close on Tab', function() { return testFocusAfterClosing('Tab'); }); 126 test('close on Tab', function() { return testFocusAfterClosing('Tab'); });
127 test('close on Escape', function() { 127 test('close on Escape', function() {
128 return testFocusAfterClosing('Escape'); 128 return testFocusAfterClosing('Escape');
129 }); 129 });
130
131 test('mouse movement focus options', function() {
132 menu.showAt(document.querySelector('#dots'));
133
134 // Moving mouse on option 1 should focus it
135 assertNotEquals(items[0], menu.root.activeElement);
136 MockInteractions.move(items[0], {x: 0, y: 0}, {x: 1, y: 1});
137 menu.flushDebouncer('cr-action-menu-mousemove');
Dan Beam 2017/04/05 03:29:21 can you replace this with Polymer.dom.flush() or j
scottchen 2017/04/05 20:56:31 Yeah, don't need this anymore after removing the d
138 assertEquals(items[0], menu.root.activeElement);
139
140 // Moving mouse on the menu (not on option) should focus the menu
141 MockInteractions.move(menu, {x: 0, y: 0}, {x: 1, y: 1});
142 menu.flushDebouncer('cr-action-menu-mousemove');
143 assertNotEquals(items[0], menu.root.activeElement);
144 assertEquals(menu, document.activeElement);
145
146 // Mouse movements should override keyboard focus
147 down();
148 down();
149 assertEquals(items[1], menu.root.activeElement);
150 MockInteractions.move(items[0], {x: 0, y: 0}, {x: 1, y: 1});
151 menu.flushDebouncer('cr-action-menu-mousemove');
152 assertEquals(items[0], menu.root.activeElement);
153 });
130 }); 154 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698