| OLD | NEW |
| 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 assertTrue(resetBanner.$.dialog.open); |
| 16 }); | 16 }); |
| 17 | 17 |
| 18 teardown(function() { resetBanner.remove(); }); | 18 teardown(function() { resetBanner.remove(); }); |
| 19 | 19 |
| 20 // Tests that the reset profile banner navigates to the Reset profile dialog | 20 // Tests that the reset profile banner navigates to the Reset profile dialog |
| 21 // URL when the "reset all settings" button is clicked. | 21 // URL when the "reset all settings" button is clicked. |
| 22 test('ResetBannerReset', function() { | 22 test('ResetBannerReset', function() { |
| 23 assertNotEquals(settings.Route.RESET_DIALOG, settings.getCurrentRoute()); | 23 assertNotEquals(settings.routes.RESET_DIALOG, settings.getCurrentRoute()); |
| 24 MockInteractions.tap(resetBanner.$.reset); | 24 MockInteractions.tap(resetBanner.$.reset); |
| 25 assertEquals(settings.Route.RESET_DIALOG, settings.getCurrentRoute()); | 25 assertEquals(settings.routes.RESET_DIALOG, settings.getCurrentRoute()); |
| 26 assertFalse(resetBanner.$.dialog.open); | 26 assertFalse(resetBanner.$.dialog.open); |
| 27 }); | 27 }); |
| 28 | 28 |
| 29 // Tests that the reset profile banner closes itself when the OK button is | 29 // Tests that the reset profile banner closes itself when the OK button is |
| 30 // clicked and that |onHideResetProfileBanner| is called. | 30 // clicked and that |onHideResetProfileBanner| is called. |
| 31 test('ResetBannerOk', function() { | 31 test('ResetBannerOk', function() { |
| 32 MockInteractions.tap(resetBanner.$.ok); | 32 MockInteractions.tap(resetBanner.$.ok); |
| 33 return browserProxy.whenCalled('onHideResetProfileBanner').then(function() { | 33 return browserProxy.whenCalled('onHideResetProfileBanner').then(function() { |
| 34 assertFalse(resetBanner.$.dialog.open); | 34 assertFalse(resetBanner.$.dialog.open); |
| 35 }); | 35 }); |
| 36 }); | 36 }); |
| 37 }); | 37 }); |
| OLD | NEW |