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; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 registerMessageCallback('queryHistory', this, function (info) { | 86 registerMessageCallback('queryHistory', this, function (info) { |
87 assertTrue(toolbar.spinnerActive); | 87 assertTrue(toolbar.spinnerActive); |
88 app.historyResult(createHistoryInfo(), TEST_HISTORY_RESULTS); | 88 app.historyResult(createHistoryInfo(), TEST_HISTORY_RESULTS); |
89 assertFalse(toolbar.spinnerActive); | 89 assertFalse(toolbar.spinnerActive); |
90 done(); | 90 done(); |
91 }); | 91 }); |
92 | 92 |
93 toolbar.$$('cr-toolbar').fire('search-changed', 'Test2'); | 93 toolbar.$$('cr-toolbar').fire('search-changed', 'Test2'); |
94 }); | 94 }); |
95 | 95 |
| 96 test('grouped history navigation buttons', function() { |
| 97 var info = createHistoryInfo(); |
| 98 info.finished = false; |
| 99 app.historyResult(info, []); |
| 100 app.grouped_ = true; |
| 101 return PolymerTest.flushTasks().then(function() { |
| 102 app.set('queryState_.range', HistoryRange.MONTH); |
| 103 groupedList = app.$.history.$$('#grouped-list'); |
| 104 assertTrue(!!groupedList); |
| 105 var today = toolbar.$$('#today-button'); |
| 106 var next = toolbar.$$('#next-button'); |
| 107 var prev = toolbar.$$('#prev-button'); |
| 108 |
| 109 assertEquals(0, toolbar.groupedOffset); |
| 110 assertTrue(today.disabled); |
| 111 assertTrue(next.disabled); |
| 112 assertFalse(prev.disabled); |
| 113 |
| 114 MockInteractions.tap(prev); |
| 115 assertEquals(1, toolbar.groupedOffset); |
| 116 assertFalse(today.disabled); |
| 117 assertFalse(next.disabled); |
| 118 assertFalse(prev.disabled); |
| 119 |
| 120 app.historyResult(createHistoryInfo(), []); |
| 121 assertFalse(today.disabled); |
| 122 assertFalse(next.disabled); |
| 123 assertTrue(prev.disabled); |
| 124 }); |
| 125 }); |
| 126 |
96 teardown(function() { | 127 teardown(function() { |
97 registerMessageCallback('queryHistory', this, function() {}); | 128 registerMessageCallback('queryHistory', this, function() {}); |
98 app.set('queryState_.searchTerm', ''); | |
99 }); | 129 }); |
100 }); | 130 }); |
101 } | 131 } |
102 return { | 132 return { |
103 registerTests: registerTests | 133 registerTests: registerTests |
104 }; | 134 }; |
105 }); | 135 }); |
106 | 136 |
107 | 137 |
108 cr.define('md_history.history_toolbar_focus_test', function() { | 138 cr.define('md_history.history_toolbar_focus_test', function() { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 .isSearchFocused()); | 179 .isSearchFocused()); |
150 }); | 180 }); |
151 }); | 181 }); |
152 }); | 182 }); |
153 }; | 183 }; |
154 | 184 |
155 return { | 185 return { |
156 registerTests: registerTests | 186 registerTests: registerTests |
157 }; | 187 }; |
158 }); | 188 }); |
OLD | NEW |