| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 assertFalse(listContainer.$.dialog.open); | 280 assertFalse(listContainer.$.dialog.open); |
| 281 | 281 |
| 282 MockInteractions.pressAndReleaseKeyOn( | 282 MockInteractions.pressAndReleaseKeyOn( |
| 283 document.body, 8, '', 'Backspace'); | 283 document.body, 8, '', 'Backspace'); |
| 284 assertTrue(listContainer.$.dialog.open); | 284 assertTrue(listContainer.$.dialog.open); |
| 285 | 285 |
| 286 MockInteractions.tap(listContainer.$$('.action-button')); | 286 MockInteractions.tap(listContainer.$$('.action-button')); |
| 287 }); | 287 }); |
| 288 }); | 288 }); |
| 289 | 289 |
| 290 test('delete dialog closed on url change', function() { |
| 291 app.queryState_.queryingDisabled = false; |
| 292 var listContainer = app.$.history; |
| 293 app.historyResult(createHistoryInfo(), TEST_HISTORY_RESULTS); |
| 294 app.historyResult(createHistoryInfo(), ADDITIONAL_RESULTS); |
| 295 return flush().then(function() { |
| 296 items = Polymer.dom(element.root).querySelectorAll('history-item'); |
| 297 |
| 298 MockInteractions.tap(items[2].$.checkbox); |
| 299 MockInteractions.tap(app.$.toolbar.$$('#delete-button')); |
| 300 |
| 301 // Confirmation dialog should appear. |
| 302 assertTrue(listContainer.$.dialog.open); |
| 303 |
| 304 app.set('queryState_.searchTerm', 'something else'); |
| 305 assertFalse(listContainer.$.dialog.open); |
| 306 }); |
| 307 }); |
| 308 |
| 290 teardown(function() { | 309 teardown(function() { |
| 291 element.historyData_ = []; | 310 element.historyData_ = []; |
| 292 registerMessageCallback('removeVisits', this, undefined); | 311 registerMessageCallback('removeVisits', this, undefined); |
| 293 registerMessageCallback('queryHistory', this, undefined); | 312 registerMessageCallback('queryHistory', this, function() {}); |
| 294 app.queryState_.queryingDisabled = true; | 313 app.queryState_.queryingDisabled = true; |
| 295 app.set('queryState_.searchTerm', ''); | 314 app.set('queryState_.searchTerm', ''); |
| 296 return flush(); | 315 return flush(); |
| 297 }); | 316 }); |
| 298 }); | 317 }); |
| 299 } | 318 } |
| 300 return { | 319 return { |
| 301 registerTests: registerTests | 320 registerTests: registerTests |
| 302 }; | 321 }; |
| 303 }); | 322 }); |
| OLD | NEW |