| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** @fileoverview Suite of tests for settings-checkbox. */ | 5 /** @fileoverview Suite of tests for settings-checkbox. */ |
| 6 cr.define('settings_checkbox', function() { | 6 cr.define('settings_checkbox', function() { |
| 7 function registerTests() { | 7 function registerTests() { |
| 8 suite('SettingsCheckbox', function() { | 8 suite('SettingsCheckbox', function() { |
| 9 /** | 9 /** |
| 10 * Checkbox created before each test. | 10 * Checkbox created before each test. |
| 11 * @type {SettingsCheckbox} | 11 * @type {SettingsCheckbox} |
| 12 */ | 12 */ |
| 13 var testElement; | 13 var testElement; |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * Pref value used in tests, should reflect checkbox 'checked' attribute. | 16 * Pref value used in tests, should reflect checkbox 'checked' attribute. |
| 17 * @type {SettingsCheckbox} | 17 * @type {SettingsCheckbox} |
| 18 */ | 18 */ |
| 19 var pref = { | 19 var pref = { |
| 20 key: 'test', | 20 key: 'test', |
| 21 type: chrome.settingsPrivate.PrefType.BOOLEAN, | 21 type: chrome.settingsPrivate.PrefType.BOOLEAN, |
| 22 value: true | 22 value: true |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 // Import settings_checkbox.html before running suite. | |
| 26 suiteSetup(function() { | |
| 27 return PolymerTest.importHtml( | |
| 28 'chrome://md-settings/controls/settings_checkbox.html'); | |
| 29 }); | |
| 30 | |
| 31 // Initialize a checked settings-checkbox before each test. | 25 // Initialize a checked settings-checkbox before each test. |
| 32 setup(function() { | 26 setup(function() { |
| 33 PolymerTest.clearBody(); | 27 PolymerTest.clearBody(); |
| 34 testElement = document.createElement('settings-checkbox'); | 28 testElement = document.createElement('settings-checkbox'); |
| 35 testElement.set('pref', pref); | 29 testElement.set('pref', pref); |
| 36 document.body.appendChild(testElement); | 30 document.body.appendChild(testElement); |
| 37 }); | 31 }); |
| 38 | 32 |
| 39 test('responds to checked attribute', function() { | 33 test('responds to checked attribute', function() { |
| 40 assertTrue(testElement.checked); | 34 assertTrue(testElement.checked); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 assertTrue(testElement.checked); | 79 assertTrue(testElement.checked); |
| 86 assertEquals(1, prefNum.value); | 80 assertEquals(1, prefNum.value); |
| 87 }); | 81 }); |
| 88 }); | 82 }); |
| 89 } | 83 } |
| 90 | 84 |
| 91 return { | 85 return { |
| 92 registerTests: registerTests, | 86 registerTests: registerTests, |
| 93 }; | 87 }; |
| 94 }); | 88 }); |
| OLD | NEW |