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 TEST_HISTORY_RESULTS = |
| 15 [createHistoryEntry('2016-03-15', 'https://google.com')]; |
| 16 }); |
| 17 |
| 18 setup(function() { |
| 19 app = replaceApp(); |
15 element = app.$['history'].$['infinite-list']; | 20 element = app.$['history'].$['infinite-list']; |
16 toolbar = app.$['toolbar']; | 21 toolbar = app.$['toolbar']; |
17 TEST_HISTORY_RESULTS = | 22 return flush(); |
18 [createHistoryEntry('2016-03-15', 'https://google.com')]; | |
19 }); | 23 }); |
20 | 24 |
21 test('selecting checkbox causes toolbar to change', function() { | 25 test('selecting checkbox causes toolbar to change', function() { |
22 element.addNewResults(TEST_HISTORY_RESULTS); | 26 element.addNewResults(TEST_HISTORY_RESULTS); |
23 | 27 |
24 return flush().then(function() { | 28 return flush().then(function() { |
25 var item = element.$$('history-item'); | 29 var item = element.$$('history-item'); |
26 MockInteractions.tap(item.$.checkbox); | 30 MockInteractions.tap(item.$.checkbox); |
27 | 31 |
28 // Ensure that when an item is selected that the count held by the | 32 // Ensure that when an item is selected that the count held by the |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 assertTrue(toolbar.spinnerActive); | 87 assertTrue(toolbar.spinnerActive); |
84 app.historyResult(createHistoryInfo(), TEST_HISTORY_RESULTS); | 88 app.historyResult(createHistoryInfo(), TEST_HISTORY_RESULTS); |
85 assertFalse(toolbar.spinnerActive); | 89 assertFalse(toolbar.spinnerActive); |
86 done(); | 90 done(); |
87 }); | 91 }); |
88 | 92 |
89 toolbar.$$('cr-toolbar').fire('search-changed', 'Test2'); | 93 toolbar.$$('cr-toolbar').fire('search-changed', 'Test2'); |
90 }); | 94 }); |
91 | 95 |
92 teardown(function() { | 96 teardown(function() { |
93 element.historyData_ = []; | 97 registerMessageCallback('queryHistory', this, function() {}); |
94 element.searchedTerm = ''; | 98 app.set('queryState_.searchTerm', ''); |
95 registerMessageCallback('queryHistory', this, undefined); | |
96 toolbar.count = 0; | |
97 }); | 99 }); |
98 }); | 100 }); |
99 } | 101 } |
100 return { | 102 return { |
101 registerTests: registerTests | 103 registerTests: registerTests |
102 }; | 104 }; |
103 }); | 105 }); |
104 | 106 |
105 | 107 |
106 cr.define('md_history.history_toolbar_focus_test', function() { | 108 cr.define('md_history.history_toolbar_focus_test', function() { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 .getSearchField() | 147 .getSearchField() |
146 .isSearchFocused()); | 148 .isSearchFocused()); |
147 }); | 149 }); |
148 }); | 150 }); |
149 }; | 151 }; |
150 | 152 |
151 return { | 153 return { |
152 registerTests: registerTests | 154 registerTests: registerTests |
153 }; | 155 }; |
154 }); | 156 }); |
OLD | NEW |