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

Commit 5ef3af3

Browse files
committed
test(privateMocks): allow replacing $prop with strings with special 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
1 parent 1b25f80 commit 5ef3af3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/helpers/privateMocks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function baseThey(msg, vals, spec, itFn) {
1111
var valsIsArray = angular.isArray(vals);
1212

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

0 commit comments

Comments
 (0)