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

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

Issue 2249873003: Settings: Fix Site Details subpage routing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comment typo Created 4 years, 4 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
« no previous file with comments | « chrome/test/data/webui/settings/route_tests.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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('settings_subpage', function() { 5 cr.define('settings_subpage', function() {
6 function registerTests() { 6 function registerTests() {
7 suite('SettingsSubpage', function() { 7 suite('SettingsSubpage', function() {
8 test('can navigate to parent', function() { 8 test('navigates to parent when there is no history', function() {
9 PolymerTest.clearBody(); 9 PolymerTest.clearBody();
10 10
11 // Choose CERTIFICATES since it is not a descendant of BASIC. 11 // Pretend that we initially started on the CERTIFICATES route.
12 settings.navigateTo(settings.Route.CERTIFICATES); 12 window.history.replaceState(
13 undefined, '', settings.Route.CERTIFICATES.path);
14 settings.initializeRouteFromUrl();
13 assertEquals(settings.Route.CERTIFICATES, settings.getCurrentRoute()); 15 assertEquals(settings.Route.CERTIFICATES, settings.getCurrentRoute());
14 16
15 var subpage = document.createElement('settings-subpage'); 17 var subpage = document.createElement('settings-subpage');
16 document.body.appendChild(subpage); 18 document.body.appendChild(subpage);
17 19
18 MockInteractions.tap(subpage.$$('paper-icon-button')); 20 MockInteractions.tap(subpage.$$('paper-icon-button'));
19 assertEquals(settings.Route.PRIVACY, settings.getCurrentRoute()); 21 assertEquals(settings.Route.PRIVACY, settings.getCurrentRoute());
20 }); 22 });
21 23
22 test('can navigate to grandparent using window.back()', function(done) { 24 test('navigates to any route via window.back()', function(done) {
23 PolymerTest.clearBody(); 25 PolymerTest.clearBody();
24 26
25 settings.navigateTo(settings.Route.BASIC); 27 settings.navigateTo(settings.Route.BASIC);
26 settings.navigateTo(settings.Route.SYNC); 28 settings.navigateTo(settings.Route.SYNC);
27 assertEquals(settings.Route.SYNC, settings.getCurrentRoute()); 29 assertEquals(settings.Route.SYNC, settings.getCurrentRoute());
28 30
29 var subpage = document.createElement('settings-subpage'); 31 var subpage = document.createElement('settings-subpage');
30 document.body.appendChild(subpage); 32 document.body.appendChild(subpage);
31 33
32 MockInteractions.tap(subpage.$$('paper-icon-button')); 34 MockInteractions.tap(subpage.$$('paper-icon-button'));
33 35
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) { 36 window.addEventListener('popstate', function(event) {
37 assertEquals(settings.Route.BASIC, settings.getCurrentRoute()); 37 assertEquals(settings.Route.BASIC, settings.getCurrentRoute());
38 done(); 38 done();
39 }); 39 });
40 }); 40 });
41 }); 41 });
42 } 42 }
43 43
44 return { 44 return {
45 registerTests: registerTests, 45 registerTests: registerTests,
46 }; 46 };
47 }); 47 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/settings/route_tests.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698