Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Side by Side Diff: chrome/test/data/webui/settings/people_page_sync_page_test.js

Issue 2617533003: MD Settings: change most checkboxes to toggles (leave dialogs alone) (Closed)
Patch Set: fix tests Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 cr.define('settings_people_page_sync_page', function() { 5 cr.define('settings_people_page_sync_page', function() {
6 /** 6 /**
7 * @constructor 7 * @constructor
8 * @implements {settings.SyncBrowserProxy} 8 * @implements {settings.SyncBrowserProxy}
9 * @extends {settings.TestBrowserProxy} 9 * @extends {settings.TestBrowserProxy}
10 */ 10 */
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 // Should remain on the CONFIGURE page even if the passphrase failed. 190 // Should remain on the CONFIGURE page even if the passphrase failed.
191 cr.webUIListenerCallback('page-status-changed', 191 cr.webUIListenerCallback('page-status-changed',
192 settings.PageStatus.PASSPHRASE_FAILED); 192 settings.PageStatus.PASSPHRASE_FAILED);
193 assertFalse(configurePage.hidden); 193 assertFalse(configurePage.hidden);
194 assertTrue(timeoutPage.hidden); 194 assertTrue(timeoutPage.hidden);
195 assertTrue(spinnerPage.hidden); 195 assertTrue(spinnerPage.hidden);
196 }); 196 });
197 197
198 test('SettingIndividualDatatypes', function() { 198 test('SettingIndividualDatatypes', function() {
199 var syncAllDataTypesCheckbox = syncPage.$.syncAllDataTypesCheckbox; 199 var syncAllDataTypesControl = syncPage.$.syncAllDataTypesControl;
200 assertFalse(syncAllDataTypesCheckbox.disabled); 200 assertFalse(syncAllDataTypesControl.disabled);
201 assertTrue(syncAllDataTypesCheckbox.checked); 201 assertTrue(syncAllDataTypesControl.checked);
202 202
203 // Assert that all the individual datatype checkboxes are disabled. 203 // Assert that all the individual datatype controls are disabled.
204 var datatypeCheckboxes = syncPage 204 var datatypeControls = syncPage
205 .$$('#configure') 205 .$$('#configure')
206 .querySelectorAll('paper-checkbox.list-item'); 206 .querySelectorAll('.list-item paper-toggle-button');
207 for (var box of datatypeCheckboxes) { 207 for (var control of datatypeControls) {
208 assertTrue(box.disabled); 208 assertTrue(control.disabled);
209 assertTrue(box.checked); 209 assertTrue(control.checked);
210 } 210 }
211 211
212 // Uncheck the Sync All checkbox. 212 // Uncheck the Sync All control.
213 MockInteractions.tap(syncAllDataTypesCheckbox); 213 MockInteractions.tap(syncAllDataTypesControl);
214 214
215 function verifyPrefs(prefs) { 215 function verifyPrefs(prefs) {
216 var expected = getSyncAllPrefs(); 216 var expected = getSyncAllPrefs();
217 expected.syncAllDataTypes = false; 217 expected.syncAllDataTypes = false;
218 assertEquals(JSON.stringify(expected), JSON.stringify(prefs)); 218 assertEquals(JSON.stringify(expected), JSON.stringify(prefs));
219 219
220 cr.webUIListenerCallback('sync-prefs-changed', expected); 220 cr.webUIListenerCallback('sync-prefs-changed', expected);
221 221
222 // Assert that all the individual datatype checkboxes are enabled. 222 // Assert that all the individual datatype controls are enabled.
223 for (var box of datatypeCheckboxes) { 223 for (var control of datatypeControls) {
224 assertFalse(box.disabled); 224 assertFalse(control.disabled);
225 assertTrue(box.checked); 225 assertTrue(control.checked);
226 } 226 }
227 227
228 browserProxy.resetResolver('setSyncDatatypes'); 228 browserProxy.resetResolver('setSyncDatatypes');
229 229
230 // Test an arbitrarily-selected checkbox (extensions synced checkbox). 230 // Test an arbitrarily-selected control (extensions synced control).
231 MockInteractions.tap(datatypeCheckboxes[3]); 231 MockInteractions.tap(datatypeControls[3]);
232 return browserProxy.whenCalled('setSyncDatatypes').then( 232 return browserProxy.whenCalled('setSyncDatatypes').then(
233 function(prefs) { 233 function(prefs) {
234 var expected = getSyncAllPrefs(); 234 var expected = getSyncAllPrefs();
235 expected.syncAllDataTypes = false; 235 expected.syncAllDataTypes = false;
236 expected.extensionsSynced = false; 236 expected.extensionsSynced = false;
237 assertEquals(JSON.stringify(expected), JSON.stringify(prefs)); 237 assertEquals(JSON.stringify(expected), JSON.stringify(prefs));
238 }); 238 });
239 } 239 }
240 return browserProxy.whenCalled('setSyncDatatypes').then(verifyPrefs); 240 return browserProxy.whenCalled('setSyncDatatypes').then(verifyPrefs);
241 }); 241 });
242 242
243 test('ClickingLinkDoesNotChangeCheckboxValue', function() {
244 var syncAllDataTypesCheckbox = syncPage.$.syncAllDataTypesCheckbox;
245
246 // Uncheck the Sync All checkbox.
247 MockInteractions.tap(syncAllDataTypesCheckbox);
248
249 // Make sure the checkbox is enabled and checked.
250 var link = syncPage.$.paymentLearnMore;
251
252 // Suppress opening a new tab, since then the test will continue running
253 // on a background tab (which has throttled timers) and will timeout.
254 link.target = '';
255 link.href = '#';
256
257 assertEquals('PAPER-CHECKBOX', link.parentNode.nodeName);
258 assertFalse(link.parentNode.disabled);
259 assertTrue(link.parentNode.checked);
260
261 MockInteractions.tap(link);
262
263 // The checkbox value should be unchanged after clicking on the link.
264 assertTrue(link.parentNode.checked);
265 });
266
267 test('RadioBoxesEnabledWhenUnencrypted', function() { 243 test('RadioBoxesEnabledWhenUnencrypted', function() {
268 // Verify that the encryption radio boxes are enabled. 244 // Verify that the encryption radio boxes are enabled.
269 assertFalse(encryptWithGoogle.disabled); 245 assertFalse(encryptWithGoogle.disabled);
270 assertFalse(encryptWithPassphrase.disabled); 246 assertFalse(encryptWithPassphrase.disabled);
271 247
272 assertTrue(encryptWithGoogle.checked); 248 assertTrue(encryptWithGoogle.checked);
273 249
274 // Select 'Encrypt with passphrase' to create a new passphrase. 250 // Select 'Encrypt with passphrase' to create a new passphrase.
275 assertFalse(!!syncPage.$$('#create-password-box')); 251 assertFalse(!!syncPage.$$('#create-password-box'));
276 252
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 }); 462 });
487 }); 463 });
488 } 464 }
489 465
490 return { 466 return {
491 registerTests: function() { 467 registerTests: function() {
492 registerAdvancedSyncSettingsTests(); 468 registerAdvancedSyncSettingsTests();
493 }, 469 },
494 }; 470 };
495 }); 471 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/settings/metrics_reporting_tests.js ('k') | chrome/test/data/webui/settings/privacy_page_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698