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

Side by Side Diff: chrome/browser/resources/settings/controls/controlled_button.js

Issue 2210043002: MD Settings: add tests for <controlled-button> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge 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 Polymer({ 5 Polymer({
6 is: 'controlled-button', 6 is: 'controlled-button',
7 7
8 behaviors: [CrPolicyPrefBehavior, PrefControlBehavior], 8 behaviors: [CrPolicyPrefBehavior, PrefControlBehavior],
9 9
10 properties: { 10 properties: {
11 /** @private */ 11 /** @private */
12 controlled_: { 12 controlled_: {
13 type: Boolean, 13 type: Boolean,
14 computed: 'computeControlled_(pref)', 14 computed: 'computeControlled_(pref.*)',
15 reflectToAttribute: true, 15 reflectToAttribute: true,
16 }, 16 },
17 }, 17 },
18 18
19 /** 19 /**
20 * @param {!chrome.settingsPrivate.PrefObject} pref
21 * @return {boolean} Whether the button is disabled. 20 * @return {boolean} Whether the button is disabled.
22 * @private 21 * @private
23 */ 22 */
24 computeControlled_: function(pref) { 23 computeControlled_: function() {
24 var pref = /** @type {chrome.settingsPrivate.PrefObject} */(this.pref);
michaelpg 2016/08/04 17:54:23 isn't this already typed?
Dan Beam 2016/08/04 22:26:42 yeah, but as |undefined, wrapped in an assert() in
25 return this.isPrefPolicyControlled(pref); 25 return this.isPrefPolicyControlled(pref);
26 }, 26 },
27 27
28 /** 28 /**
29 * @param {!Event} e 29 * @param {!Event} e
30 * @private 30 * @private
31 */ 31 */
32 onIndicatorTap_: function(e) { 32 onIndicatorTap_: function(e) {
33 // Disallow <controlled-button on-tap="..."> when controlled. 33 // Disallow <controlled-button on-tap="..."> when controlled.
34 e.preventDefault(); 34 e.preventDefault();
35 e.stopPropagation(); 35 e.stopPropagation();
36 }, 36 },
37 }); 37 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698