|
@@ -117,4 +117,26 @@ describe("A MUC message", function () {
|
|
const model = _converse.chatboxes.get(muc_jid);
|
|
const model = _converse.chatboxes.get(muc_jid);
|
|
expect(model.messages.length).toBe(0);
|
|
expect(model.messages.length).toBe(0);
|
|
}));
|
|
}));
|
|
|
|
+
|
|
|
|
+ it('parses the correct body element',
|
|
|
|
+ mock.initConverse(['chatBoxesFetched'], {}, async function(_converse) {
|
|
|
|
+
|
|
|
|
+ const muc_jid = 'lounge@montague.lit';
|
|
|
|
+ const model = await mock.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
|
|
|
|
+ const received_stanza = u.toStanza(`
|
|
|
|
+ <message to='${_converse.jid}' from='${muc_jid}/mallory' type='groupchat' id='${_converse.connection.getUniqueId()}' >
|
|
|
|
+ <reply xmlns='urn:xmpp:reply:0' id='${_converse.connection.getUniqueId()}' to='${_converse.jid}'/>
|
|
|
|
+ <fallback xmlns='urn:xmpp:feature-fallback:0' for='urn:xmpp:reply:0'>
|
|
|
|
+ <body start='0' end='10'/>
|
|
|
|
+ </fallback>
|
|
|
|
+ <active xmlns='http://jabber.org/protocol/chatstates'/>
|
|
|
|
+ <body>> ping
|
|
|
|
+pong</body>
|
|
|
|
+ <request xmlns='urn:xmpp:receipts'/>
|
|
|
|
+ </message>
|
|
|
|
+ `);
|
|
|
|
+ await model.handleMessageStanza(received_stanza);
|
|
|
|
+ await u.waitUntil(() => model.messages.last());
|
|
|
|
+ expect(model.messages.last().get('body')).toBe('> ping\npong');
|
|
|
|
+ }));
|
|
});
|
|
});
|