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 cr.define('md_history.history_list_test', function() { | 5 cr.define('md_history.history_list_test', function() { |
6 function registerTests() { | 6 function registerTests() { |
7 suite('history-list', function() { | 7 suite('history-list', function() { |
8 var app; | 8 var app; |
9 var element; | 9 var element; |
10 var toolbar; | 10 var toolbar; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 registerMessageCallback('queryHistory', this, function (info) { | 167 registerMessageCallback('queryHistory', this, function (info) { |
168 assertEquals('example.com', info[0]); | 168 assertEquals('example.com', info[0]); |
169 flush().then(function() { | 169 flush().then(function() { |
170 assertEquals( | 170 assertEquals( |
171 'example.com', | 171 'example.com', |
172 toolbar.$['main-toolbar'].getSearchField().getValue()); | 172 toolbar.$['main-toolbar'].getSearchField().getValue()); |
173 done(); | 173 done(); |
174 }); | 174 }); |
175 }); | 175 }); |
176 | 176 |
177 element.$.sharedMenu.itemData = {domain: 'example.com'}; | 177 app.$['history'].$.sharedMenu.itemData = {domain: 'example.com'}; |
178 MockInteractions.tap(element.$.menuMoreButton); | 178 MockInteractions.tap(app.$['history'].$.menuMoreButton); |
| 179 }); |
| 180 |
| 181 test('scrolling history list closes overflow menu', function() { |
| 182 var sharedMenu = app.$.history.$.sharedMenu; |
| 183 for (var i = 0; i < 10; i++) |
| 184 app.historyResult(createHistoryInfo(), TEST_HISTORY_RESULTS); |
| 185 |
| 186 return flush().then(function() { |
| 187 items = Polymer.dom(element.root).querySelectorAll('history-item'); |
| 188 |
| 189 MockInteractions.tap(items[2].$['menu-button']); |
| 190 assertTrue(sharedMenu.menuOpen); |
| 191 element.$['infinite-list'].scrollTop = 100; |
| 192 return flush(); |
| 193 }).then(function() { |
| 194 assertFalse(sharedMenu.menuOpen); |
| 195 }); |
179 }); | 196 }); |
180 | 197 |
181 test('changing search deselects items', function() { | 198 test('changing search deselects items', function() { |
182 app.historyResult( | 199 app.historyResult( |
183 createHistoryInfo('ex'), | 200 createHistoryInfo('ex'), |
184 [createHistoryEntry('2016-06-9', 'https://www.example.com')]); | 201 [createHistoryEntry('2016-06-9', 'https://www.example.com')]); |
185 return flush().then(function() { | 202 return flush().then(function() { |
186 var item = element.$$('history-item'); | 203 var item = element.$$('history-item'); |
187 MockInteractions.tap(item.$.checkbox); | 204 MockInteractions.tap(item.$.checkbox); |
188 | 205 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 app.queryState_.queryingDisabled = true; | 255 app.queryState_.queryingDisabled = true; |
239 app.set('queryState_.searchTerm', ''); | 256 app.set('queryState_.searchTerm', ''); |
240 return flush(); | 257 return flush(); |
241 }); | 258 }); |
242 }); | 259 }); |
243 } | 260 } |
244 return { | 261 return { |
245 registerTests: registerTests | 262 registerTests: registerTests |
246 }; | 263 }; |
247 }); | 264 }); |
OLD | NEW |