Re-group some message specs
This commit is contained in:
parent
2cbc4aaa50
commit
9430627180
@ -824,28 +824,6 @@
|
||||
done();
|
||||
}));
|
||||
|
||||
it("can be sent from a chatbox, and will appear inside it",
|
||||
mock.initConverse(
|
||||
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.waitForRoster(_converse, 'current');
|
||||
test_utils.openControlBox();
|
||||
spyOn(_converse.api, "trigger");
|
||||
const contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@montague.lit';
|
||||
await test_utils.openChatBoxFor(_converse, contact_jid)
|
||||
expect(_converse.api.trigger).toHaveBeenCalledWith('chatBoxFocused', jasmine.any(Object));
|
||||
const view = _converse.chatboxviews.get(contact_jid);
|
||||
const message = 'This message is sent from this chatbox';
|
||||
spyOn(view.model, 'sendMessage').and.callThrough();
|
||||
await test_utils.sendMessage(view, message);
|
||||
expect(view.model.sendMessage).toHaveBeenCalled();
|
||||
expect(view.model.messages.length, 2);
|
||||
expect(_converse.api.trigger.calls.mostRecent().args, ['messageSend', message]);
|
||||
expect(sizzle('.chat-content .chat-msg:last .chat-msg__text', view.el).pop().textContent).toEqual(message);
|
||||
done();
|
||||
}));
|
||||
|
||||
it("is sanitized to prevent Javascript injection attacks",
|
||||
mock.initConverse(
|
||||
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
|
||||
@ -1340,7 +1318,9 @@
|
||||
done();
|
||||
}));
|
||||
|
||||
it("delivery can be acknowledged by a receipt",
|
||||
describe("when sent", function () {
|
||||
|
||||
it("can have its delivery acknowledged by a receipt",
|
||||
mock.initConverse(
|
||||
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
|
||||
async function (done, _converse) {
|
||||
@ -1396,7 +1376,29 @@
|
||||
done();
|
||||
}));
|
||||
|
||||
describe("when sent", function () {
|
||||
|
||||
it("will appear inside the chatbox it was sent from",
|
||||
mock.initConverse(
|
||||
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
|
||||
async function (done, _converse) {
|
||||
|
||||
await test_utils.waitForRoster(_converse, 'current');
|
||||
test_utils.openControlBox();
|
||||
spyOn(_converse.api, "trigger");
|
||||
const contact_jid = mock.cur_names[0].replace(/ /g,'.').toLowerCase() + '@montague.lit';
|
||||
await test_utils.openChatBoxFor(_converse, contact_jid)
|
||||
expect(_converse.api.trigger).toHaveBeenCalledWith('chatBoxFocused', jasmine.any(Object));
|
||||
const view = _converse.chatboxviews.get(contact_jid);
|
||||
const message = 'This message is sent from this chatbox';
|
||||
spyOn(view.model, 'sendMessage').and.callThrough();
|
||||
await test_utils.sendMessage(view, message);
|
||||
expect(view.model.sendMessage).toHaveBeenCalled();
|
||||
expect(view.model.messages.length, 2);
|
||||
expect(_converse.api.trigger.calls.mostRecent().args, ['messageSend', message]);
|
||||
expect(sizzle('.chat-content .chat-msg:last .chat-msg__text', view.el).pop().textContent).toEqual(message);
|
||||
done();
|
||||
}));
|
||||
|
||||
|
||||
it("will be trimmed of leading and trailing whitespace",
|
||||
mock.initConverse(
|
||||
|
Loading…
Reference in New Issue
Block a user