Chromium Code Reviews| 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 // Import settings_checkbox.html before running suite. | |
|
michaelpg
2016/06/09 03:54:54
fix
Dan Beam
2016/06/09 04:53:37
Done.
| |
| 23 suiteSetup(function() { | |
| 24 return PolymerTest.importHtml('chrome://resources/polymer/v1_0/' + | |
| 25 'paper-radio-button/paper-radio-button.html'); | |
| 26 }); | |
| 27 | |
| 28 // Initialize a checked settings-checkbox before each test. | |
|
michaelpg
2016/06/09 03:54:54
fix
Dan Beam
2016/06/09 04:53:37
Done.
| |
| 29 setup(function() { | |
| 30 PolymerTest.clearBody(); | |
| 31 testElement = document.createElement('settings-radio-group'); | |
| 32 testElement.set('pref', pref); | |
| 33 document.body.appendChild(testElement); | |
| 34 }); | |
| 35 | |
| 36 test('disables paper-radio-buttons when managed', function() { | |
| 37 testElement.innerHTML = '<paper-radio-button></paper-radio-button>'; | |
|
michaelpg
2016/06/09 03:54:54
i'd prefer:
testElement.appendChild(document.crea
Dan Beam
2016/06/09 04:53:37
Done.
| |
| 38 | |
| 39 assertEquals('PAPER-RADIO-BUTTON', testElement.firstChild.tagName); | |
| 40 assertFalse(testElement.firstChild.disabled); | |
| 41 | |
| 42 testElement.set('pref.policyEnforcement', | |
| 43 chrome.settingsPrivate.PolicyEnforcement.ENFORCED); | |
| 44 assertTrue(testElement.firstChild.disabled); | |
| 45 | |
| 46 testElement.set('pref.policyEnforcement', undefined); | |
| 47 assertFalse(testElement.firstChild.disabled); | |
| 48 }); | |
| 49 }); | |
| OLD | NEW |