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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/settings/basic_page_browsertest.js
diff --git a/chrome/test/data/webui/settings/basic_page_browsertest.js b/chrome/test/data/webui/settings/basic_page_browsertest.js
index 9fde2be0af3303f876535a5e2aadf5c362832897..20c6a91e06fe2c5ef3ef06a70f52da4fe18baf14 100644
--- a/chrome/test/data/webui/settings/basic_page_browsertest.js
+++ b/chrome/test/data/webui/settings/basic_page_browsertest.js
@@ -81,6 +81,47 @@ TEST_F('SettingsBasicPageBrowserTest', 'MAYBE_Load', function() {
assertEquals(0, page.scroller.scrollTop);
});
});
+
+ test('scroll to section after exiting search', function() {
+ // Enter search mode to show all the sections.
+ var settingsMain = Polymer.dom().querySelector('* /deep/ settings-main');
+ assert(!!settingsMain);
+ settingsMain.inSearchMode_ = true;
+ Polymer.dom.flush();
+
+ // Set all the sections to be hidden by search.
+ var sections =
+ Polymer.dom().querySelectorAll('* /deep/ settings-section');
+ for (var i = 0; i < sections.length; i++)
+ 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
+ Polymer.dom.flush();
+
+ // Verify that the On Startup section is hidden.
+ var page = self.getPage('basic');
+ var onStartup = self.getSection(page, 'onStartup');
+ assertTrue(!!onStartup);
+ assertEquals(0, onStartup.offsetHeight);
+
+ return new Promise(function(resolve) {
+ // Manually set the last search query to something different to trigger
+ // the search clearing code when we navigate.
+ var settingsUi = Polymer.dom().querySelector('* /deep/ settings-ui');
+ assert(!!settingsUi);
+ settingsUi.lastSearchQuery_ = 'foobar';
+
+ settings.navigateTo(settings.Route.ON_STARTUP,
+ /* dynamicParams */ null,
+ /* removeSearch */ true);
+
+ // Should (after some time) be scrolled to the On Startup section.
+ var intervalId = window.setInterval(function() {
+ if (page.scroller.scrollTop != 0) {
+ window.clearInterval(intervalId);
+ resolve();
+ }
+ }, 55);
+ });
+ });
});
// Run all registered tests.
« 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