| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 suite('controlled button', function() { |
| 6 /** @type {ControlledButtonElement} */ |
| 7 var button; |
| 8 |
| 9 /** @type {!chrome.settingsPrivate.PrefObject} */ |
| 10 var pref = { |
| 11 key: 'test', |
| 12 type: chrome.settingsPrivate.PrefType.BOOLEAN, |
| 13 value: true |
| 14 }; |
| 15 |
| 16 setup(function() { |
| 17 PolymerTest.clearBody(); |
| 18 button = document.createElement('controlled-button'); |
| 19 button.pref = pref; |
| 20 document.body.appendChild(button); |
| 21 }); |
| 22 |
| 23 test('disables when pref is managed', function() { |
| 24 button.set('pref.policyEnforcement', |
| 25 chrome.settingsPrivate.PolicyEnforcement.ENFORCED); |
| 26 Polymer.dom.flush(); |
| 27 assertTrue(button.$$('paper-button').disabled); |
| 28 |
| 29 var indicator = button.$$('cr-policy-pref-indicator'); |
| 30 assertTrue(!!indicator); |
| 31 assertGT(indicator.clientHeight, 0); |
| 32 |
| 33 button.set('pref.policyEnforcement', undefined); |
| 34 Polymer.dom.flush(); |
| 35 assertFalse(button.$$('paper-button').disabled); |
| 36 assertEquals(0, indicator.clientHeight); |
| 37 }); |
| 38 }); |
| OLD | NEW |