| 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('SettingsRadioGroup', function() { |
| 6 /** |
| 7 * Checkbox created before each test. |
| 8 * @type {SettingsRadioGroup} |
| 9 */ |
| 10 var testElement; |
| 11 |
| 12 /** |
| 13 * Pref value used in tests, should reflect checkbox 'checked' attribute. |
| 14 * @type {PrefObject} |
| 15 */ |
| 16 var pref = { |
| 17 key: 'test', |
| 18 type: chrome.settingsPrivate.PrefType.BOOLEAN, |
| 19 value: true |
| 20 }; |
| 21 |
| 22 suiteSetup(function() { |
| 23 return PolymerTest.importHtml('chrome://resources/polymer/v1_0/' + |
| 24 'paper-radio-button/paper-radio-button.html'); |
| 25 }); |
| 26 |
| 27 setup(function() { |
| 28 PolymerTest.clearBody(); |
| 29 testElement = document.createElement('settings-radio-group'); |
| 30 testElement.set('pref', pref); |
| 31 document.body.appendChild(testElement); |
| 32 }); |
| 33 |
| 34 test('disables paper-radio-buttons when managed', function() { |
| 35 testElement.appendChild(document.createElement('paper-radio-button')); |
| 36 |
| 37 assertEquals('PAPER-RADIO-BUTTON', testElement.firstChild.tagName); |
| 38 assertFalse(testElement.firstChild.disabled); |
| 39 |
| 40 testElement.set('pref.policyEnforcement', |
| 41 chrome.settingsPrivate.PolicyEnforcement.ENFORCED); |
| 42 assertTrue(testElement.firstChild.disabled); |
| 43 |
| 44 testElement.set('pref.policyEnforcement', undefined); |
| 45 assertFalse(testElement.firstChild.disabled); |
| 46 }); |
| 47 }); |
| OLD | NEW |