| 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_toolbar_test', function() { | 5 cr.define('md_history.history_toolbar_test', function() { |
| 6 function registerTests() { | 6 function registerTests() { |
| 7 suite('history-toolbar', function() { | 7 suite('history-toolbar', function() { |
| 8 var app; | 8 var app; |
| 9 var element; | 9 var element; |
| 10 var toolbar; | 10 var toolbar; |
| 11 var TEST_HISTORY_RESULTS; | 11 var TEST_HISTORY_RESULTS; |
| 12 | 12 |
| 13 suiteSetup(function() { | 13 suiteSetup(function() { |
| 14 app = $('history-app'); | 14 app = $('history-app'); |
| 15 element = app.$['history-list']; | 15 element = app.$['history'].$['infinite-list']; |
| 16 toolbar = app.$['toolbar']; | 16 toolbar = app.$['toolbar']; |
| 17 TEST_HISTORY_RESULTS = | 17 TEST_HISTORY_RESULTS = |
| 18 [createHistoryEntry('2016-03-15', 'https://google.com')]; | 18 [createHistoryEntry('2016-03-15', 'https://google.com')]; |
| 19 }); | 19 }); |
| 20 | 20 |
| 21 test('selecting checkbox causes toolbar to change', function() { | 21 test('selecting checkbox causes toolbar to change', function() { |
| 22 element.addNewResults(TEST_HISTORY_RESULTS); | 22 element.addNewResults(TEST_HISTORY_RESULTS); |
| 23 | 23 |
| 24 return flush().then(function() { | 24 return flush().then(function() { |
| 25 var item = element.$$('history-item'); | 25 var item = element.$$('history-item'); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 // Ensure that when an item is deselected the count held by the | 37 // Ensure that when an item is deselected the count held by the |
| 38 // toolbar decreases. | 38 // toolbar decreases. |
| 39 assertEquals(0, toolbar.count); | 39 assertEquals(0, toolbar.count); |
| 40 // Ensure that the toolbar boolean states that no items are selected. | 40 // Ensure that the toolbar boolean states that no items are selected. |
| 41 assertFalse(toolbar.itemsSelected_); | 41 assertFalse(toolbar.itemsSelected_); |
| 42 }); | 42 }); |
| 43 }); | 43 }); |
| 44 | 44 |
| 45 test('search term gathered correctly from toolbar', function(done) { | 45 test('search term gathered correctly from toolbar', function(done) { |
| 46 app.queryingDisabled_ = false; | 46 app.queryState_.queryingDisabled = false; |
| 47 registerMessageCallback('queryHistory', this, function (info) { | 47 registerMessageCallback('queryHistory', this, function (info) { |
| 48 assertEquals(info[0], 'Test'); | 48 assertEquals(info[0], 'Test'); |
| 49 done(); | 49 done(); |
| 50 }); | 50 }); |
| 51 | 51 |
| 52 toolbar.$$('cr-toolbar').fire('search-changed', 'Test'); | 52 toolbar.$$('cr-toolbar').fire('search-changed', 'Test'); |
| 53 }); | 53 }); |
| 54 | 54 |
| 55 teardown(function() { | 55 teardown(function() { |
| 56 element.historyData_ = []; | 56 element.historyData_ = []; |
| 57 element.searchedTerm = ''; | 57 element.searchedTerm = ''; |
| 58 registerMessageCallback('queryHistory', this, undefined); | 58 registerMessageCallback('queryHistory', this, undefined); |
| 59 toolbar.count = 0; | 59 toolbar.count = 0; |
| 60 }); | 60 }); |
| 61 }); | 61 }); |
| 62 } | 62 } |
| 63 return { | 63 return { |
| 64 registerTests: registerTests | 64 registerTests: registerTests |
| 65 }; | 65 }; |
| 66 }); | 66 }); |
| OLD | NEW |