|
@@ -93,7 +93,7 @@ describe('MUC Private Messages', () => {
|
|
|
|
|
|
describe('When sending a MUC private message', () => {
|
|
|
it(
|
|
|
- 'correctly shows the senders avatar',
|
|
|
+ 'sends out the correct stanza',
|
|
|
mock.initConverse(['chatBoxesFetched'], { view_mode: 'fullscreen' }, async (_converse) => {
|
|
|
const { api } = _converse;
|
|
|
const nick = 'romeo';
|
|
@@ -118,8 +118,11 @@ describe('MUC Private Messages', () => {
|
|
|
// Open the occupant view in the sidebar
|
|
|
view.querySelector('.occupant-list converse-avatar[name="firstwitch"]').click();
|
|
|
|
|
|
- const occupant = view.model.getOccupant('firstwitch');
|
|
|
- occupant.sendMessage({ body: 'hello world' });
|
|
|
+ const textarea = await u.waitUntil(() => view.querySelector('converse-muc-occupant textarea'));
|
|
|
+ textarea.value = 'hello';
|
|
|
+
|
|
|
+ const button = view.querySelector('converse-muc-occupant .send-button');
|
|
|
+ button.click();
|
|
|
|
|
|
await u.waitUntil(
|
|
|
() => api.connection.get().sent_stanzas.filter((s) => s.nodeName === 'message').length
|
|
@@ -131,11 +134,46 @@ describe('MUC Private Messages', () => {
|
|
|
to="${muc_jid}/firstwitch"
|
|
|
id="${sent_stanza.getAttribute('id')}"
|
|
|
xmlns="jabber:client">
|
|
|
- <body>hello world</body>
|
|
|
+ <body>hello</body>
|
|
|
<active xmlns="http://jabber.org/protocol/chatstates"/>
|
|
|
<request xmlns="urn:xmpp:receipts"/>
|
|
|
<origin-id xmlns="urn:xmpp:sid:0" id="${sent_stanza.querySelector('origin-id')?.getAttribute('id')}"/>
|
|
|
</message>`);
|
|
|
+ })
|
|
|
+ );
|
|
|
+
|
|
|
+ it(
|
|
|
+ 'correctly shows the senders avatar',
|
|
|
+ mock.initConverse(['chatBoxesFetched'], { view_mode: 'fullscreen' }, async (_converse) => {
|
|
|
+ const { api } = _converse;
|
|
|
+ const nick = 'romeo';
|
|
|
+ const muc_jid = 'coven@chat.shakespeare.lit';
|
|
|
+ await mock.openAndEnterChatRoom(_converse, muc_jid, nick);
|
|
|
+ const view = _converse.chatboxviews.get(muc_jid);
|
|
|
+
|
|
|
+ _converse.api.connection.get()._dataRecv(
|
|
|
+ mock.createRequest(stx`
|
|
|
+ <presence
|
|
|
+ from="${muc_jid}/firstwitch"
|
|
|
+ id="${u.getUniqueId()}"
|
|
|
+ to="${_converse.jid}"
|
|
|
+ xmlns="jabber:client">
|
|
|
+ <x xmlns="http://jabber.org/protocol/muc#user">
|
|
|
+ <item affiliation="owner" role="moderator"/>
|
|
|
+ </x>
|
|
|
+ </presence>`)
|
|
|
+ );
|
|
|
+ await u.waitUntil(() => view.querySelectorAll('.occupant-list converse-avatar').length === 2);
|
|
|
+
|
|
|
+ // Open the occupant view in the sidebar
|
|
|
+ view.querySelector('.occupant-list converse-avatar[name="firstwitch"]').click();
|
|
|
+
|
|
|
+ const occupant = view.model.getOccupant('firstwitch');
|
|
|
+ occupant.sendMessage({ body: 'hello world' });
|
|
|
+
|
|
|
+ await u.waitUntil(
|
|
|
+ () => api.connection.get().sent_stanzas.filter((s) => s.nodeName === 'message').length
|
|
|
+ );
|
|
|
|
|
|
const avatar = view.querySelector('converse-muc-occupant converse-chat-message converse-avatar');
|
|
|
expect(avatar).toBeDefined();
|