| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 cr.define('settings_subpage', function() { |
| 6 function registerTests() { |
| 7 suite('SettingsSubpage', function() { |
| 8 test('can navigate to parent', function() { |
| 9 PolymerTest.clearBody(); |
| 10 |
| 11 // Choose CERTIFICATES since it is not a descendant of BASIC. |
| 12 settings.navigateTo(settings.Route.CERTIFICATES); |
| 13 assertEquals(settings.Route.CERTIFICATES, settings.getCurrentRoute()); |
| 14 |
| 15 var subpage = document.createElement('settings-subpage'); |
| 16 document.body.appendChild(subpage); |
| 17 |
| 18 MockInteractions.tap(subpage.$$('paper-icon-button')); |
| 19 assertEquals(settings.Route.PRIVACY, settings.getCurrentRoute()); |
| 20 }); |
| 21 |
| 22 test('can navigate to grandparent using window.back()', function(done) { |
| 23 PolymerTest.clearBody(); |
| 24 |
| 25 settings.navigateTo(settings.Route.BASIC); |
| 26 settings.navigateTo(settings.Route.SYNC); |
| 27 assertEquals(settings.Route.SYNC, settings.getCurrentRoute()); |
| 28 |
| 29 var subpage = document.createElement('settings-subpage'); |
| 30 document.body.appendChild(subpage); |
| 31 |
| 32 MockInteractions.tap(subpage.$$('paper-icon-button')); |
| 33 |
| 34 // Since the previous history entry is an ancestor, we expect |
| 35 // window.history.back() to be called and a popstate event to be fired. |
| 36 window.addEventListener('popstate', function(event) { |
| 37 assertEquals(settings.Route.BASIC, settings.getCurrentRoute()); |
| 38 done(); |
| 39 }); |
| 40 }); |
| 41 }); |
| 42 } |
| 43 |
| 44 return { |
| 45 registerTests: registerTests, |
| 46 }; |
| 47 }); |
| OLD | NEW |