Add some initial tests for the room invite feature. updates #215

This commit is contained in:
JC Brand 2014-08-31 22:48:26 +02:00
parent bf0d0320c5
commit 18cbe06d58
3 changed files with 37 additions and 6 deletions

View File

@ -610,6 +610,10 @@ span.spinner.hor_centered {
width: 99px;
border-bottom: 1px solid #999;
}
#conversejs .participants label {
margin-top: 5px;
display: block;
}
#conversejs .participants ul.participant-list li {
overflow: hidden;
text-overflow: ellipsis;

View File

@ -661,6 +661,11 @@ span.spinner.hor_centered {
border-bottom: 1px solid #999;
}
#conversejs .participants label {
margin-top: 5px;
display: block;
}
#conversejs .participants ul.participant-list li {
overflow: hidden;
text-overflow: ellipsis;

View File

@ -12,16 +12,13 @@
beforeEach(function () {
runs(function () {
test_utils.closeAllChatBoxes();
});
waits(250);
runs(function () {
test_utils.openControlBox();
});
waits(250);
waits(150);
runs(function () {
test_utils.openRoomsPanel();
});
waits(501);
waits(200);
runs(function () {
// Open a new chatroom
var roomspanel = converse.chatboxviews.get('controlbox').roomspanel;
@ -37,7 +34,6 @@
runs(function () {
test_utils.closeControlBox();
});
waits(250);
runs(function () {});
});
@ -70,6 +66,32 @@
}, converse));
it("allows the user to invite their roster contacts to enter the chat room", $.proxy(function () {
spyOn(converse, 'emit');
spyOn(window, 'prompt').andCallFake(function () {
return null;
});
var roster = {}, $input;
var view = this.chatboxviews.get('lounge@muc.localhost');
view.$el.find('.chat-area').remove();
view.renderChatArea(); // Will init the widget
test_utils.createContacts('current'); // We need roster contacts, so that we have someone to invite
$input = view.$el.find('input.invited-contact.tt-input');
$hint = view.$el.find('input.invited-contact.tt-hint');
runs (function () {
expect($input.length).toBe(1);
expect($input.attr('placeholder')).toBe('Type to invite');
$input.val("Felix");
$input.trigger('input');
});
waits(350); // Needed, due to debounce
runs (function () {
expect($input.val()).toBe('Felix');
expect($hint.val()).toBe('Felix Amsel');
var $sugg = view.$el.find('[data-jid="felix.amsel@localhost"]');
expect($sugg.length).toBe(1);
$sugg.trigger('click');
expect(window.prompt).toHaveBeenCalled();
});
}, converse));
it("shows received groupchat messages", $.proxy(function () {