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

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

Issue 2234093002: Settings Router Refactor: Update subpage-back button to use history back sometimes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix closure compile using typecast 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/cr_settings_browsertest.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
(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 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/settings/cr_settings_browsertest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698