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

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

Issue 2441503002: [MD Settings][People] Visual updates to the sync setup page. (Closed)
Patch Set: passphrase submit button should be disabled Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/webui/settings/people_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 assertTrue(!!syncPage.$$('#create-password-box')); 256 assertTrue(!!syncPage.$$('#create-password-box'));
257 var saveNewPassphrase = syncPage.$$('#saveNewPassphrase'); 257 var saveNewPassphrase = syncPage.$$('#saveNewPassphrase');
258 assertTrue(!!saveNewPassphrase); 258 assertTrue(!!saveNewPassphrase);
259 259
260 // Test that a sync prefs update does not reset the selection. 260 // Test that a sync prefs update does not reset the selection.
261 cr.webUIListenerCallback('sync-prefs-changed', getSyncAllPrefs()); 261 cr.webUIListenerCallback('sync-prefs-changed', getSyncAllPrefs());
262 Polymer.dom.flush(); 262 Polymer.dom.flush();
263 assertTrue(encryptWithPassphrase.checked); 263 assertTrue(encryptWithPassphrase.checked);
264 }); 264 });
265 265
266 test('CreatingPassphraseEmptyPassphrase', function() { 266 test('SaveButtonDisabledWhenPassphraseOrConfirmationEmpty', function() {
267 MockInteractions.tap(encryptWithPassphrase); 267 MockInteractions.tap(encryptWithPassphrase);
268 Polymer.dom.flush(); 268 Polymer.dom.flush();
269 269
270 assertTrue(!!syncPage.$$('#create-password-box')); 270 assertTrue(!!syncPage.$$('#create-password-box'));
271 var saveNewPassphrase = syncPage.$$('#saveNewPassphrase'); 271 var saveNewPassphrase = syncPage.$$('#saveNewPassphrase');
272 assertTrue(!!saveNewPassphrase);
273
274 MockInteractions.tap(saveNewPassphrase);
275 Polymer.dom.flush();
276
277 var passphraseInput = syncPage.$$('#passphraseInput'); 272 var passphraseInput = syncPage.$$('#passphraseInput');
278 var passphraseConfirmationInput = 273 var passphraseConfirmationInput =
279 syncPage.$$('#passphraseConfirmationInput'); 274 syncPage.$$('#passphraseConfirmationInput');
280 assertTrue(!!passphraseInput);
281 assertTrue(!!passphraseConfirmationInput);
282 275
283 assertTrue(passphraseInput.invalid); 276 passphraseInput.value = '';
284 assertFalse(passphraseConfirmationInput.invalid); 277 passphraseConfirmationInput.value = '';
278 assertTrue(!!saveNewPassphrase.disabled);
285 279
286 assertFalse(syncPage.syncPrefs.encryptAllData); 280 passphraseInput.value = 'foo';
281 passphraseConfirmationInput.value = '';
282 assertTrue(!!saveNewPassphrase.disabled);
283
284 passphraseInput.value = 'foo';
285 passphraseConfirmationInput.value = 'bar';
286 assertFalse(!!saveNewPassphrase.disabled);
287 }); 287 });
288 288
289 test('CreatingPassphraseMismatchedPassphrase', function() { 289 test('CreatingPassphraseMismatchedPassphrase', function() {
290 MockInteractions.tap(encryptWithPassphrase); 290 MockInteractions.tap(encryptWithPassphrase);
291 Polymer.dom.flush(); 291 Polymer.dom.flush();
292 292
293 assertTrue(!!syncPage.$$('#create-password-box')); 293 assertTrue(!!syncPage.$$('#create-password-box'));
294 var saveNewPassphrase = syncPage.$$('#saveNewPassphrase'); 294 var saveNewPassphrase = syncPage.$$('#saveNewPassphrase');
295 assertTrue(!!saveNewPassphrase); 295 assertTrue(!!saveNewPassphrase);
296 296
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 prefs.encryptAllData = true; 348 prefs.encryptAllData = true;
349 prefs.passphraseRequired = true; 349 prefs.passphraseRequired = true;
350 prefs.fullEncryptionBody = 'Sync already encrypted.'; 350 prefs.fullEncryptionBody = 'Sync already encrypted.';
351 cr.webUIListenerCallback('sync-prefs-changed', prefs); 351 cr.webUIListenerCallback('sync-prefs-changed', prefs);
352 352
353 Polymer.dom.flush(); 353 Polymer.dom.flush();
354 354
355 assertTrue(syncPage.$.encryptionRadioGroupContainer.hidden); 355 assertTrue(syncPage.$.encryptionRadioGroupContainer.hidden);
356 }); 356 });
357 357
358 test('ExistingPassphraseSubmitButtonDisabledWhenExistingPassphraseEmpty',
359 function() {
360 var prefs = getSyncAllPrefs();
361 prefs.encryptAllData = true;
362 prefs.passphraseRequired = true;
363 cr.webUIListenerCallback('sync-prefs-changed', prefs);
364
365 Polymer.dom.flush();
366
367 var existingPassphraseInput = syncPage.$$('#existingPassphraseInput');
368 var submitExistingPassphrase = syncPage.$$('#submitExistingPassphrase');
369
370 existingPassphraseInput.value = '';
371 assertTrue(!!submitExistingPassphrase.disabled);
tommycli 2016/10/26 18:27:30 nit: Why the double bang? Is it undefined sometime
Moe 2016/10/26 21:42:40 Done.
372
373 existingPassphraseInput.value = 'foo';
374 assertFalse(!!submitExistingPassphrase.disabled);
375 });
376
358 test('EnterExistingWrongPassphrase', function() { 377 test('EnterExistingWrongPassphrase', function() {
359 var prefs = getSyncAllPrefs(); 378 var prefs = getSyncAllPrefs();
360 prefs.encryptAllData = true; 379 prefs.encryptAllData = true;
361 prefs.passphraseRequired = true; 380 prefs.passphraseRequired = true;
362 cr.webUIListenerCallback('sync-prefs-changed', prefs); 381 cr.webUIListenerCallback('sync-prefs-changed', prefs);
363 382
364 Polymer.dom.flush(); 383 Polymer.dom.flush();
365 384
366 var existingPassphraseInput = syncPage.$$('#existingPassphraseInput'); 385 var existingPassphraseInput = syncPage.$$('#existingPassphraseInput');
367 assertTrue(!!existingPassphraseInput); 386 assertTrue(!!existingPassphraseInput);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 }); 445 });
427 }); 446 });
428 } 447 }
429 448
430 return { 449 return {
431 registerTests: function() { 450 registerTests: function() {
432 registerAdvancedSyncSettingsTests(); 451 registerAdvancedSyncSettingsTests();
433 }, 452 },
434 }; 453 };
435 }); 454 });
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/people_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698