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

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

Issue 2307703002: MD Settings: Fix Advanced Toggle when on an Advanced section route. (Closed)
Patch Set: fix formatting Created 4 years, 3 months 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_main/settings_main.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 cr.define('settings_main_page', function() { 5 cr.define('settings_main_page', function() {
6 /** 6 /**
7 * @implements {SearchManager} 7 * @implements {SearchManager}
8 */ 8 */
9 var TestSearchManager = function() { 9 var TestSearchManager = function() {
10 /** @private {boolean} */ 10 /** @private {boolean} */
(...skipping 24 matching lines...) Expand all
35 }; 35 };
36 36
37 function registerTests() { 37 function registerTests() {
38 var settingsPrefs = null; 38 var settingsPrefs = null;
39 39
40 suiteSetup(function() { 40 suiteSetup(function() {
41 settingsPrefs = document.createElement('settings-prefs'); 41 settingsPrefs = document.createElement('settings-prefs');
42 return CrSettingsPrefs.initialized; 42 return CrSettingsPrefs.initialized;
43 }); 43 });
44 44
45 suite('SearchTests', function() { 45 suite('MainPageTests', function() {
46 /** @type {?TestSearchManager} */ 46 /** @type {?TestSearchManager} */
47 var searchManager = null; 47 var searchManager = null;
48 48
49 /** @type {?SettingsMainElement} */ 49 /** @type {?SettingsMainElement} */
50 var settingsMain = null; 50 var settingsMain = null;
51 51
52 setup(function() { 52 setup(function() {
53 settings.navigateTo(settings.Route.BASIC);
53 searchManager = new TestSearchManager(); 54 searchManager = new TestSearchManager();
54 settings.setSearchManagerForTesting(searchManager); 55 settings.setSearchManagerForTesting(searchManager);
55 PolymerTest.clearBody(); 56 PolymerTest.clearBody();
56 settingsMain = document.createElement('settings-main'); 57 settingsMain = document.createElement('settings-main');
57 settingsMain.prefs = settingsPrefs.prefs; 58 settingsMain.prefs = settingsPrefs.prefs;
58 settingsMain.toolbarSpinnerActive = false; 59 settingsMain.toolbarSpinnerActive = false;
59 document.body.appendChild(settingsMain); 60 document.body.appendChild(settingsMain);
60 }); 61 });
61 62
62 teardown(function() { settingsMain.remove(); }); 63 teardown(function() { settingsMain.remove(); });
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 return settingsMain.searchContents('Query1').then(function() { 116 return settingsMain.searchContents('Query1').then(function() {
116 searchManager.setMatchesFound(false); 117 searchManager.setMatchesFound(false);
117 return settingsMain.searchContents(''); 118 return settingsMain.searchContents('');
118 }).then(function() { 119 }).then(function() {
119 Polymer.dom.flush(); 120 Polymer.dom.flush();
120 // Checking that it remains hidden after results are cleared. 121 // Checking that it remains hidden after results are cleared.
121 assertEquals( 122 assertEquals(
122 'none', settingsMain.$$('settings-advanced-page').style.display); 123 'none', settingsMain.$$('settings-advanced-page').style.display);
123 }); 124 });
124 }); 125 });
126
127 test('can collapse advanced on advanced section route', function() {
128 settings.navigateTo(settings.Route.PRIVACY);
129 Polymer.dom.flush();
130
131 var advancedToggle = settingsMain.$$('#advancedToggle');
132 assertTrue(!!advancedToggle);
133
134 MockInteractions.tap(advancedToggle);
135 Polymer.dom.flush();
136
137 assertFalse(settingsMain.showPages_.advanced);
138 });
139
140 test('navigating to a basic page does not collapse advanced', function() {
141 settings.navigateTo(settings.Route.PRIVACY);
142 Polymer.dom.flush();
143
144 var advancedToggle = settingsMain.$$('#advancedToggle');
145 assertTrue(!!advancedToggle);
146
147 settings.navigateTo(settings.Route.PEOPLE);
148 Polymer.dom.flush();
149
150 assertTrue(settingsMain.showPages_.advanced);
151 });
125 }); 152 });
126 } 153 }
127 154
128 return { 155 return {
129 registerTests: registerTests, 156 registerTests: registerTests,
130 }; 157 };
131 }); 158 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/settings_main/settings_main.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698