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

Side by Side Diff: chrome/test/data/webui/md_user_manager/create_profile_tests.js

Issue 2047383003: MD User Manager: "Select an account" should just be a label not a menu entry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « chrome/browser/resources/md_user_manager/create_profile.js ('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('user_manager.create_profile_tests', function() { 5 cr.define('user_manager.create_profile_tests', function() {
6 /** @return {!CreateProfileElement} */ 6 /** @return {!CreateProfileElement} */
7 function createElement() { 7 function createElement() {
8 var createProfileElement = document.createElement('create-profile'); 8 var createProfileElement = document.createElement('create-profile');
9 document.body.appendChild(createProfileElement); 9 document.body.appendChild(createProfileElement);
10 return createProfileElement; 10 return createProfileElement;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // The 'learn more' link is visible. 62 // The 'learn more' link is visible.
63 assertTrue(!!createProfileElement.$$('#learn-more > a')); 63 assertTrue(!!createProfileElement.$$('#learn-more > a'));
64 64
65 // The dropdown menu becomes visible when the checkbox is checked. 65 // The dropdown menu becomes visible when the checkbox is checked.
66 assertFalse(!!createProfileElement.$$('paper-dropdown-menu')); 66 assertFalse(!!createProfileElement.$$('paper-dropdown-menu'));
67 67
68 // Simulate checking the checkbox. 68 // Simulate checking the checkbox.
69 MockInteractions.tap(createProfileElement.$$('paper-checkbox')); 69 MockInteractions.tap(createProfileElement.$$('paper-checkbox'));
70 Polymer.dom.flush(); 70 Polymer.dom.flush();
71 71
72 // The dropdown menu is visible and is populated with the sentinel 72 // The dropdown menu is visible and is populated with signed in users.
73 // item as well as the signed in users.
74 var dropdownMenu = createProfileElement.$$('paper-dropdown-menu'); 73 var dropdownMenu = createProfileElement.$$('paper-dropdown-menu');
75 assertTrue(!!dropdownMenu); 74 assertTrue(!!dropdownMenu);
76 var users = dropdownMenu.querySelectorAll('paper-item'); 75 var users = dropdownMenu.querySelectorAll('paper-item');
77 assertEquals(2, users.length); 76 assertEquals(1, users.length);
78 }); 77 });
79 }); 78 });
80 79
81 test('Sentinel item is the initially selected item', function() {
82 return browserProxy.whenCalled('getSignedInUsers').then(function() {
83 // Simulate checking the checkbox.
84 MockInteractions.tap(createProfileElement.$$('paper-checkbox'));
85 Polymer.dom.flush();
86
87 var dropdownMenu = createProfileElement.$$('paper-dropdown-menu');
88 var selector = dropdownMenu.querySelector('paper-listbox');
89 assertEquals(loadTimeData.getString('selectAnAccount'),
90 selector.selectedItem.textContent.trim());
91 });
92 });
93
94 test('Name is non-empty by default', function() { 80 test('Name is non-empty by default', function() {
95 assertEquals('profile name', createProfileElement.$.nameInput.value); 81 assertEquals('profile name', createProfileElement.$.nameInput.value);
96 }); 82 });
97 83
98 test('Create button is disabled if name is empty or invalid', function() { 84 test('Create button is disabled if name is empty or invalid', function() {
99 assertEquals('profile name', createProfileElement.$.nameInput.value); 85 assertEquals('profile name', createProfileElement.$.nameInput.value);
100 assertFalse(createProfileElement.$.nameInput.invalid); 86 assertFalse(createProfileElement.$.nameInput.invalid);
101 assertFalse(createProfileElement.$.save.disabled); 87 assertFalse(createProfileElement.$.save.disabled);
102 88
103 createProfileElement.$.nameInput.value = ''; 89 createProfileElement.$.nameInput.value = '';
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 test('Create button is disabled', function() { 390 test('Create button is disabled', function() {
405 assertTrue(createProfileElement.$.save.disabled); 391 assertTrue(createProfileElement.$.save.disabled);
406 }); 392 });
407 }); 393 });
408 } 394 }
409 395
410 return { 396 return {
411 registerTests: registerTests, 397 registerTests: registerTests,
412 }; 398 };
413 }); 399 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_user_manager/create_profile.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698