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

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

Issue 2643533003: MD History: Use one-way binding for history query state. (Closed)
Patch Set: Remove wrapper function Created 3 years, 11 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/md_history/history_toolbar_test.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 /** 5 /**
6 * Replace the current primary element of the test with a new element. Useful 6 * Replace the current primary element of the test with a new element. Useful
7 * as an alternative to PolymerTest.clearBody() which preserves styling. 7 * as an alternative to PolymerTest.clearBody() which preserves styling.
8 * @param {Element} element 8 * @param {Element} element
9 */ 9 */
10 function replaceBody(element) { 10 function replaceBody(element) {
11 var body = document.body; 11 var body = document.body;
12 var app = body.querySelector('history-app'); 12 var app = body.querySelector('history-app');
13 // Clear the query on the app, if it exists. This clears any query in the URL.
14 if (app)
15 app.set('queryState_.searchTerm', '');
16 13
17 var currentBody = app || body.querySelector('.test-body'); 14 var currentBody = app || body.querySelector('.test-body');
18 body.removeChild(currentBody); 15 body.removeChild(currentBody);
19 16
17 // Clear any query in the URL.
18 window.history.replaceState({}, '', '/');
19
20 element.classList.add('test-body'); 20 element.classList.add('test-body');
21 body.appendChild(element); 21 body.appendChild(element);
22 } 22 }
23 23
24 /** 24 /**
25 * Replace the document body with a new instance of <history-app>. 25 * Replace the document body with a new instance of <history-app>.
26 * @return {HistoryAppElement} The app which was created. 26 * @return {HistoryAppElement} The app which was created.
27 */ 27 */
28 function replaceApp() { 28 function replaceApp() {
29 var app = document.createElement('history-app'); 29 var app = document.createElement('history-app');
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 var tabs = tabUrls.map(function(tabUrl) { 190 var tabs = tabUrls.map(function(tabUrl) {
191 return {sessionId: 456, timestamp: 0, title: tabUrl, url: tabUrl}; 191 return {sessionId: 456, timestamp: 0, title: tabUrl, url: tabUrl};
192 }); 192 });
193 193
194 return { 194 return {
195 tabs: tabs, 195 tabs: tabs,
196 sessionId: '123', 196 sessionId: '123',
197 userVisibleTimestamp: "A while ago" 197 userVisibleTimestamp: "A while ago"
198 }; 198 };
199 } 199 }
OLDNEW
« no previous file with comments | « chrome/test/data/webui/md_history/history_toolbar_test.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698