| OLD | NEW |
| 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('routing-test', function() { | 7 suite('routing-test', function() { |
| 8 var app; | 8 var app; |
| 9 var list; | 9 var list; |
| 10 var toolbar; | 10 var toolbar; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 assertEquals('chrome://history/', window.location.href); | 48 assertEquals('chrome://history/', window.location.href); |
| 49 var searchTerm = 'Mei'; | 49 var searchTerm = 'Mei'; |
| 50 assertEquals('history', app.$.content.selected); | 50 assertEquals('history', app.$.content.selected); |
| 51 navigateTo('/?q=' + searchTerm); | 51 navigateTo('/?q=' + searchTerm); |
| 52 assertEquals(searchTerm, toolbar.searchTerm); | 52 assertEquals(searchTerm, toolbar.searchTerm); |
| 53 }); | 53 }); |
| 54 | 54 |
| 55 test('route updates from search', function() { | 55 test('route updates from search', function() { |
| 56 var searchTerm = 'McCree'; | 56 var searchTerm = 'McCree'; |
| 57 assertEquals('history', app.$.content.selected); | 57 assertEquals('history', app.$.content.selected); |
| 58 app.set('queryState_.searchTerm', searchTerm); | 58 app.fire('change-query', {search: searchTerm}); |
| 59 assertEquals('chrome://history/?q=' + searchTerm, window.location.href); | 59 assertEquals('chrome://history/?q=' + searchTerm, window.location.href); |
| 60 }); | 60 }); |
| 61 | 61 |
| 62 test('search preserved across menu items', function() { | 62 test('search preserved across menu items', function() { |
| 63 var searchTerm = 'Soldier76'; | 63 var searchTerm = 'Soldier76'; |
| 64 var menu = sidebar.$.menu; | 64 var menu = sidebar.$.menu; |
| 65 assertEquals('history', app.selectedPage_); | 65 assertEquals('history', app.selectedPage_); |
| 66 navigateTo('/?q=' + searchTerm); | 66 navigateTo('/?q=' + searchTerm); |
| 67 | 67 |
| 68 MockInteractions.tap(menu.children[1]); | 68 MockInteractions.tap(menu.children[1]); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 119 } |
| 120 | 120 |
| 121 registerMessageCallback('queryHistory', this, verifyFunction); | 121 registerMessageCallback('queryHistory', this, verifyFunction); |
| 122 }); | 122 }); |
| 123 }); | 123 }); |
| 124 } | 124 } |
| 125 return { | 125 return { |
| 126 registerTests: registerTests | 126 registerTests: registerTests |
| 127 }; | 127 }; |
| 128 }); | 128 }); |
| OLD | NEW |