| 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-toolbar', function() { | 5 suite('history-toolbar', 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 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 toolbar.$$('cr-toolbar').fire('search-changed', 'Test2'); | 69 toolbar.$$('cr-toolbar').fire('search-changed', 'Test2'); |
| 70 }); | 70 }); |
| 71 | 71 |
| 72 test('grouped history navigation buttons', function() { | 72 test('grouped history navigation buttons', function() { |
| 73 var info = createHistoryInfo(); | 73 var info = createHistoryInfo(); |
| 74 info.finished = false; | 74 info.finished = false; |
| 75 app.historyResult(info, []); | 75 app.historyResult(info, []); |
| 76 app.grouped_ = true; | 76 app.grouped_ = true; |
| 77 return PolymerTest.flushTasks().then(function() { | 77 return PolymerTest.flushTasks().then(function() { |
| 78 app.set('queryState_.range', HistoryRange.MONTH); | 78 app.fire('change-query', {range: HistoryRange.MONTH}); |
| 79 groupedList = app.$.history.$$('#grouped-list'); | 79 groupedList = app.$.history.$$('#grouped-list'); |
| 80 assertTrue(!!groupedList); | 80 assertTrue(!!groupedList); |
| 81 var today = toolbar.$$('#today-button'); | 81 var today = toolbar.$$('#today-button'); |
| 82 var next = toolbar.$$('#next-button'); | 82 var next = toolbar.$$('#next-button'); |
| 83 var prev = toolbar.$$('#prev-button'); | 83 var prev = toolbar.$$('#prev-button'); |
| 84 | 84 |
| 85 assertEquals(0, toolbar.groupedOffset); | 85 assertEquals(0, toolbar.groupedOffset); |
| 86 assertTrue(today.disabled); | 86 assertTrue(today.disabled); |
| 87 assertTrue(next.disabled); | 87 assertTrue(next.disabled); |
| 88 assertFalse(prev.disabled); | 88 assertFalse(prev.disabled); |
| 89 | 89 |
| 90 MockInteractions.tap(prev); | 90 MockInteractions.tap(prev); |
| 91 assertEquals(1, toolbar.groupedOffset); | 91 assertEquals(1, toolbar.groupedOffset); |
| 92 assertFalse(today.disabled); | 92 assertFalse(today.disabled); |
| 93 assertFalse(next.disabled); | 93 assertFalse(next.disabled); |
| 94 assertFalse(prev.disabled); | 94 assertFalse(prev.disabled); |
| 95 | 95 |
| 96 app.historyResult(createHistoryInfo(), []); | 96 app.historyResult(createHistoryInfo(), []); |
| 97 assertFalse(today.disabled); | 97 assertFalse(today.disabled); |
| 98 assertFalse(next.disabled); | 98 assertFalse(next.disabled); |
| 99 assertTrue(prev.disabled); | 99 assertTrue(prev.disabled); |
| 100 }); | 100 }); |
| 101 }); | 101 }); |
| 102 | 102 |
| 103 teardown(function() { | 103 teardown(function() { |
| 104 registerMessageCallback('queryHistory', this, function() {}); | 104 registerMessageCallback('queryHistory', this, function() {}); |
| 105 }); | 105 }); |
| 106 }); | 106 }); |
| OLD | NEW |