describe('Whisper.View', function() {
it('renders a template with render_attributes', function() {
var viewClass = Whisper.View.extend({
template: '
{{ variable }}
',
render_attributes: {
variable: 'value',
},
});
var view = new viewClass();
view.render();
assert.strictEqual(view.$el.html(), 'value
');
});
it('renders a template with no render_attributes', function() {
var viewClass = Whisper.View.extend({
template: 'static text
',
});
var view = new viewClass();
view.render();
assert.strictEqual(view.$el.html(), 'static text
');
});
it('renders a template function with render_attributes function', function() {
var viewClass = Whisper.View.extend({
template: function() {
return '{{ variable }}
';
},
render_attributes: function() {
return { variable: 'value' };
},
});
var view = new viewClass();
view.render();
assert.strictEqual(view.$el.html(), 'value
');
});
});