OLD | NEW |
---|---|
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 PolymerTest.clearBody(); | 8 PolymerTest.clearBody(); |
9 var createProfileElement = document.createElement('create-profile'); | 9 var createProfileElement = document.createElement('create-profile'); |
10 document.body.appendChild(createProfileElement); | 10 document.body.appendChild(createProfileElement); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 return browserProxy.whenCalled('getSignedInUsers').then(function() { | 51 return browserProxy.whenCalled('getSignedInUsers').then(function() { |
52 assertEquals(1, createProfileElement.signedInUsers_.length); | 52 assertEquals(1, createProfileElement.signedInUsers_.length); |
53 assertEquals('username', | 53 assertEquals('username', |
54 createProfileElement.signedInUsers_[0].username); | 54 createProfileElement.signedInUsers_[0].username); |
55 assertEquals('path/to/profile', | 55 assertEquals('path/to/profile', |
56 createProfileElement.signedInUsers_[0].profilePath); | 56 createProfileElement.signedInUsers_[0].profilePath); |
57 | 57 |
58 // The 'learn more' link is visible. | 58 // The 'learn more' link is visible. |
59 assertTrue(!!createProfileElement.$$('#learn-more')); | 59 assertTrue(!!createProfileElement.$$('#learn-more')); |
60 | 60 |
61 // The dropdown menu is visible only when the checkbox is checked. | 61 // The dropdown menu becomes visible when the checkbox is checked. |
62 assertFalse(!!createProfileElement.$$('paper-dropdown-menu')); | 62 assertFalse(!!createProfileElement.$$('paper-dropdown-menu')); |
63 | 63 |
64 // Simulate checking the checkbox. | 64 // Simulate checking the checkbox. |
65 MockInteractions.tap(createProfileElement.$$('paper-checkbox')); | 65 MockInteractions.tap(createProfileElement.$$('paper-checkbox')); |
66 Polymer.dom.flush(); | 66 Polymer.dom.flush(); |
67 | 67 |
68 // The dropdown menu is visible and is populated with the sentinel | 68 // The dropdown menu is visible and is populated with the sentinel |
69 // item as well as the signed in users. | 69 // item as well as the signed in users. |
70 var dropdownMenu = createProfileElement.$$('paper-dropdown-menu'); | 70 var dropdownMenu = createProfileElement.$$('paper-dropdown-menu'); |
71 assertTrue(!!dropdownMenu); | 71 assertTrue(!!dropdownMenu); |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
371 // Make sure DOM is up to date. | 371 // Make sure DOM is up to date. |
372 Polymer.dom.flush(); | 372 Polymer.dom.flush(); |
373 }); | 373 }); |
374 | 374 |
375 teardown(function() { createProfileElement.remove(); }); | 375 teardown(function() { createProfileElement.remove(); }); |
376 | 376 |
377 test('Handles no signed in users', function() { | 377 test('Handles no signed in users', function() { |
378 return browserProxy.whenCalled('getSignedInUsers').then(function() { | 378 return browserProxy.whenCalled('getSignedInUsers').then(function() { |
379 assertEquals(0, createProfileElement.signedInUsers_.length); | 379 assertEquals(0, createProfileElement.signedInUsers_.length); |
380 | 380 |
381 // '#supervised-user-container' is not present in the DOM. | 381 // Simulate checking the checkbox. |
382 var container = createProfileElement.$$('#supervised-user-container'); | 382 MockInteractions.tap(createProfileElement.$$('paper-checkbox')); |
383 assertFalse(!!container); | 383 Polymer.dom.flush(); |
384 | |
385 // The dropdown menu is not visible when there are no signed in users. | |
386 assertFalse(!!createProfileElement.$$('paper-dropdown-menu')); | |
tommycli
2016/05/02 19:10:13
you will also need an
assertTrue(fooElement.hidde
Moe
2016/05/02 20:34:57
This line is asserting that the dropdown does NOT
tommycli
2016/05/02 21:57:49
Ah you're right. thanks
| |
387 | |
388 // Instead a message containing a link to the Help Center on how | |
389 // to sign in to Chrome is displaying. | |
390 assertTrue(!!createProfileElement.$$('#sign-in-to-chrome')); | |
384 }); | 391 }); |
385 }); | 392 }); |
386 | 393 |
387 test('Create button is disabled', function() { | 394 test('Create button is disabled', function() { |
388 assertTrue(createProfileElement.$.save.disabled); | 395 assertTrue(createProfileElement.$.save.disabled); |
389 }); | 396 }); |
390 }); | 397 }); |
391 } | 398 } |
392 | 399 |
393 return { | 400 return { |
394 registerTests: registerTests, | 401 registerTests: registerTests, |
395 }; | 402 }; |
396 }); | 403 }); |
OLD | NEW |