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

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

Issue 2586113002: MD Settings: ignore modified key events in the profile avatar grid (Closed)
Patch Set: closure Created 4 years 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 /** @fileoverview Suite of tests for cr-profile-avatar-selector. */ 5 /** @fileoverview Suite of tests for cr-profile-avatar-selector. */
6 cr.define('cr_profile_avatar_selector', function() { 6 cr.define('cr_profile_avatar_selector', function() {
7 function registerTests() { 7 function registerTests() {
8 suite('cr-profile-avatar-selector', function() { 8 suite('cr-profile-avatar-selector', function() {
9 /** @type {CrProfileAvatarSelectorElement} */ 9 /** @type {CrProfileAvatarSelectorElement} */
10 var avatarSelector = null; 10 var avatarSelector = null;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 function(done) { 81 function(done) {
82 avatarSelector.addEventListener('iron-activate', 82 avatarSelector.addEventListener('iron-activate',
83 function(event) { 83 function(event) {
84 assertEquals(event.detail.selected, 'chrome://avatar2.png'); 84 assertEquals(event.detail.selected, 'chrome://avatar2.png');
85 done(); 85 done();
86 }); 86 });
87 87
88 // Simulate tapping the second avatar. 88 // Simulate tapping the second avatar.
89 MockInteractions.tap(avatarSelector.$['avatar-grid'].items[1]); 89 MockInteractions.tap(avatarSelector.$['avatar-grid'].items[1]);
90 }); 90 });
91
92 test('Ignores modified key events', function() {
93 var selector = avatarSelector.$['avatar-grid'];
94 var items = selector.items;
95
96 selector._setFocusedItem(items[0]);
97 assertTrue(items[0].focused);
98
99 MockInteractions.keyDownOn(items[0], 39, [], 'ArrowRight');
100 assertTrue(items[1].focused);
101
102 MockInteractions.keyDownOn(items[0], 37, [], 'ArrowLeft');
103 assertTrue(items[0].focused);
104
105 avatarSelector.ignoreModifiedKeyEvents = true;
106
107 MockInteractions.keyDownOn(items[0], 39, 'alt', 'ArrowRight');
108 assertTrue(items[0].focused);
109
110 MockInteractions.keyDownOn(items[0], 39, 'ctrl', 'ArrowRight');
111 assertTrue(items[0].focused);
112
113 MockInteractions.keyDownOn(items[0], 39, 'meta', 'ArrowRight');
114 assertTrue(items[0].focused);
115
116 MockInteractions.keyDownOn(items[0], 39, 'shift', 'ArrowRight');
117 assertTrue(items[0].focused);
118 });
91 }); 119 });
92 } 120 }
93 121
94 return { 122 return {
95 registerTests: registerTests, 123 registerTests: registerTests,
96 }; 124 };
97 }); 125 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698