You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/test/views/message_view_test.js

28 lines
788 B
JavaScript

describe('MessageView', function() {
var message = Whisper.Messages.add({
threadId: 'test-thread',
body: 'hello world',
type: 'outgoing',
timestamp: new Date().getTime()
});
describe('#render', function() {
var view = new Whisper.MessageView({model: message});
var div = $('<div>').append(view.render().$el);
it('should include the message text', function() {
assert.match(view.$el.html(), /hello world/);
});
it('should auto-update the message text', function() {
message.set('body', 'goodbye world');
assert.match(view.$el.html(), /goodbye world/);
});
it('should go away when the model is destroyed', function() {
message.destroy();
assert.strictEqual(div.find(view.$el).length, 0);
});
});
});