-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathtest.process.js
33 lines (30 loc) · 993 Bytes
/
test.process.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
var BH = require('../lib/bh');
require('chai').should();
describe('ctx.process()', function() {
var bh;
beforeEach(function() {
bh = new BH();
});
it('should return valid processed json', function() {
bh.match('search', function(ctx) {
ctx.content(ctx.process({ block: 'input' }));
});
bh.match('input', function(ctx) {
ctx.tag('input');
});
bh.apply({ block: 'search' }).should.equal(
'<div class="search"><input class="input"/></div>'
);
});
it('should return valid processed element with no block name', function() {
bh.match('button', function(ctx) {
ctx.content(ctx.process({ elem: 'inner' }));
});
bh.match('button__inner', function(ctx) {
ctx.tag('span');
});
bh.apply({ block: 'button' }).should.equal(
'<div class="button"><span class="button__inner"></span></div>'
);
});
});