| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 suite('BannerTests', function() { |
| 6 var resetBanner = null; |
| 7 var browserProxy = null; |
| 8 |
| 9 setup(function() { |
| 10 browserProxy = new reset_page.TestResetBrowserProxy(); |
| 11 settings.ResetBrowserProxyImpl.instance_ = browserProxy; |
| 12 PolymerTest.clearBody(); |
| 13 resetBanner = document.createElement('settings-reset-profile-banner'); |
| 14 document.body.appendChild(resetBanner); |
| 15 }); |
| 16 |
| 17 teardown(function() { resetBanner.remove(); }); |
| 18 |
| 19 // Tests that the reset profile banner |
| 20 // - opens the reset profile dialog when the reset 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() { |
| 24 var dialog = resetBanner.$$('settings-reset-profile-dialog'); |
| 25 assertFalse(!!dialog); |
| 26 MockInteractions.tap(resetBanner.$.reset); |
| 27 Polymer.dom.flush(); |
| 28 assertTrue(resetBanner.showResetProfileDialog_) |
| 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 }); |
| 42 |
| 43 // Tests that the reset profile banner removes itself from the DOM when |
| 44 // the close button is clicked and that |onHideResetProfileBanner| is |
| 45 // called. |
| 46 test('ResetBannerClose', function() { |
| 47 MockInteractions.tap(resetBanner.$.close); |
| 48 assertFalse(!!resetBanner.parentNode); |
| 49 return browserProxy.whenCalled('onHideResetProfileBanner'); |
| 50 }); |
| 51 }); |
| OLD | NEW |