Chromium Code Reviews| Index: chrome/test/data/webui/settings/radio_group_tests.js |
| diff --git a/chrome/test/data/webui/settings/radio_group_tests.js b/chrome/test/data/webui/settings/radio_group_tests.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2d5ee0ae3c61f84f490845db53b4b483c9063d5d |
| --- /dev/null |
| +++ b/chrome/test/data/webui/settings/radio_group_tests.js |
| @@ -0,0 +1,49 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +suite('SettingsRadioGroup', function() { |
| + /** |
| + * Checkbox created before each test. |
| + * @type {SettingsRadioGroup} |
| + */ |
| + var testElement; |
| + |
| + /** |
| + * Pref value used in tests, should reflect checkbox 'checked' attribute. |
| + * @type {PrefObject} |
| + */ |
| + var pref = { |
| + key: 'test', |
| + type: chrome.settingsPrivate.PrefType.BOOLEAN, |
| + value: true |
| + }; |
| + |
| + // Import settings_checkbox.html before running suite. |
|
michaelpg
2016/06/09 03:54:54
fix
Dan Beam
2016/06/09 04:53:37
Done.
|
| + suiteSetup(function() { |
| + return PolymerTest.importHtml('chrome://resources/polymer/v1_0/' + |
| + 'paper-radio-button/paper-radio-button.html'); |
| + }); |
| + |
| + // 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.
|
| + setup(function() { |
| + PolymerTest.clearBody(); |
| + testElement = document.createElement('settings-radio-group'); |
| + testElement.set('pref', pref); |
| + document.body.appendChild(testElement); |
| + }); |
| + |
| + test('disables paper-radio-buttons when managed', function() { |
| + 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.
|
| + |
| + assertEquals('PAPER-RADIO-BUTTON', testElement.firstChild.tagName); |
| + assertFalse(testElement.firstChild.disabled); |
| + |
| + testElement.set('pref.policyEnforcement', |
| + chrome.settingsPrivate.PolicyEnforcement.ENFORCED); |
| + assertTrue(testElement.firstChild.disabled); |
| + |
| + testElement.set('pref.policyEnforcement', undefined); |
| + assertFalse(testElement.firstChild.disabled); |
| + }); |
| +}); |