Commit 67257b0a authored by JC Brand's avatar JC Brand

Test that room can be closed from rooms' list

parent 754caad0
......@@ -5,7 +5,7 @@
describe("The converse-roomslist plugin", function () {
it("shows a list of open rooms in the \"Rooms\" panel", mock.initConverse(
it("is shown under a list of open rooms in the \"Rooms\" panel", mock.initConverse(
{ whitelisted_plugins: ['converse-roomslist'],
allow_bookmarks: false // Makes testing easier, otherwise we
// have to mock stanza traffic.
......@@ -47,4 +47,33 @@
}
));
});
describe("An open room shown in the rooms list", function () {
it("can be closed", mock.initConverse(
{ whitelisted_plugins: ['converse-roomslist'],
allow_bookmarks: false // Makes testing easier, otherwise we
// have to mock stanza traffic.
},
function (_converse) {
spyOn(window, 'confirm').and.callFake(function () {
return true;
});
expect(_converse.chatboxes.length).toBe(1);
test_utils.openChatRoom(
_converse, 'lounge', 'conference.shakespeare.lit', 'JC');
expect(_converse.chatboxes.length).toBe(2);
test_utils.openControlBox().openRoomsPanel(_converse);
var room_els = _converse.rooms_list_view.el.querySelectorAll(".open-room");
expect(room_els.length).toBe(1);
var close_el = _converse.rooms_list_view.el.querySelector(".close-room");
close_el.click();
expect(window.confirm).toHaveBeenCalledWith(
'Are you sure you want to leave the room ""?');
room_els = _converse.rooms_list_view.el.querySelectorAll(".open-room");
expect(room_els.length).toBe(0);
expect(_converse.chatboxes.length).toBe(1);
}
));
});
}));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment