| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 /** | 5 /** |
| 6 * @fileoverview Tests for MD History which are run as interactive ui tests. | 6 * @fileoverview Tests for MD History which are run as interactive ui tests. |
| 7 * Should be used for tests which care about focus. | 7 * Should be used for tests which care about focus. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 var ROOT_PATH = '../../../../../'; | 10 var ROOT_PATH = '../../../../../'; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 [createHistoryEntry('2016-03-15', 'https://google.com')]; | 45 [createHistoryEntry('2016-03-15', 'https://google.com')]; |
| 46 | 46 |
| 47 setup(function() { | 47 setup(function() { |
| 48 window.resultsRendered = false; | 48 window.resultsRendered = false; |
| 49 app = replaceApp(); | 49 app = replaceApp(); |
| 50 | 50 |
| 51 toolbar = app.$['toolbar']; | 51 toolbar = app.$['toolbar']; |
| 52 }); | 52 }); |
| 53 | 53 |
| 54 test('search bar is focused on load in wide mode', function() { | 54 test('search bar is focused on load in wide mode', function() { |
| 55 toolbar.$['main-toolbar'].narrow_ = false; | 55 toolbar.$['main-toolbar'].narrow = false; |
| 56 | 56 |
| 57 historyResult(createHistoryInfo(), []); | 57 historyResult(createHistoryInfo(), []); |
| 58 return PolymerTest.flushTasks().then(() => { | 58 return PolymerTest.flushTasks().then(() => { |
| 59 // Ensure the search bar is focused on load. | 59 // Ensure the search bar is focused on load. |
| 60 assertTrue( | 60 assertTrue( |
| 61 app.$.toolbar.$['main-toolbar'] | 61 app.$.toolbar.$['main-toolbar'] |
| 62 .getSearchField() | 62 .getSearchField() |
| 63 .isSearchFocused()); | 63 .isSearchFocused()); |
| 64 }); | 64 }); |
| 65 }); | 65 }); |
| 66 | 66 |
| 67 test('search bar is not focused on load in narrow mode', function() { | 67 test('search bar is not focused on load in narrow mode', function() { |
| 68 toolbar.$['main-toolbar'].narrow_ = true; | 68 toolbar.$['main-toolbar'].narrow = true; |
| 69 | 69 |
| 70 historyResult(createHistoryInfo(), []); | 70 historyResult(createHistoryInfo(), []); |
| 71 return PolymerTest.flushTasks().then(() => { | 71 return PolymerTest.flushTasks().then(() => { |
| 72 // Ensure the search bar is focused on load. | 72 // Ensure the search bar is focused on load. |
| 73 assertFalse( | 73 assertFalse( |
| 74 $('history-app') | 74 $('history-app') |
| 75 .$.toolbar.$['main-toolbar'] | 75 .$.toolbar.$['main-toolbar'] |
| 76 .getSearchField() | 76 .getSearchField() |
| 77 .isSearchFocused()); | 77 .isSearchFocused()); |
| 78 }); | 78 }); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 // Pressing down goes to the next card. | 273 // Pressing down goes to the next card. |
| 274 MockInteractions.pressAndReleaseKeyOn(focused, 40, [], 'ArrowDown'); | 274 MockInteractions.pressAndReleaseKeyOn(focused, 40, [], 'ArrowDown'); |
| 275 focused = cards[1].$['collapse-button']; | 275 focused = cards[1].$['collapse-button']; |
| 276 assertEquals(focused, lastFocused); | 276 assertEquals(focused, lastFocused); |
| 277 }); | 277 }); |
| 278 }); | 278 }); |
| 279 }); | 279 }); |
| 280 | 280 |
| 281 mocha.run(); | 281 mocha.run(); |
| 282 }); | 282 }); |
| OLD | NEW |