Skip to content

Commit

Permalink
Merge pull request #1495 from callmevlad/master
Browse files Browse the repository at this point in the history
Prevent multiple 'grep=' querystring params in html reporter
  • Loading branch information
Travis Jeffery committed Jan 13, 2015
2 parents f664483 + 12b6ed9 commit 908d8db
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/reporters/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ function HTML(runner) {
*/
var makeUrl = function makeUrl(s) {
var search = window.location.search;

// Remove previous grep query parameter if present
if (search) {
search = search.replace(/[?&]grep=[^&\s]*/g, '').replace(/^&/, '?');
}

return window.location.pathname + (search ? search + '&' : '?' ) + 'grep=' + encodeURIComponent(s);
};

Expand Down

0 comments on commit 908d8db

Please sign in to comment.