| 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 radio button', function() { |
| 6 /** @type {ControlledRadioButtonElement} */ |
| 7 var radioButton; |
| 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 radioButton = document.createElement('controlled-radio-button'); |
| 19 radioButton.set('pref', pref); |
| 20 document.body.appendChild(radioButton); |
| 21 }); |
| 22 |
| 23 test('disables when pref is managed', function() { |
| 24 radioButton.set('pref.policyEnforcement', |
| 25 chrome.settingsPrivate.PolicyEnforcement.ENFORCED); |
| 26 Polymer.dom.flush(); |
| 27 assertTrue(radioButton.$$('paper-radio-button').disabled); |
| 28 assertFalse(!!radioButton.$$('cr-policy-pref-indicator')); |
| 29 |
| 30 radioButton.set('name', 'true'); |
| 31 Polymer.dom.flush(); |
| 32 assertTrue(!!radioButton.$$('cr-policy-pref-indicator')); |
| 33 |
| 34 radioButton.set('pref.policyEnforcement', undefined); |
| 35 Polymer.dom.flush(); |
| 36 assertFalse(radioButton.$$('paper-radio-button').disabled); |
| 37 assertEquals('none', |
| 38 radioButton.$$('cr-policy-pref-indicator').style.display); |
| 39 }); |
| 40 }); |
| OLD | NEW |