| Index: chrome/test/data/webui/md_history/test_util.js
|
| diff --git a/chrome/test/data/webui/md_history/test_util.js b/chrome/test/data/webui/md_history/test_util.js
|
| index 0deeb3b54425f502e464344745c051eaf7ac753a..3d8ea2e36ce67ee07eda6b5b8ad8e4ef7d5f096e 100644
|
| --- a/chrome/test/data/webui/md_history/test_util.js
|
| +++ b/chrome/test/data/webui/md_history/test_util.js
|
| @@ -16,6 +16,32 @@ function flush() {
|
| }
|
|
|
| /**
|
| + * Replace the current primary element of the test with a new element. Useful
|
| + * as an alternative to PolymerTest.clearBody() which preserves styling.
|
| + * @param {Element} element
|
| + */
|
| +function replaceBody(element) {
|
| + var body = document.body;
|
| + var currentBody =
|
| + body.querySelector('history-app') || body.querySelector('.test-body');
|
| + body.removeChild(currentBody);
|
| +
|
| + element.classList.add('test-body');
|
| + body.appendChild(element);
|
| +}
|
| +
|
| +/**
|
| + * Replace the document body with a new instance of <history-app>.
|
| + * @return {HistoryAppElement} The app which was created.
|
| + */
|
| +function replaceApp() {
|
| + var app = document.createElement('history-app');
|
| + app.id = 'history-app';
|
| + replaceBody(app);
|
| + return app;
|
| +}
|
| +
|
| +/**
|
| * Create a fake history result with the given timestamp.
|
| * @param {number|string} timestamp Timestamp of the entry, as a number in ms or
|
| * a string which can be parsed by Date.parse().
|
|
|