| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** @fileoverview Suite of tests for the Settings basic page. */ | 5 /** @fileoverview Suite of tests for the Settings basic page. */ |
| 6 | 6 |
| 7 GEN_INCLUDE(['settings_page_browsertest.js']); | 7 GEN_INCLUDE(['settings_page_browsertest.js']); |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * @constructor | 10 * @constructor |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // Should be scrolled to the On Startup section. | 120 // Should be scrolled to the On Startup section. |
| 121 assertNotEquals(0, page.scroller.scrollTop); | 121 assertNotEquals(0, page.scroller.scrollTop); |
| 122 | 122 |
| 123 return new Promise(function(resolve) { | 123 return new Promise(function(resolve) { |
| 124 listenOnce(window, 'popstate', resolve); | 124 listenOnce(window, 'popstate', resolve); |
| 125 settings.navigateToPreviousRoute(); | 125 settings.navigateToPreviousRoute(); |
| 126 }); | 126 }); |
| 127 }).then(function() { | 127 }).then(function() { |
| 128 // Should be at the top of the page after going Back from the section. | 128 // Should be at the top of the page after going Back from the section. |
| 129 assertEquals(0, page.scroller.scrollTop); | 129 assertEquals(0, page.scroller.scrollTop); |
| 130 |
| 131 return new Promise(function(resolve) { |
| 132 listenOnce(window, 'popstate', resolve); |
| 133 window.history.forward(); |
| 134 }); |
| 135 }).then(function() { |
| 136 // Should scroll when navigating forwards from the BASIC page. |
| 137 assertNotEquals(0, page.scroller.scrollTop); |
| 130 }); | 138 }); |
| 131 }); | 139 }); |
| 132 | 140 |
| 133 test('scroll to section after exiting search', function() { | 141 test('scroll to section after exiting search', function() { |
| 134 var searchManager = new TestSearchManager(); | 142 var searchManager = new TestSearchManager(); |
| 135 settings.setSearchManagerForTesting(searchManager); | 143 settings.setSearchManagerForTesting(searchManager); |
| 136 | 144 |
| 137 settings.navigateTo(settings.Route.BASIC, | 145 settings.navigateTo(settings.Route.BASIC, |
| 138 new URLSearchParams(`search=foobar`), | 146 new URLSearchParams(`search=foobar`), |
| 139 /* removeSearch */ false); | 147 /* removeSearch */ false); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 154 } | 162 } |
| 155 }, 55); | 163 }, 55); |
| 156 }); | 164 }); |
| 157 }); | 165 }); |
| 158 }); | 166 }); |
| 159 }); | 167 }); |
| 160 | 168 |
| 161 // Run all registered tests. | 169 // Run all registered tests. |
| 162 mocha.run(); | 170 mocha.run(); |
| 163 }); | 171 }); |
| OLD | NEW |