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

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: add missing import 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
« no previous file with comments | « no previous file | ui/webui/resources/cr_elements/cr_action_menu/compiled_resources2.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 function makeMouseoverEvent(node) {
133 var e = new MouseEvent('mouseover', {bubbles: true});
134 node.dispatchEvent(e);
135 }
136
137 menu.showAt(document.querySelector('#dots'));
138
139 // Moving mouse on option 1 should focus it.
140 assertNotEquals(items[0], menu.root.activeElement);
141 makeMouseoverEvent(items[0]);
142 assertEquals(items[0], menu.root.activeElement);
143
144 // Moving mouse on the menu (not on option) should focus the menu.
145 makeMouseoverEvent(menu);
146 assertNotEquals(items[0], menu.root.activeElement);
147 assertEquals(menu, document.activeElement);
148
149 // Mouse movements should override keyboard focus.
150 down();
151 down();
152 assertEquals(items[1], menu.root.activeElement);
153 makeMouseoverEvent(items[0]);
154 assertEquals(items[0], menu.root.activeElement);
155 });
130 }); 156 });
OLDNEW
« no previous file with comments | « no previous file | ui/webui/resources/cr_elements/cr_action_menu/compiled_resources2.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698