Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
test(privateMocks): allow replacing $prop with strings with special…
Browse files Browse the repository at this point in the history
… RegExp semantics

`baseThey` used to construct the testcase description by replacing `$prop` using a RegExp.
If the replacement string contained `$&` (which has a special meaning with RegExps), the resulting
string was not as expected.x
  • Loading branch information
gkalpak committed Dec 15, 2015
1 parent 1b25f80 commit 5ef3af3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/helpers/privateMocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function baseThey(msg, vals, spec, itFn) {
var valsIsArray = angular.isArray(vals);

angular.forEach(vals, function(val, key) {
var m = msg.replace(/\$prop/g, angular.toJson(valsIsArray ? val : key));
var m = msg.split('$prop').join(angular.toJson(valsIsArray ? val : key));
itFn(m, function() {
/* jshint -W040 : ignore possible strict violation due to use of this */
spec.call(this, val);
Expand Down

0 comments on commit 5ef3af3

Please sign in to comment.