Index: chrome/test/data/webui/md_history/history_routing_test.js |
diff --git a/chrome/test/data/webui/md_history/history_routing_test.js b/chrome/test/data/webui/md_history/history_routing_test.js |
index 200abede7d95d74b75a5d59d492ec4afe72b916d..31bc1211b9a9a09c962490a42daf8582f14c4382 100644 |
--- a/chrome/test/data/webui/md_history/history_routing_test.js |
+++ b/chrome/test/data/webui/md_history/history_routing_test.js |
@@ -7,11 +7,13 @@ cr.define('md_history.history_routing_test', function() { |
suite('synced-tabs', function() { |
var app; |
var list; |
+ var toolbar; |
suiteSetup(function() { |
app = $('history-app'); |
element = app.$['history-list']; |
- sidebar = app.$['history-side-bar'] |
+ sidebar = app.$['history-side-bar']; |
+ toolbar = app.$['toolbar']; |
}); |
test('changing route changes active view', function() { |
@@ -33,8 +35,41 @@ cr.define('md_history.history_routing_test', function() { |
assertEquals('/', app.route.path); |
}); |
+ test('route updates from search', function() { |
+ var searchTerm = 'McCree'; |
+ assertEquals('/', app.route.path); |
+ toolbar.setSearchTerm(searchTerm); |
+ assertEquals(searchTerm, app.route.__queryParams.q); |
+ }); |
+ |
+ test('search updates from route', function() { |
+ var searchTerm = 'Mei'; |
+ assertEquals('history', app.$.content.selected); |
+ app.set('route.__queryParams.q', searchTerm); |
+ assertEquals(searchTerm, toolbar.searchTerm); |
+ }); |
+ |
+ test('search preserved across menu items', function() { |
+ var searchTerm = 'Soldier 76'; |
+ var menu = sidebar.$.menu; |
+ assertEquals('/', app.route.path); |
+ assertEquals('history', app.$.content.selected); |
+ app.set('route.__queryParams.q', searchTerm); |
+ |
+ MockInteractions.tap(menu.children[1]); |
+ assertEquals('/syncedTabs', app.route.path); |
+ assertEquals(searchTerm, app.route.__queryParams.q); |
+ assertEquals(searchTerm, toolbar.searchTerm); |
+ |
+ MockInteractions.tap(menu.children[0]); |
+ assertEquals('/', app.route.path); |
+ assertEquals(searchTerm, app.route.__queryParams.q); |
+ assertEquals(searchTerm, toolbar.searchTerm); |
+ }); |
+ |
teardown(function() { |
app.set('route.path', '/'); |
+ app.set('route.__queryParams.q', null); |
}); |
}); |
} |