[Finishes #52731407] Escape special regex characters from the spec param

This commit is contained in:
JR Boyens
2013-07-26 11:28:15 -07:00
parent 98fa58ee49
commit 00f88edc04
3 changed files with 8 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
jasmineRequire.HtmlSpecFilter = function() {
function HtmlSpecFilter(options) {
var filterPattern = new RegExp(options && options.filterString());
var filterString = options && options.filterString() && options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
var filterPattern = new RegExp(filterString);
this.matches = function(specName) {
return filterPattern.test(specName);
@@ -8,4 +9,4 @@ jasmineRequire.HtmlSpecFilter = function() {
}
return HtmlSpecFilter;
};
};