From 5ef3af310e854b01d8c71370aa476cc68244261c Mon Sep 17 00:00:00 2001 From: Georgios Kalpakas Date: Tue, 15 Dec 2015 12:16:14 +0200 Subject: [PATCH] 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 --- test/helpers/privateMocks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/helpers/privateMocks.js b/test/helpers/privateMocks.js index f733afb8393f..637f19ebf97c 100644 --- a/test/helpers/privateMocks.js +++ b/test/helpers/privateMocks.js @@ -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);