diff --git a/lib/reporters/html.js b/lib/reporters/html.js index 8b44e3ed50..8c41f0552f 100644 --- a/lib/reporters/html.js +++ b/lib/reporters/html.js @@ -177,14 +177,23 @@ function HTML(runner) { }); } +/** + * Makes a URL, preserving querystring ("search") parameters. + * @param {string} s + * @returns {string} your new URL + */ +var makeUrl = function makeUrl(s) { + var search = window.location.search; + return (search ? search + '&' : '?' ) + 'grep=' + encodeURIComponent(s); +}; + /** * Provide suite URL * * @param {Object} [suite] */ - HTML.prototype.suiteURL = function(suite){ - return '?grep=' + encodeURIComponent(suite.fullTitle()); + return makeUrl(suite.fullTitle()); }; /** @@ -194,7 +203,7 @@ HTML.prototype.suiteURL = function(suite){ */ HTML.prototype.testURL = function(test){ - return '?grep=' + encodeURIComponent(test.fullTitle()); + return makeUrl(test.fullTitle()); }; /**