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

Side by Side Diff: chrome/test/data/webui/md_history/history_routing_test.js

Issue 2068613002: [MD History] Add URL parameter for search. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@routing
Patch Set: Created 4 years, 6 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
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('md_history.history_routing_test', function() { 5 cr.define('md_history.history_routing_test', function() {
6 function registerTests() { 6 function registerTests() {
7 suite('synced-tabs', function() { 7 suite('synced-tabs', function() {
8 var app; 8 var app;
9 var list; 9 var list;
10 var toolbar;
10 11
11 suiteSetup(function() { 12 suiteSetup(function() {
12 app = $('history-app'); 13 app = $('history-app');
13 element = app.$['history-list']; 14 element = app.$['history-list'];
14 sidebar = app.$['history-side-bar'] 15 sidebar = app.$['history-side-bar'];
16 toolbar = app.$['toolbar'];
15 }); 17 });
16 18
17 test('changing route changes active view', function() { 19 test('changing route changes active view', function() {
18 assertEquals('history', app.$.content.selected); 20 assertEquals('history', app.$.content.selected);
19 app.set('route.path', '/syncedTabs'); 21 app.set('route.path', '/syncedTabs');
20 return flush().then(function() { 22 return flush().then(function() {
21 assertEquals('syncedTabs', app.$.content.selected); 23 assertEquals('syncedTabs', app.$.content.selected);
22 }); 24 });
23 }); 25 });
24 26
25 test('route updates from sidebar', function() { 27 test('route updates from sidebar', function() {
26 var menu = sidebar.$.menu; 28 var menu = sidebar.$.menu;
27 assertEquals('/', app.route.path); 29 assertEquals('/', app.route.path);
28 30
29 MockInteractions.tap(menu.children[1]); 31 MockInteractions.tap(menu.children[1]);
30 assertEquals('/syncedTabs', app.route.path); 32 assertEquals('/syncedTabs', app.route.path);
31 33
32 MockInteractions.tap(menu.children[0]); 34 MockInteractions.tap(menu.children[0]);
33 assertEquals('/', app.route.path); 35 assertEquals('/', app.route.path);
34 }); 36 });
35 37
38 test('route updates from search', function() {
39 var searchTerm = 'McCree';
40 assertEquals('/', app.route.path);
41 toolbar.setSearchTerm(searchTerm);
42 assertEquals(searchTerm, app.route.__queryParams.q);
43 });
44
45 test('search updates from route', function() {
46 var searchTerm = 'Mei';
47 assertEquals('history', app.$.content.selected);
48 app.set('route.__queryParams.q', searchTerm);
49 assertEquals(searchTerm, toolbar.searchTerm);
50 });
51
52 test('search preserved across menu items', function() {
53 var searchTerm = 'Soldier 76';
54 var menu = sidebar.$.menu;
55 assertEquals('/', app.route.path);
56 assertEquals('history', app.$.content.selected);
57 app.set('route.__queryParams.q', searchTerm);
58
59 MockInteractions.tap(menu.children[1]);
60 assertEquals('/syncedTabs', app.route.path);
61 assertEquals(searchTerm, app.route.__queryParams.q);
62 assertEquals(searchTerm, toolbar.searchTerm);
63
64 MockInteractions.tap(menu.children[0]);
65 assertEquals('/', app.route.path);
66 assertEquals(searchTerm, app.route.__queryParams.q);
67 assertEquals(searchTerm, toolbar.searchTerm);
68 });
69
36 teardown(function() { 70 teardown(function() {
37 app.set('route.path', '/'); 71 app.set('route.path', '/');
72 app.set('route.__queryParams.q', null);
38 }); 73 });
39 }); 74 });
40 } 75 }
41 return { 76 return {
42 registerTests: registerTests 77 registerTests: registerTests
43 }; 78 };
44 }); 79 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698