Chromium Code Reviews| Index: chrome/test/data/webui/settings/controlled_button_tests.js |
| diff --git a/chrome/test/data/webui/settings/controlled_button_tests.js b/chrome/test/data/webui/settings/controlled_button_tests.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3c0c6e9992079832ffde29d864824c2757ae7b15 |
| --- /dev/null |
| +++ b/chrome/test/data/webui/settings/controlled_button_tests.js |
| @@ -0,0 +1,35 @@ |
| +// Copyright 2016 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. |
| + |
| +suite('controlled button', function() { |
| + /** @type {ControlledButtonElement} */ |
| + var button; |
| + |
| + /** @type {!chrome.settingsPrivate.PrefObject} */ |
| + var pref = { |
| + key: 'test', |
| + type: chrome.settingsPrivate.PrefType.BOOLEAN, |
| + value: true |
| + }; |
| + |
| + setup(function() { |
| + PolymerTest.clearBody(); |
| + button = document.createElement('controlled-button'); |
| + button.set('pref', pref); |
|
michaelpg
2016/08/04 17:54:23
button.pref = pref
Dan Beam
2016/08/04 22:26:42
Done.
|
| + document.body.appendChild(button); |
| + }); |
| + |
| + test('disables when pref is managed', function() { |
| + button.set('pref.policyEnforcement', |
| + chrome.settingsPrivate.PolicyEnforcement.ENFORCED); |
| + Polymer.dom.flush(); |
| + assertTrue(button.$$('paper-button').disabled); |
| + assertTrue(!!button.$$('cr-policy-pref-indicator')); |
|
michaelpg
2016/08/04 17:54:23
check clientHeight > 0
Dan Beam
2016/08/04 22:26:42
Done.
|
| + |
| + button.set('pref.policyEnforcement', undefined); |
| + Polymer.dom.flush(); |
| + assertFalse(button.$$('paper-button').disabled); |
| + assertEquals('none', button.$$('cr-policy-pref-indicator').style.display); |
|
michaelpg
2016/08/04 17:54:23
i'd suggest the same here... this is implementatio
Dan Beam
2016/08/04 22:26:42
Done.
|
| + }); |
| +}); |