-
Notifications
You must be signed in to change notification settings - Fork 0
/
tdd.js
41 lines (31 loc) · 770 Bytes
/
tdd.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var assert = {
count : 0,
pass : 0,
equals : function (exRes, result, funcName){
var nuBlock = document.createElement('div');
nuBlock.id = 'square' + this.count;
nuBlock.style.height = '300px';
nuBlock.style.width = '300px';
nuBlock.style.border = '3px solid black';
nuBlock.style.display = 'inline-block';
nuBlock.style.color = 'blue';
document.body.appendChild(nuBlock);
var rg = new RedOrGreen(nuBlock.id);
if(exRes === result){
this.pass++;
nuBlock.innerHTML = funcName;
rg.makeGreen();
}
else{
nuBlock.innerHTML = funcName;
rg.makeRed();
}
this.count++;
}
}
var TestMyCode = {
run : function(name, testPar){
this.name = name;
testPar(assert);
}
}