[Finishes #52731407] Escape special regex characters from the spec param
This commit is contained in:
@@ -275,7 +275,8 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
|
|
||||||
jasmineRequire.HtmlSpecFilter = function() {
|
jasmineRequire.HtmlSpecFilter = function() {
|
||||||
function HtmlSpecFilter(options) {
|
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) {
|
this.matches = function(specName) {
|
||||||
return filterPattern.test(specName);
|
return filterPattern.test(specName);
|
||||||
@@ -284,6 +285,7 @@ jasmineRequire.HtmlSpecFilter = function() {
|
|||||||
|
|
||||||
return HtmlSpecFilter;
|
return HtmlSpecFilter;
|
||||||
};
|
};
|
||||||
|
|
||||||
jasmineRequire.ResultsNode = function() {
|
jasmineRequire.ResultsNode = function() {
|
||||||
function ResultsNode(result, type, parent) {
|
function ResultsNode(result, type, parent) {
|
||||||
this.result = result;
|
this.result = result;
|
||||||
@@ -349,4 +351,4 @@ jasmineRequire.QueryString = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return QueryString;
|
return QueryString;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
jasmineRequire.HtmlSpecFilter = function() {
|
jasmineRequire.HtmlSpecFilter = function() {
|
||||||
function HtmlSpecFilter(options) {
|
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) {
|
this.matches = function(specName) {
|
||||||
return filterPattern.test(specName);
|
return filterPattern.test(specName);
|
||||||
@@ -8,4 +9,4 @@ jasmineRequire.HtmlSpecFilter = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return HtmlSpecFilter;
|
return HtmlSpecFilter;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -44,4 +44,4 @@ jasmineRequire.QueryString = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return QueryString;
|
return QueryString;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user