describe('Whisper.View', function() {
it('renders a template with attributes', function() {
var viewClass = Whisper.View.extend({
template: '
{{ variable }}
',
attributes: {
variable: 'value'
}
});
var view = new viewClass();
view.render();
assert.strictEqual(view.$el.html(), 'value
');
});
it('renders a template with no 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 attributes function', function() {
var viewClass = Whisper.View.extend({
template: function() { return '{{ variable }}
'; },
attributes: function() {
return { variable: 'value' };
}
});
var view = new viewClass();
view.render();
assert.strictEqual(view.$el.html(), 'value
');
});
});