-
Notifications
You must be signed in to change notification settings - Fork 0
/
widget_test.js
55 lines (45 loc) · 1.18 KB
/
widget_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
'use strict';
import assert from 'assert';
import MyCoolWidget from '../dist';
// var MyCoolWidget = require('marko-es7');
// require('../node-require').install();
var chai = require('chai');
chai.Assertion.includeStack = true;
require('chai').should();
var expect = require('chai').expect;
//
// require('./util').loadRenderTests(
// 'fixtures/templates',
// 'render',
// {
// ext: '.marko'
// });
let buffer = '';
let out = {
write: function(txt) {
// console.log('write', txt);
buffer += txt;
}
};
describe('MyCoolWidget', function () {
let myWidget = new MyCoolWidget();
beforeEach(function() {
buffer = '';
});
describe('render', function () {
it('should render with no data', function () {
myWidget.customRender({}, out);
expect(buffer).to.eql('Hello Kris!');
});
it('should render using data', function () {
myWidget.customRender({name: 'Kristian'}, out);
expect(buffer).to.eql('Hello Kristian!');
});
});
describe('template renderer', function () {
it('should render with no data', function () {
myWidget.render({}, out);
expect(buffer).to.eql('Hello Kris!');
});
});
});