Chromium Code Reviews| 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-toggle-button. */ | 5 /** @fileoverview Suite of tests for settings-toggle-button. */ |
| 6 cr.define('settings_toggle_button', function() { | 6 cr.define('settings_toggle_button', function() { |
| 7 function registerTests() { | 7 function registerTests() { |
| 8 suite('SettingsToggleButton', function() { | 8 suite('SettingsToggleButton', function() { |
| 9 /** | 9 /** |
| 10 * Toggle button created before each test. | 10 * Toggle button created before each test. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 testElement.checked = false; | 57 testElement.checked = false; |
| 58 testElement.setAttribute('disabled', ''); | 58 testElement.setAttribute('disabled', ''); |
| 59 assertTrue(testElement.disabled); | 59 assertTrue(testElement.disabled); |
| 60 assertTrue(testElement.$.control.disabled); | 60 assertTrue(testElement.$.control.disabled); |
| 61 | 61 |
| 62 MockInteractions.tap(testElement.$.control); | 62 MockInteractions.tap(testElement.$.control); |
| 63 assertFalse(testElement.checked); | 63 assertFalse(testElement.checked); |
| 64 assertFalse(testElement.$.control.checked); | 64 assertFalse(testElement.$.control.checked); |
| 65 }); | 65 }); |
| 66 | 66 |
| 67 test('inverted', function() { | |
| 68 testElement.setAttribute('inverted', ''); | |
|
Dan Beam
2017/03/01 00:27:00
nit: testElement.inverted = true;
stevenjb
2017/03/01 00:35:13
Done.
| |
| 69 var pref = { | |
| 70 key: 'test', | |
| 71 type: chrome.settingsPrivate.PrefType.BOOLEAN, | |
| 72 value: true | |
| 73 }; | |
| 74 testElement.set('pref', pref); | |
|
Dan Beam
2017/03/01 00:27:00
nit:
testElement.set('pref', {
key: 'test',
t
stevenjb
2017/03/01 00:35:13
Done.
| |
| 75 | |
| 76 assertTrue(testElement.pref.value); | |
| 77 assertFalse(testElement.checked); | |
| 78 | |
| 79 MockInteractions.tap(testElement.$.control); | |
| 80 assertFalse(testElement.pref.value); | |
| 81 assertTrue(testElement.checked); | |
| 82 | |
| 83 MockInteractions.tap(testElement.$.control); | |
| 84 assertTrue(testElement.pref.value); | |
| 85 assertFalse(testElement.checked); | |
| 86 }); | |
| 87 | |
| 67 test('numerical pref', function() { | 88 test('numerical pref', function() { |
| 68 var prefNum = { | 89 var prefNum = { |
| 69 key: 'test', | 90 key: 'test', |
| 70 type: chrome.settingsPrivate.PrefType.NUMBER, | 91 type: chrome.settingsPrivate.PrefType.NUMBER, |
| 71 value: 1 | 92 value: 1 |
| 72 }; | 93 }; |
| 73 | 94 |
| 74 testElement.set('pref', prefNum); | 95 testElement.set('pref', prefNum); |
| 75 assertTrue(testElement.checked); | 96 assertTrue(testElement.checked); |
| 76 | 97 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 131 assertTrue(testElement.checked); | 152 assertTrue(testElement.checked); |
| 132 assertEquals(1, prefNum.value); | 153 assertEquals(1, prefNum.value); |
| 133 }); | 154 }); |
| 134 }); | 155 }); |
| 135 } | 156 } |
| 136 | 157 |
| 137 return { | 158 return { |
| 138 registerTests: registerTests, | 159 registerTests: registerTests, |
| 139 }; | 160 }; |
| 140 }); | 161 }); |
| OLD | NEW |