| 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. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 test('does not change when disabled', function() { | 59 test('does not change when disabled', function() { |
| 60 testElement.checked = false; | 60 testElement.checked = false; |
| 61 testElement.setAttribute('disabled', ''); | 61 testElement.setAttribute('disabled', ''); |
| 62 assertTrue(testElement.disabled); | 62 assertTrue(testElement.disabled); |
| 63 assertTrue(testElement.$.checkbox.disabled); | 63 assertTrue(testElement.$.checkbox.disabled); |
| 64 | 64 |
| 65 MockInteractions.tap(testElement.$.checkbox); | 65 MockInteractions.tap(testElement.$.checkbox); |
| 66 assertFalse(testElement.checked); | 66 assertFalse(testElement.checked); |
| 67 assertFalse(testElement.$.checkbox.checked); | 67 assertFalse(testElement.$.checkbox.checked); |
| 68 }); | 68 }); |
| 69 |
| 70 test('numerical pref', function() { |
| 71 var prefNum = { |
| 72 key: 'test', |
| 73 type: chrome.settingsPrivate.PrefType.NUMBER, |
| 74 value: 1 |
| 75 }; |
| 76 |
| 77 testElement.set('pref', prefNum); |
| 78 assertTrue(testElement.checked); |
| 79 |
| 80 testElement.removeAttribute('checked'); |
| 81 assertFalse(testElement.checked); |
| 82 assertEquals(0, prefNum.value); |
| 83 |
| 84 testElement.setAttribute('checked', ''); |
| 85 assertTrue(testElement.checked); |
| 86 assertEquals(1, prefNum.value); |
| 87 }); |
| 69 }); | 88 }); |
| 70 } | 89 } |
| 71 | 90 |
| 72 return { | 91 return { |
| 73 registerTests: registerTests, | 92 registerTests: registerTests, |
| 74 }; | 93 }; |
| 75 }); | 94 }); |
| OLD | NEW |