OLD | NEW |
---|---|
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 Loading... | |
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 selector.ignoreModifiedKeyEvents = true; | |
Moe
2016/12/20 19:07:40
maybe set the property on avatarSelector to test t
Dan Beam
2016/12/20 19:31:15
Done.
| |
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 }); |
OLD | NEW |