| OLD | NEW | 
|   1 // Copyright 2016 The Chromium Authors. All rights reserved. |   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 |   2 // Use of this source code is governed by a BSD-style license that can be | 
|   3 // found in the LICENSE file. |   3 // found in the LICENSE file. | 
|   4  |   4  | 
|   5 suite('controlled radio button', function() { |   5 suite('controlled radio button', function() { | 
|   6   /** @type {ControlledRadioButtonElement} */ |   6   /** @type {ControlledRadioButtonElement} */ | 
|   7   var radioButton; |   7   var radioButton; | 
|   8  |   8  | 
|   9   /** @type {!chrome.settingsPrivate.PrefObject} */ |   9   /** @type {!chrome.settingsPrivate.PrefObject} */ | 
|  10   var pref = { |  10   var pref = { | 
|  11     key: 'test', |  11     key: 'test', | 
|  12     type: chrome.settingsPrivate.PrefType.BOOLEAN, |  12     type: chrome.settingsPrivate.PrefType.BOOLEAN, | 
|  13     value: true |  13     value: true | 
|  14   }; |  14   }; | 
|  15  |  15  | 
|  16   setup(function() { |  16   setup(function() { | 
|  17     PolymerTest.clearBody(); |  17     PolymerTest.clearBody(); | 
|  18     radioButton = document.createElement('controlled-radio-button'); |  18     radioButton = document.createElement('controlled-radio-button'); | 
|  19     radioButton.set('pref', pref); |  19     radioButton.set('pref', pref); | 
|  20     document.body.appendChild(radioButton); |  20     document.body.appendChild(radioButton); | 
|  21   }); |  21   }); | 
|  22  |  22  | 
|  23   test('disables when pref is managed', function() { |  23   test('disables when pref is managed', function() { | 
|  24     radioButton.set('pref.policyEnforcement', |  24     radioButton.set('pref.enforcement', | 
|  25                     chrome.settingsPrivate.PolicyEnforcement.ENFORCED); |  25                     chrome.settingsPrivate.Enforcement.ENFORCED); | 
|  26     Polymer.dom.flush(); |  26     Polymer.dom.flush(); | 
|  27     assertTrue(radioButton.$$('paper-radio-button').disabled); |  27     assertTrue(radioButton.$$('paper-radio-button').disabled); | 
|  28     assertFalse(!!radioButton.$$('cr-policy-pref-indicator')); |  28     assertFalse(!!radioButton.$$('cr-policy-pref-indicator')); | 
|  29  |  29  | 
|  30     radioButton.set('name', 'true'); |  30     radioButton.set('name', 'true'); | 
|  31     Polymer.dom.flush(); |  31     Polymer.dom.flush(); | 
|  32     assertTrue(!!radioButton.$$('cr-policy-pref-indicator')); |  32     assertTrue(!!radioButton.$$('cr-policy-pref-indicator')); | 
|  33  |  33  | 
|  34     radioButton.set('pref.policyEnforcement', undefined); |  34     radioButton.set('pref.enforcement', undefined); | 
|  35     Polymer.dom.flush(); |  35     Polymer.dom.flush(); | 
|  36     assertFalse(radioButton.$$('paper-radio-button').disabled); |  36     assertFalse(radioButton.$$('paper-radio-button').disabled); | 
|  37     assertEquals('none', |  37     assertEquals('none', | 
|  38                  radioButton.$$('cr-policy-pref-indicator').style.display); |  38                  radioButton.$$('cr-policy-pref-indicator').style.display); | 
|  39   }); |  39   }); | 
|  40 }); |  40 }); | 
| OLD | NEW |