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

Side by Side Diff: chrome/browser/resources/settings/settings_page/main_page_behavior.js

Issue 2185493003: MD Settings: Adding some unit tests for <settings-main>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@search_no_results
Patch Set: Nit. Created 4 years, 4 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
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 // Fast out, slow in. 5 // Fast out, slow in.
6 var EASING_FUNCTION = 'cubic-bezier(0.4, 0, 0.2, 1)'; 6 var EASING_FUNCTION = 'cubic-bezier(0.4, 0, 0.2, 1)';
7 var EXPAND_DURATION = 350; 7 var EXPAND_DURATION = 350;
8 8
9 /** 9 /**
10 * Calls |readyTest| repeatedly until it returns true, then calls 10 * Calls |readyTest| repeatedly until it returns true, then calls
(...skipping 23 matching lines...) Expand all
34 * @type {string} Selector to get the sections. Derived elements 34 * @type {string} Selector to get the sections. Derived elements
35 * must override. 35 * must override.
36 */ 36 */
37 sectionSelector: '', 37 sectionSelector: '',
38 38
39 /** @type {?Element} The scrolling container. */ 39 /** @type {?Element} The scrolling container. */
40 scroller: null, 40 scroller: null,
41 41
42 /** @override */ 42 /** @override */
43 attached: function() { 43 attached: function() {
44 this.scroller = this.domHost && this.domHost.parentNode.$.mainContainer; 44 if (this.domHost && this.domHost.parentNode.tagName == 'PAPER-HEADER-PANEL')
45 this.scroller = this.domHost.parentNode.$.mainContainer;
46 else
47 this.scroller = document.body; // Used in unit tests.
michaelpg 2016/07/30 05:38:44 could this just be assert(this.parentElement)? if
michaelpg 2016/08/02 20:45:20 or better, see my new suggestion
dpapad 2016/08/02 22:33:15 Previous suggestion does not work. this.parentElem
45 }, 48 },
46 49
47 /** 50 /**
48 * Hides or unhides the sections not being expanded. 51 * Hides or unhides the sections not being expanded.
49 * @param {string} sectionName The section to keep visible. 52 * @param {string} sectionName The section to keep visible.
50 * @param {boolean} hidden Whether the sections should be hidden. 53 * @param {boolean} hidden Whether the sections should be hidden.
51 * @private 54 * @private
52 */ 55 */
53 toggleOtherSectionsHidden_: function(sectionName, hidden) { 56 toggleOtherSectionsHidden_: function(sectionName, hidden) {
54 var sections = Polymer.dom(this.root).querySelectorAll( 57 var sections = Polymer.dom(this.root).querySelectorAll(
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 this.$$('[section=' + section + ']')); 428 this.$$('[section=' + section + ']'));
426 }, 429 },
427 }; 430 };
428 431
429 432
430 /** @polymerBehavior */ 433 /** @polymerBehavior */
431 var RoutableBehavior = [ 434 var RoutableBehavior = [
432 MainPageBehavior, 435 MainPageBehavior,
433 RoutableBehaviorImpl 436 RoutableBehaviorImpl
434 ]; 437 ];
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698