Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 215a8f4

Browse files
committedJan 25, 2015
chore(ngMock): add they helper for testing multiple specs
1 parent 9f7c5ce commit 215a8f4

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed
 

‎test/helpers/privateMocks.js

+28
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
'use strict';
22

3+
function they(msg, vals, spec, specialState) {
4+
forEach(vals, function(val, key) {
5+
var m = msg.replace('$prop', key);
6+
var method;
7+
switch(specialState) {
8+
case 'focus':
9+
method = iit;
10+
break;
11+
case 'skip':
12+
method = xit;
13+
break;
14+
default:
15+
method = it;
16+
}
17+
method(m, function() {
18+
spec(val);
19+
});
20+
});
21+
}
22+
23+
function tthey(msg, vals, spec) {
24+
they(msg, vals, spec, 'focus');
25+
}
26+
27+
function xthey(msg, vals, spec) {
28+
they(msg, vals, spec, 'skip');
29+
}
30+
331
function createMockStyleSheet(doc, wind) {
432
doc = doc ? doc[0] : document;
533
wind = wind || window;

‎test/ngMessages/messagesSpec.js

-13
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,6 @@ describe('ngMessages', function() {
44
beforeEach(inject.strictDi());
55
beforeEach(module('ngMessages'));
66

7-
function they(msg, vals, spec, focus) {
8-
forEach(vals, function(val, key) {
9-
var m = msg.replace('$prop', key);
10-
(focus ? iit : it)(m, function() {
11-
spec(val);
12-
});
13-
});
14-
}
15-
16-
function tthey(msg, vals, spec) {
17-
they(msg, vals, spec, true);
18-
}
19-
207
function s(str) {
218
return str.replace(/\s+/g,'');
229
}

0 commit comments

Comments
 (0)