Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: chrome/test/data/webui/settings/basic_page_browsertest.js

Issue 2552393002: MD Settings: Scroll correctly for navigations that exit search mode. (Closed)
Patch Set: fix cl to make review easier Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/settings/settings_page/main_page_behavior.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 return new Promise(function(resolve) { 75 return new Promise(function(resolve) {
76 listenOnce(window, 'popstate', resolve); 76 listenOnce(window, 'popstate', resolve);
77 settings.navigateToPreviousRoute(); 77 settings.navigateToPreviousRoute();
78 }); 78 });
79 }).then(function() { 79 }).then(function() {
80 // Should be at the top of the page after going Back from the section. 80 // Should be at the top of the page after going Back from the section.
81 assertEquals(0, page.scroller.scrollTop); 81 assertEquals(0, page.scroller.scrollTop);
82 }); 82 });
83 }); 83 });
84
85 test('scroll to section after exiting search', function() {
86 // Enter search mode to show all the sections.
87 var settingsMain = Polymer.dom().querySelector('* /deep/ settings-main');
88 assert(!!settingsMain);
89 settingsMain.inSearchMode_ = true;
90 Polymer.dom.flush();
91
92 // Set all the sections to be hidden by search.
93 var sections =
94 Polymer.dom().querySelectorAll('* /deep/ settings-section');
95 for (var i = 0; i < sections.length; i++)
96 sections[i].hiddenBySearch = true;
dpapad 2016/12/07 00:57:10 Lines 87 to 96, redo what the actual code does, se
tommycli 2016/12/08 00:52:15 Done. This was so nasty I spent all day trying cle
97 Polymer.dom.flush();
98
99 // Verify that the On Startup section is hidden.
100 var page = self.getPage('basic');
101 var onStartup = self.getSection(page, 'onStartup');
102 assertTrue(!!onStartup);
103 assertEquals(0, onStartup.offsetHeight);
104
105 return new Promise(function(resolve) {
106 // Manually set the last search query to something different to trigger
107 // the search clearing code when we navigate.
108 var settingsUi = Polymer.dom().querySelector('* /deep/ settings-ui');
109 assert(!!settingsUi);
110 settingsUi.lastSearchQuery_ = 'foobar';
111
112 settings.navigateTo(settings.Route.ON_STARTUP,
113 /* dynamicParams */ null,
114 /* removeSearch */ true);
115
116 // Should (after some time) be scrolled to the On Startup section.
117 var intervalId = window.setInterval(function() {
118 if (page.scroller.scrollTop != 0) {
119 window.clearInterval(intervalId);
120 resolve();
121 }
122 }, 55);
123 });
124 });
84 }); 125 });
85 126
86 // Run all registered tests. 127 // Run all registered tests.
87 mocha.run(); 128 mocha.run();
88 }); 129 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/settings_page/main_page_behavior.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698