| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 assertTrue(toolbar.spinnerActive); | 62 assertTrue(toolbar.spinnerActive); |
| 63 app.historyResult(createHistoryInfo(), TEST_HISTORY_RESULTS); | 63 app.historyResult(createHistoryInfo(), TEST_HISTORY_RESULTS); |
| 64 assertFalse(toolbar.spinnerActive); | 64 assertFalse(toolbar.spinnerActive); |
| 65 done(); | 65 done(); |
| 66 }); | 66 }); |
| 67 }); | 67 }); |
| 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() { | |
| 73 var info = createHistoryInfo(); | |
| 74 info.finished = false; | |
| 75 app.historyResult(info, []); | |
| 76 app.grouped_ = true; | |
| 77 return PolymerTest.flushTasks().then(function() { | |
| 78 app.fire('change-query', {range: HistoryRange.MONTH}); | |
| 79 groupedList = app.$.history.$$('#grouped-list'); | |
| 80 assertTrue(!!groupedList); | |
| 81 var today = toolbar.$$('#today-button'); | |
| 82 var next = toolbar.$$('#next-button'); | |
| 83 var prev = toolbar.$$('#prev-button'); | |
| 84 | |
| 85 assertEquals(0, toolbar.groupedOffset); | |
| 86 assertTrue(today.disabled); | |
| 87 assertTrue(next.disabled); | |
| 88 assertFalse(prev.disabled); | |
| 89 | |
| 90 MockInteractions.tap(prev); | |
| 91 assertEquals(1, toolbar.groupedOffset); | |
| 92 assertFalse(today.disabled); | |
| 93 assertFalse(next.disabled); | |
| 94 assertFalse(prev.disabled); | |
| 95 | |
| 96 app.historyResult(createHistoryInfo(), []); | |
| 97 assertFalse(today.disabled); | |
| 98 assertFalse(next.disabled); | |
| 99 assertTrue(prev.disabled); | |
| 100 }); | |
| 101 }); | |
| 102 | |
| 103 test('sync notice shows and hides', function() { | 72 test('sync notice shows and hides', function() { |
| 104 toolbar.showSyncNotice = true; | 73 toolbar.showSyncNotice = true; |
| 105 Polymer.dom.flush(); | 74 Polymer.dom.flush(); |
| 106 | 75 |
| 107 var button = toolbar.$$('#info-button'); | 76 var button = toolbar.$$('#info-button'); |
| 108 var notice = toolbar.$$('#sync-notice'); | 77 var notice = toolbar.$$('#sync-notice'); |
| 109 | 78 |
| 110 assertTrue(!!button); | 79 assertTrue(!!button); |
| 111 MockInteractions.tap(button); | 80 MockInteractions.tap(button); |
| 112 | 81 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 129 // Hiding the button hides the notice. | 98 // Hiding the button hides the notice. |
| 130 MockInteractions.tap(button); | 99 MockInteractions.tap(button); |
| 131 toolbar.showSyncNotice = false; | 100 toolbar.showSyncNotice = false; |
| 132 assertTrue(notice.hidden); | 101 assertTrue(notice.hidden); |
| 133 }); | 102 }); |
| 134 | 103 |
| 135 teardown(function() { | 104 teardown(function() { |
| 136 registerMessageCallback('queryHistory', this, function() {}); | 105 registerMessageCallback('queryHistory', this, function() {}); |
| 137 }); | 106 }); |
| 138 }); | 107 }); |
| OLD | NEW |