| 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 suite('<history-list>', function() { | 5 suite('<history-list>', function() { |
| 6 var app; | 6 var app; |
| 7 var element; | 7 var element; |
| 8 var toolbar; | 8 var toolbar; |
| 9 var TEST_HISTORY_RESULTS; | 9 var TEST_HISTORY_RESULTS; |
| 10 var ADDITIONAL_RESULTS; | 10 var ADDITIONAL_RESULTS; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 createHistoryEntry('2015-01-01', 'http://example.com') | 39 createHistoryEntry('2015-01-01', 'http://example.com') |
| 40 ]); | 40 ]); |
| 41 | 41 |
| 42 PolymerTest.flushTasks().then(function() { | 42 PolymerTest.flushTasks().then(function() { |
| 43 assertEquals(element.historyData_.length, 1); | 43 assertEquals(element.historyData_.length, 1); |
| 44 items = polymerSelectAll(element, 'history-item'); | 44 items = polymerSelectAll(element, 'history-item'); |
| 45 MockInteractions.tap(items[0].$.checkbox); | 45 MockInteractions.tap(items[0].$.checkbox); |
| 46 assertDeepEquals([true], element.historyData_.map(i => i.selected)); | 46 assertDeepEquals([true], element.historyData_.map(i => i.selected)); |
| 47 return PolymerTest.flushTasks(); | 47 return PolymerTest.flushTasks(); |
| 48 }).then(function() { | 48 }).then(function() { |
| 49 MockInteractions.tap(app.$.toolbar.$$('#delete-button')); | 49 toolbar.onDeleteTap_(); |
| 50 var dialog = listContainer.$.dialog.get(); | 50 var dialog = listContainer.$.dialog.get(); |
| 51 registerMessageCallback('removeVisits', this, function() { | 51 registerMessageCallback('removeVisits', this, function() { |
| 52 PolymerTest.flushTasks().then(function() { | 52 PolymerTest.flushTasks().then(function() { |
| 53 deleteComplete(); | 53 deleteComplete(); |
| 54 return PolymerTest.flushTasks(); | 54 return PolymerTest.flushTasks(); |
| 55 }).then(function() { | 55 }).then(function() { |
| 56 items = polymerSelectAll(element, 'history-item'); | 56 items = polymerSelectAll(element, 'history-item'); |
| 57 assertEquals(element.historyData_.length, 0); | 57 assertEquals(element.historyData_.length, 0); |
| 58 done(); | 58 done(); |
| 59 }); | 59 }); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 306 |
| 307 MockInteractions.tap(items[2].$.checkbox); | 307 MockInteractions.tap(items[2].$.checkbox); |
| 308 MockInteractions.tap(items[5].$.checkbox); | 308 MockInteractions.tap(items[5].$.checkbox); |
| 309 MockInteractions.tap(items[7].$.checkbox); | 309 MockInteractions.tap(items[7].$.checkbox); |
| 310 MockInteractions.tap(items[8].$.checkbox); | 310 MockInteractions.tap(items[8].$.checkbox); |
| 311 MockInteractions.tap(items[9].$.checkbox); | 311 MockInteractions.tap(items[9].$.checkbox); |
| 312 MockInteractions.tap(items[10].$.checkbox); | 312 MockInteractions.tap(items[10].$.checkbox); |
| 313 | 313 |
| 314 return PolymerTest.flushTasks(); | 314 return PolymerTest.flushTasks(); |
| 315 }).then(function() { | 315 }).then(function() { |
| 316 MockInteractions.tap(app.$.toolbar.$$('#delete-button')); | 316 toolbar.onDeleteTap_(); |
| 317 | 317 |
| 318 var dialog = listContainer.$.dialog.get(); | 318 var dialog = listContainer.$.dialog.get(); |
| 319 registerMessageCallback('removeVisits', this, function() { | 319 registerMessageCallback('removeVisits', this, function() { |
| 320 PolymerTest.flushTasks().then(function() { | 320 PolymerTest.flushTasks().then(function() { |
| 321 deleteComplete(); | 321 deleteComplete(); |
| 322 return PolymerTest.flushTasks(); | 322 return PolymerTest.flushTasks(); |
| 323 }).then(function() { | 323 }).then(function() { |
| 324 assertEquals(element.historyData_.length, 5); | 324 assertEquals(element.historyData_.length, 5); |
| 325 assertEquals(element.historyData_[0].dateRelativeDay, '2016-03-15'); | 325 assertEquals(element.historyData_[0].dateRelativeDay, '2016-03-15'); |
| 326 assertEquals(element.historyData_[2].dateRelativeDay, '2016-03-13'); | 326 assertEquals(element.historyData_[2].dateRelativeDay, '2016-03-13'); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 app.historyResult(createHistoryInfo(), TEST_HISTORY_RESULTS); | 431 app.historyResult(createHistoryInfo(), TEST_HISTORY_RESULTS); |
| 432 app.historyResult(createHistoryInfo(), ADDITIONAL_RESULTS); | 432 app.historyResult(createHistoryInfo(), ADDITIONAL_RESULTS); |
| 433 | 433 |
| 434 var listContainer = app.$.history; | 434 var listContainer = app.$.history; |
| 435 PolymerTest.flushTasks().then(function() { | 435 PolymerTest.flushTasks().then(function() { |
| 436 items = Polymer.dom(element.root).querySelectorAll('history-item'); | 436 items = Polymer.dom(element.root).querySelectorAll('history-item'); |
| 437 | 437 |
| 438 MockInteractions.tap(items[2].$.checkbox); | 438 MockInteractions.tap(items[2].$.checkbox); |
| 439 return PolymerTest.flushTasks(); | 439 return PolymerTest.flushTasks(); |
| 440 }).then(function() { | 440 }).then(function() { |
| 441 MockInteractions.tap(app.$.toolbar.$$('#delete-button')); | 441 toolbar.onDeleteTap_(); |
| 442 return PolymerTest.flushTasks(); | 442 return PolymerTest.flushTasks(); |
| 443 }).then(function() { | 443 }).then(function() { |
| 444 // Confirmation dialog should appear. | 444 // Confirmation dialog should appear. |
| 445 assertTrue(listContainer.$.dialog.getIfExists().open); | 445 assertTrue(listContainer.$.dialog.getIfExists().open); |
| 446 // Navigate back to chrome://history. | 446 // Navigate back to chrome://history. |
| 447 window.history.back(); | 447 window.history.back(); |
| 448 | 448 |
| 449 listenOnce(window, 'popstate', function() { | 449 listenOnce(window, 'popstate', function() { |
| 450 PolymerTest.flushTasks().then(function() { | 450 PolymerTest.flushTasks().then(function() { |
| 451 assertFalse(listContainer.$.dialog.getIfExists().open); | 451 assertFalse(listContainer.$.dialog.getIfExists().open); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 472 }); | 472 }); |
| 473 }); | 473 }); |
| 474 | 474 |
| 475 teardown(function() { | 475 teardown(function() { |
| 476 registerMessageCallback('removeVisits', this, undefined); | 476 registerMessageCallback('removeVisits', this, undefined); |
| 477 registerMessageCallback('queryHistory', this, function() {}); | 477 registerMessageCallback('queryHistory', this, function() {}); |
| 478 registerMessageCallback('navigateToUrl', this, undefined); | 478 registerMessageCallback('navigateToUrl', this, undefined); |
| 479 app.fire('change-query', {search: ''}); | 479 app.fire('change-query', {search: ''}); |
| 480 }); | 480 }); |
| 481 }); | 481 }); |
| OLD | NEW |