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

Unified Diff: ui/webui/resources/cr_elements/policy/cr_policy_network_indicator.js

Issue 2625213002: WebUI: Add cr_policy_network_indicator_tests.js (Closed)
Patch Set: Rebase Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ui/webui/resources/cr_elements/policy/cr_policy_network_indicator.js
diff --git a/ui/webui/resources/cr_elements/policy/cr_policy_network_indicator.js b/ui/webui/resources/cr_elements/policy/cr_policy_network_indicator.js
index 16dae611e68ae8b8d6cd3af25ddbc4814bd36189..c22ade462a5bf91f49b2a46c6689556ea3c82559 100644
--- a/ui/webui/resources/cr_elements/policy/cr_policy_network_indicator.js
+++ b/ui/webui/resources/cr_elements/policy/cr_policy_network_indicator.js
@@ -17,13 +17,10 @@ Polymer({
* Network property associated with the indicator.
* @type {!CrOnc.ManagedProperty|undefined}
*/
- property: {type: Object, observer: 'propertyChanged_'},
+ property: Object,
- /**
- * Which indicator type to show (or NONE).
- * @type {!CrPolicyIndicatorType}
- */
- indicatorType: {type: String, value: CrPolicyIndicatorType.NONE},
+ /** @private {!CrPolicyIndicatorType} */
+ indicatorType_: {type: String, value: CrPolicyIndicatorType.NONE},
/**
* Recommended value for non enforced properties.
@@ -32,13 +29,13 @@ Polymer({
recommended_: Object,
},
- /**
- * @param {!CrOnc.ManagedProperty} property Always defined property value.
- * @private
- */
- propertyChanged_: function(property) {
+ observers: ['propertyChanged_(property.*)'],
+
+ /** @private */
+ propertyChanged_: function() {
+ var property = this.property;
if (!this.isControlled(property)) {
- this.indicatorType = CrPolicyIndicatorType.NONE;
+ this.indicatorType_ = CrPolicyIndicatorType.NONE;
return;
}
var effective = property.Effective;
@@ -51,22 +48,22 @@ Polymer({
// We ignore UserEditable unless there is a UserPolicy.
this.recommended_ =
/** @type {!CrOnc.NetworkPropertyType} */ (property.UserPolicy);
- this.indicatorType = CrPolicyIndicatorType.RECOMMENDED;
+ this.indicatorType_ = CrPolicyIndicatorType.RECOMMENDED;
} else if (
property.DeviceEditable === true &&
property.hasOwnProperty('DevicePolicy')) {
// We ignore DeviceEditable unless there is a DevicePolicy.
this.recommended_ =
/** @type {!CrOnc.NetworkPropertyType} */ (property.DevicePolicy);
- this.indicatorType = CrPolicyIndicatorType.RECOMMENDED;
+ this.indicatorType_ = CrPolicyIndicatorType.RECOMMENDED;
} else if (effective == 'UserPolicy') {
- this.indicatorType = CrPolicyIndicatorType.USER_POLICY;
+ this.indicatorType_ = CrPolicyIndicatorType.USER_POLICY;
} else if (effective == 'DevicePolicy') {
- this.indicatorType = CrPolicyIndicatorType.DEVICE_POLICY;
+ this.indicatorType_ = CrPolicyIndicatorType.DEVICE_POLICY;
} else if (effective == 'ActiveExtension') {
- this.indicatorType = CrPolicyIndicatorType.EXTENSION;
+ this.indicatorType_ = CrPolicyIndicatorType.EXTENSION;
} else {
- this.indicatorType = CrPolicyIndicatorType.NONE;
+ this.indicatorType_ = CrPolicyIndicatorType.NONE;
}
},
@@ -76,13 +73,12 @@ Polymer({
*/
getTooltip_: function() {
var matches;
- if (this.indicatorType == CrPolicyIndicatorType.RECOMMENDED &&
- this.property) {
+ if (this.indicatorType_ == CrPolicyIndicatorType.RECOMMENDED) {
var value = this.property.Active;
if (value == undefined && this.property.Effective)
value = this.property[this.property.Effective];
matches = value == this.recommended_;
}
- return this.getPolicyIndicatorTooltip(this.indicatorType, '', matches);
+ return this.getPolicyIndicatorTooltip(this.indicatorType_, '', matches);
}
});

Powered by Google App Engine
This is Rietveld 408576698