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

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

Issue 2506793002: MD Settings: Fix Back navigation from section route to BASIC route. (Closed)
Patch Set: address comments Created 4 years, 1 month 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 else 45 else
46 sections = sections.concat(['internet', 'device']); 46 sections = sections.concat(['internet', 'device']);
47 47
48 for (var i = 0; i < sections.length; i++) { 48 for (var i = 0; i < sections.length; i++) {
49 var section = self.getSection(page, sections[i]); 49 var section = self.getSection(page, sections[i]);
50 expectTrue(!!section); 50 expectTrue(!!section);
51 self.verifySubpagesHidden(section); 51 self.verifySubpagesHidden(section);
52 } 52 }
53 }); 53 });
54 54
55 // This test checks for a regression that occurred with scrollToSection_
56 // failing to find its host element.
57 test('scroll to section', function() { 55 test('scroll to section', function() {
58 // Setting the page and section will cause a scrollToSection_. 56 // Setting the page and section will cause a scrollToSection_.
59 settings.navigateTo(settings.Route.ON_STARTUP); 57 settings.navigateTo(settings.Route.ON_STARTUP);
60 58
59 var page = self.getPage('basic');
60
61 return new Promise(function(resolve, reject) { 61 return new Promise(function(resolve, reject) {
62 // This test checks for a regression that occurred with scrollToSection_
63 // failing to find its host element.
62 var intervalId = window.setInterval(function() { 64 var intervalId = window.setInterval(function() {
63 var page = self.getPage('basic'); 65 var page = self.getPage('basic');
64 if (self.getSection(page, settings.getCurrentRoute().section)) { 66 if (self.getSection(page, settings.getCurrentRoute().section)) {
65 window.clearInterval(intervalId); 67 window.clearInterval(intervalId);
66 resolve(); 68 resolve();
67 } 69 }
68 }, 55); 70 }, 55);
69 }.bind(self)); 71 }.bind(self)).then(function() {
72 // Should be scrolled to the On Startup section.
73 assertNotEquals(0, page.scroller.scrollTop);
74
75 return new Promise(function(resolve) {
76 listenOnce(window, 'popstate', resolve);
77 settings.navigateToPreviousRoute();
78 });
79 }).then(function() {
80 // Should be at the top of the page after going Back from the section.
81 assertEquals(0, page.scroller.scrollTop);
82 });
70 }); 83 });
71 }); 84 });
72 85
73 // Run all registered tests. 86 // Run all registered tests.
74 mocha.run(); 87 mocha.run();
75 }); 88 });
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