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

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

Issue 2625263002: MD Settings: Convert reset profile banner to a dialog. (Closed)
Patch Set: Nit. Created 3 years, 10 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 suite('BannerTests', function() { 5 suite('BannerTests', function() {
6 var resetBanner = null; 6 var resetBanner = null;
7 var browserProxy = null; 7 var browserProxy = null;
8 8
9 setup(function() { 9 setup(function() {
10 browserProxy = new reset_page.TestResetBrowserProxy(); 10 browserProxy = new reset_page.TestResetBrowserProxy();
11 settings.ResetBrowserProxyImpl.instance_ = browserProxy; 11 settings.ResetBrowserProxyImpl.instance_ = browserProxy;
12 PolymerTest.clearBody(); 12 PolymerTest.clearBody();
13 resetBanner = document.createElement('settings-reset-profile-banner'); 13 resetBanner = document.createElement('settings-reset-profile-banner');
14 document.body.appendChild(resetBanner); 14 document.body.appendChild(resetBanner);
15 assertTrue(resetBanner.$.dialog.open);
15 }); 16 });
16 17
17 teardown(function() { resetBanner.remove(); }); 18 teardown(function() { resetBanner.remove(); });
18 19
19 // Tests that the reset profile banner 20 // Tests that the reset profile banner navigates to the Reset profile dialog
20 // - opens the reset profile dialog when the reset button is clicked. 21 // URL when the "reset all settings" button is clicked.
21 // - reset happens when clicking on the dialog's reset button.
22 // - the reset profile dialog is closed after reset is done.
23 test('ResetBannerReset', function() { 22 test('ResetBannerReset', function() {
24 var dialog = resetBanner.$$('settings-reset-profile-dialog'); 23 assertNotEquals(settings.Route.RESET_DIALOG, settings.getCurrentRoute());
25 assertFalse(!!dialog);
26 MockInteractions.tap(resetBanner.$.reset); 24 MockInteractions.tap(resetBanner.$.reset);
27 Polymer.dom.flush(); 25 assertEquals(settings.Route.RESET_DIALOG, settings.getCurrentRoute());
28 assertTrue(resetBanner.showResetProfileDialog_) 26 assertFalse(resetBanner.$.dialog.open);
29 dialog = resetBanner.$$('settings-reset-profile-dialog');
30 assertTrue(!!dialog);
31
32 MockInteractions.tap(dialog.$.reset);
33
34 return browserProxy.whenCalled('performResetProfileSettings')
35 .then(PolymerTest.flushTasks)
36 .then(function() {
37 assertFalse(resetBanner.showResetProfileDialog_);
38 dialog = resetBanner.$$('settings-reset-profile-dialog');
39 assertFalse(!!dialog);
40 });
41 }); 27 });
42 28
43 // Tests that the reset profile banner removes itself from the DOM when 29 // Tests that the reset profile banner closes itself when the OK button is
44 // the close button is clicked and that |onHideResetProfileBanner| is 30 // clicked and that |onHideResetProfileBanner| is called.
45 // called. 31 test('ResetBannerOk', function() {
46 test('ResetBannerClose', function() { 32 MockInteractions.tap(resetBanner.$.ok);
47 MockInteractions.tap(resetBanner.$.close); 33 return browserProxy.whenCalled('onHideResetProfileBanner').then(function() {
48 assertFalse(!!resetBanner.parentNode); 34 assertFalse(resetBanner.$.dialog.open);
49 return browserProxy.whenCalled('onHideResetProfileBanner'); 35 });
50 }); 36 });
51 }); 37 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698