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

Unified Diff: chrome/test/data/webui/cr_elements/cr_policy_indicator_behavior_tests.js

Issue 2696903005: Move common cr-policy-indicator behavior into CrPolicyIndicatorBehavior (Closed)
Patch Set: rebase Created 3 years, 10 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: chrome/test/data/webui/cr_elements/cr_policy_indicator_behavior_tests.js
diff --git a/chrome/test/data/webui/cr_elements/cr_policy_indicator_behavior_tests.js b/chrome/test/data/webui/cr_elements/cr_policy_indicator_behavior_tests.js
new file mode 100644
index 0000000000000000000000000000000000000000..049c9b1b359d96c60b566a12c2e1b7b6ec8eefa1
--- /dev/null
+++ b/chrome/test/data/webui/cr_elements/cr_policy_indicator_behavior_tests.js
@@ -0,0 +1,59 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/** @fileoverview Suite of tests for CrPolicyIndicatorBehavior. */
+suite('CrPolicyIndicatorBehavior', function() {
+ var TestIndicator;
+ suiteSetup(function() {
+ TestIndicator = Polymer({
+ is: 'test-indicator',
+
+ behaviors: [CrPolicyIndicatorBehavior],
+ });
+ });
+
+ var indicator;
+ setup(function() {
+ indicator = new TestIndicator;
+ });
+
+ test('default indicator is blank', function() {
+ assertEquals(CrPolicyIndicatorType.NONE, indicator.indicatorType)
+ assertFalse(indicator.indicatorVisible);
+ });
+
+ test('policy-controlled indicator', function() {
+ indicator.indicatorType = CrPolicyIndicatorType.USER_POLICY;
+
+ assertTrue(indicator.indicatorVisible);
+ assertEquals('cr20:domain', indicator.indicatorIcon);
+ assertEquals('policy', indicator.indicatorTooltip);
+ });
+
+ test('recommended indicator', function() {
+ indicator.indicatorType = CrPolicyIndicatorType.RECOMMENDED;
+
+ assertTrue(indicator.indicatorVisible);
+ assertEquals('cr20:domain', indicator.indicatorIcon);
+ assertEquals(
+ 'matches',
+ indicator.getIndicatorTooltip(
+ indicator.indicatorType, indicator.indicatorSourceName, true));
+ assertEquals(
+ 'differs',
+ indicator.getIndicatorTooltip(
+ indicator.indicatorType, indicator.indicatorSourceName, false));
+ });
+
+ if (cr.isChromeOS) {
+ test('primary-user controlled indicator', function() {
+ indicator.indicatorType = CrPolicyIndicatorType.PRIMARY_USER;
+ indicator.indicatorSourceName = 'user@example.com';
+
+ assertTrue(indicator.indicatorVisible);
+ assertEquals('cr:group', indicator.indicatorIcon);
+ assertEquals('shared: user@example.com', indicator.indicatorTooltip);
+ });
+ }
+});

Powered by Google App Engine
This is Rietveld 408576698