diff --git a/test/helpers/privateMocks.js b/test/helpers/privateMocks.js index ad5b13f12989..9ba2a6c20471 100644 --- a/test/helpers/privateMocks.js +++ b/test/helpers/privateMocks.js @@ -1,5 +1,37 @@ 'use strict'; +function they(msg, vals, spec, specialState) { + var keyIsValue = isArray(vals); + forEach(vals, function(val, key) { + if (keyIsValue) { + key = val; + } + var m = msg.replace('$prop', key); + var method; + switch(specialState) { + case 'focus': + method = iit; + break; + case 'skip': + method = xit; + break; + default: + method = it; + } + method(m, function() { + spec(val); + }); + }); +} + +function tthey(msg, vals, spec) { + they(msg, vals, spec, 'focus'); +} + +function xthey(msg, vals, spec) { + they(msg, vals, spec, 'skip'); +} + function createMockStyleSheet(doc, wind) { doc = doc ? doc[0] : document; wind = wind || window; diff --git a/test/ngMessages/messagesSpec.js b/test/ngMessages/messagesSpec.js index a0b39ddf8570..99251a193e84 100644 --- a/test/ngMessages/messagesSpec.js +++ b/test/ngMessages/messagesSpec.js @@ -4,19 +4,6 @@ describe('ngMessages', function() { beforeEach(inject.strictDi()); beforeEach(module('ngMessages')); - function they(msg, vals, spec, focus) { - forEach(vals, function(val, key) { - var m = msg.replace('$prop', key); - (focus ? iit : it)(m, function() { - spec(val); - }); - }); - } - - function tthey(msg, vals, spec) { - they(msg, vals, spec, true); - } - function s(str) { return str.replace(/\s+/g,''); }