| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 function registerTests() { | 109 function registerTests() { |
| 110 suite('history-toolbar', function() { | 110 suite('history-toolbar', function() { |
| 111 var app; | 111 var app; |
| 112 var element; | 112 var element; |
| 113 var toolbar; | 113 var toolbar; |
| 114 var TEST_HISTORY_RESULTS = | 114 var TEST_HISTORY_RESULTS = |
| 115 [createHistoryEntry('2016-03-15', 'https://google.com')]; | 115 [createHistoryEntry('2016-03-15', 'https://google.com')]; |
| 116 ; | 116 ; |
| 117 | 117 |
| 118 setup(function() { | 118 setup(function() { |
| 119 window.resultsRendered = false; |
| 119 app = replaceApp(); | 120 app = replaceApp(); |
| 120 | 121 |
| 121 element = app.$['history'].$['infinite-list']; | 122 element = app.$['history'].$['infinite-list']; |
| 122 toolbar = app.$['toolbar']; | 123 toolbar = app.$['toolbar']; |
| 123 }); | 124 }); |
| 124 | 125 |
| 125 test('search bar is focused on load in wide mode', function() { | 126 test('search bar is focused on load in wide mode', function() { |
| 126 window.resultsRendered = false; | 127 toolbar.$['main-toolbar'].narrow_ = false; |
| 127 app.hasDrawer_ = false; | |
| 128 | 128 |
| 129 historyResult(createHistoryInfo(), []); | 129 historyResult(createHistoryInfo(), []); |
| 130 return flush().then(() => { | 130 return flush().then(() => { |
| 131 // Ensure the search bar is focused on load. | 131 // Ensure the search bar is focused on load. |
| 132 assertTrue( | 132 assertTrue( |
| 133 app.$.toolbar.$['main-toolbar'] | 133 app.$.toolbar.$['main-toolbar'] |
| 134 .getSearchField() | 134 .getSearchField() |
| 135 .isSearchFocused()); | 135 .isSearchFocused()); |
| 136 }); | 136 }); |
| 137 }); | 137 }); |
| 138 | 138 |
| 139 test('search bar is not focused on load in narrow mode', function() { | 139 test('search bar is not focused on load in narrow mode', function() { |
| 140 app.hasDrawer_ = true; | 140 toolbar.$['main-toolbar'].narrow_ = true; |
| 141 | 141 |
| 142 historyResult(createHistoryInfo(), []); | 142 historyResult(createHistoryInfo(), []); |
| 143 // Ensure the search bar is focused on load. | 143 return flush().then(() => { |
| 144 assertFalse( | 144 // Ensure the search bar is focused on load. |
| 145 $('history-app') | 145 assertFalse( |
| 146 .$.toolbar.$['main-toolbar'] | 146 $('history-app') |
| 147 .getSearchField() | 147 .$.toolbar.$['main-toolbar'] |
| 148 .isSearchFocused()); | 148 .getSearchField() |
| 149 .isSearchFocused()); |
| 150 }); |
| 149 }); | 151 }); |
| 150 }); | 152 }); |
| 151 }; | 153 }; |
| 152 | 154 |
| 153 return { | 155 return { |
| 154 registerTests: registerTests | 156 registerTests: registerTests |
| 155 }; | 157 }; |
| 156 }); | 158 }); |
| OLD | NEW |