| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview | |
| 7 * Behavior controlling the visibility of Settings pages. | |
| 8 * | |
| 9 * Example: | |
| 10 * behaviors: [SettingsPageVisibility], | |
| 11 */ | |
| 12 | |
| 13 /** | |
| 14 * Set this to true in tests before loading the page (e.g. in preLoad()) so that | |
| 15 * pages do not initially get created. Set this to false BEFORE modifying | |
| 16 * pageVisibility. NOTE: Changing this value after the DOM is loaded will not | |
| 17 * trigger a visibility change, pageVisibility must be modified to trigger data | |
| 18 * binding events. | |
| 19 * @type {boolean} | |
| 20 */ | |
| 21 var settingsHidePagesByDefaultForTest; | |
| 22 | |
| 23 /** @polymerBehavior */ | |
| 24 var SettingsPageVisibility = { | |
| 25 properties: { | |
| 26 /** | |
| 27 * Dictionary defining page visibility. If not set for a page, visibility | |
| 28 * will default to true, unless settingsHidePagesByDefaultForTest is set | |
| 29 * in which case visibility defaults to false. | |
| 30 * @type {Object<boolean>} | |
| 31 */ | |
| 32 pageVisibility: { | |
| 33 type: Object, | |
| 34 value: function() { return {}; }, | |
| 35 }, | |
| 36 }, | |
| 37 | |
| 38 /** | |
| 39 * @param {boolean|undefined} visibility | |
| 40 * @return {boolean} | |
| 41 */ | |
| 42 showPage: function(visibility) { | |
| 43 if (settingsHidePagesByDefaultForTest) | |
| 44 return visibility === true; | |
| 45 return visibility !== false; | |
| 46 }, | |
| 47 }; | |
| OLD | NEW |