| OLD | NEW |
| 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 /** | 5 /** |
| 6 * The |name| is shown in the gui. The |value| us use to set or compare with | 6 * The |name| is shown in the gui. The |value| us use to set or compare with |
| 7 * the preference value. | 7 * the preference value. |
| 8 * @typedef {{ | 8 * @typedef {{ |
| 9 * name: string, | 9 * name: string, |
| 10 * value: (number|string) | 10 * value: (number|string) |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 /** | 90 /** |
| 91 * Check to see if we have all the pieces needed to enable the control. | 91 * Check to see if we have all the pieces needed to enable the control. |
| 92 * @param {DropdownMenuOptionList} menuOptions | 92 * @param {DropdownMenuOptionList} menuOptions |
| 93 * @private | 93 * @private |
| 94 */ | 94 */ |
| 95 checkSetup_: function(menuOptions) { | 95 checkSetup_: function(menuOptions) { |
| 96 if (!this.menuOptions.length) | 96 if (!this.menuOptions.length) |
| 97 return; | 97 return; |
| 98 | 98 |
| 99 this.menuLabel_ = this.label; | 99 // Do not set |menuLabel_| to a falsy value: http://goo.gl/OnKYko |
| 100 // (paper-dropdown-menu#181). |
| 101 this.menuLabel_ = this.label || ' '; |
| 100 this.updateSelected_(); | 102 this.updateSelected_(); |
| 101 }, | 103 }, |
| 102 | 104 |
| 103 /** | 105 /** |
| 104 * Pass the selection change to the pref value. | 106 * Pass the selection change to the pref value. |
| 105 * @private | 107 * @private |
| 106 */ | 108 */ |
| 107 onSelect_: function() { | 109 onSelect_: function() { |
| 108 if (!this.pref || this.selected_ == undefined || | 110 if (!this.pref || this.selected_ == undefined || |
| 109 this.selected_ == this.notFoundValue_) { | 111 this.selected_ == this.notFoundValue_) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 }, | 144 }, |
| 143 | 145 |
| 144 /** | 146 /** |
| 145 * @return {boolean} | 147 * @return {boolean} |
| 146 * @private | 148 * @private |
| 147 */ | 149 */ |
| 148 shouldDisableMenu_: function() { | 150 shouldDisableMenu_: function() { |
| 149 return this.disabled || !this.menuOptions.length; | 151 return this.disabled || !this.menuOptions.length; |
| 150 }, | 152 }, |
| 151 }); | 153 }); |
| OLD | NEW |