-
Notifications
You must be signed in to change notification settings - Fork 3
/
test.js
55 lines (46 loc) · 1.54 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
54
55
var block = require('./')
describe('Block', function () {
it('should work with spaces', function () {
block('<div>{{ hello }}</div>').render({
hello: 'a'
}).should.equal('<div>a</div>')
})
it('should work without spaces', function () {
block('<div>{{hello}}</div>').render({
hello: 'a'
}).should.equal('<div>a</div>')
})
it('should work with multiple declarations of a block', function () {
block('<div>{{hello}}</div><div>{{hello}}</div><div>{{hello}}</div>').render({
hello: 'a'
}).should.equal('<div>a</div><div>a</div><div>a</div>')
})
it('should work with multiple blocks', function () {
block('<div>{{first}}</div><div>{{second}}</div>').render({
first: 'a',
second: 'b'
}).should.equal('<div>a</div><div>b</div>')
})
it('should work with template locals', function () {
block('<div>{{first}}</div>').local('first', 'a')
.render().should.equal('<div>a</div>')
})
it('should work with template locals object', function () {
block('<div>{{first}}</div>').locals({
first: 'a'
}).render().should.equal('<div>a</div>')
})
it('should work without locals', function () {
block('<div></div>').render().should.equal('<div></div>')
})
it('should default to the empty string', function () {
block('<div>{{hello}}</div>').render({
hello: false
}).should.equal('<div></div>')
})
it('should work with non-word names', function () {
block('<div>{{hell.oh}}</div>').render({
'hell.oh': 'a'
}).should.equal('<div>a</div>')
})
})