/
test.js
53 lines (48 loc) · 1.72 KB
/
test.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
42
43
44
45
46
47
48
49
50
51
52
53
var should = require("should");
describe('ProtolusResource', function(){
describe('Panel tests', function(){
var Templates = require('./protolus-templates');
before(function(){
Templates({ templateDirectory : '/Panels' });
});
it('Basic render', function(done){
new Templates.Panel('simple', function(panel){
panel.render({} , function(html){
html.indexOf('OMG').should.not.equal(-1);
done();
});
});
});
it('Basic if', function(done){
/*new Templates.Panel('foreach', function(panel){
var data = {
test : 'blah'
};
panel.render(data , function(html){
html.indexOf('YES').should.not.equal(-1);
done();
});
});*/
});
it('Basic foreach', function(done){
new Templates.Panel('foreach', function(panel){
var data = {
test : 'blah',
list : [
'foo',
'bar',
'baz'
]
};
panel.render(data , function(html){
html.indexOf('<h2>'+data.test+'</h2>').should.not.equal(-1);
data.list.forEach(function(value, key){
html.indexOf('<a>'+key+'</a>').should.not.equal(-1);
html.indexOf('<b>'+value+'</b>').should.not.equal(-1);
});
done();
});
});
});
});
});