|
@@ -221,8 +221,8 @@
|
|
_converse.connection._dataRecv(test_utils.createRequest(presence));
|
|
_converse.connection._dataRecv(test_utils.createRequest(presence));
|
|
expect(_converse.connection.sendIQ).toHaveBeenCalled();
|
|
expect(_converse.connection.sendIQ).toHaveBeenCalled();
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
- "<iq to='room@conference.example.org' type='get' xmlns='jabber:client' id='"+IQ_id+
|
|
|
|
- "'><query xmlns='http://jabber.org/protocol/muc#owner'/></iq>"
|
|
|
|
|
|
+ `<iq id="${IQ_id}" to="room@conference.example.org" type="get" xmlns="jabber:client">`+
|
|
|
|
+ `<query xmlns="http://jabber.org/protocol/muc#owner"/></iq>`
|
|
);
|
|
);
|
|
var node = Strophe.xmlHtmlNode(
|
|
var node = Strophe.xmlHtmlNode(
|
|
'<iq xmlns="jabber:client"'+
|
|
'<iq xmlns="jabber:client"'+
|
|
@@ -334,16 +334,17 @@
|
|
* node="x-roomuser-item"/>
|
|
* node="x-roomuser-item"/>
|
|
* </iq>
|
|
* </iq>
|
|
*/
|
|
*/
|
|
- return test_utils.waitUntil(() => _.get(_.filter(
|
|
|
|
|
|
+ return test_utils.waitUntil(() => _.filter(
|
|
IQ_stanzas,
|
|
IQ_stanzas,
|
|
s => sizzle(`iq[to="${room_jid}"] query[node="x-roomuser-item"]`, s.nodeTree).length
|
|
s => sizzle(`iq[to="${room_jid}"] query[node="x-roomuser-item"]`, s.nodeTree).length
|
|
- ).pop(), 'nodeTree')
|
|
|
|
|
|
+ ).pop()
|
|
);
|
|
);
|
|
- }).then(stanza => {
|
|
|
|
- expect(stanza.outerHTML.trim()).toBe(
|
|
|
|
- `<iq to="lounge@localhost" from="dummy@localhost/resource" `+
|
|
|
|
- `type="get" xmlns="jabber:client" id="${stanza.getAttribute("id")}">`+
|
|
|
|
- `<query xmlns="http://jabber.org/protocol/disco#info" node="x-roomuser-item"/></iq>`);
|
|
|
|
|
|
+ }).then(node => {
|
|
|
|
+ const stanza = node.nodeTree;
|
|
|
|
+ expect(node.toLocaleString()).toBe(
|
|
|
|
+ `<iq from="dummy@localhost/resource" id="${stanza.getAttribute("id")}" to="lounge@localhost" `+
|
|
|
|
+ `type="get" xmlns="jabber:client">`+
|
|
|
|
+ `<query node="x-roomuser-item" xmlns="http://jabber.org/protocol/disco#info"/></iq>`);
|
|
|
|
|
|
/* <iq xmlns="jabber:client" type="error" to="jordie.langen@chat.example.org/converse.js-11659299" from="myroom@conference.chat.example.org">
|
|
/* <iq xmlns="jabber:client" type="error" to="jordie.langen@chat.example.org/converse.js-11659299" from="myroom@conference.chat.example.org">
|
|
* <error type="cancel">
|
|
* <error type="cancel">
|
|
@@ -403,9 +404,9 @@
|
|
* </iq>
|
|
* </iq>
|
|
*/
|
|
*/
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
- "<iq to='lounge@localhost' type='set' xmlns='jabber:client' id='"+IQ_id+"'>"+
|
|
|
|
- "<query xmlns='http://jabber.org/protocol/muc#owner'><x xmlns='jabber:x:data' type='submit'/>"+
|
|
|
|
- "</query></iq>");
|
|
|
|
|
|
+ `<iq id="${IQ_id}" to="lounge@localhost" type="set" xmlns="jabber:client">`+
|
|
|
|
+ `<query xmlns="http://jabber.org/protocol/muc#owner"><x type="submit" xmlns="jabber:x:data"/>`+
|
|
|
|
+ `</query></iq>`);
|
|
done();
|
|
done();
|
|
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
|
|
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
|
|
}));
|
|
}));
|
|
@@ -882,9 +883,9 @@
|
|
* </iq>
|
|
* </iq>
|
|
*/
|
|
*/
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
- "<iq to='coven@chat.shakespeare.lit' type='get' xmlns='jabber:client' id='"+IQ_id+"'>"+
|
|
|
|
- "<query xmlns='http://jabber.org/protocol/muc#owner'/>"+
|
|
|
|
- "</iq>");
|
|
|
|
|
|
+ `<iq id="`+IQ_id+`" to="coven@chat.shakespeare.lit" type="get" xmlns="jabber:client">`+
|
|
|
|
+ `<query xmlns="http://jabber.org/protocol/muc#owner"/>`+
|
|
|
|
+ `</iq>`);
|
|
|
|
|
|
/* Server responds with the configuration form.
|
|
/* Server responds with the configuration form.
|
|
* See: // http://xmpp.org/extensions/xep-0045.html#example-165
|
|
* See: // http://xmpp.org/extensions/xep-0045.html#example-165
|
|
@@ -1291,16 +1292,17 @@
|
|
* node='x-roomuser-item'/>
|
|
* node='x-roomuser-item'/>
|
|
* </iq>
|
|
* </iq>
|
|
*/
|
|
*/
|
|
- return test_utils.waitUntil(() => _.get(_.filter(
|
|
|
|
|
|
+ return test_utils.waitUntil(() => _.filter(
|
|
IQ_stanzas,
|
|
IQ_stanzas,
|
|
s => sizzle(`iq[to="${room_jid}"] query[node="x-roomuser-item"]`, s.nodeTree).length
|
|
s => sizzle(`iq[to="${room_jid}"] query[node="x-roomuser-item"]`, s.nodeTree).length
|
|
- ).pop(), 'nodeTree')
|
|
|
|
|
|
+ ).pop()
|
|
);
|
|
);
|
|
- }).then(iq => {
|
|
|
|
- expect(iq.outerHTML).toBe(
|
|
|
|
- `<iq to="lounge@localhost" from="dummy@localhost/resource" `+
|
|
|
|
- `type="get" xmlns="jabber:client" id="${iq.getAttribute('id')}">`+
|
|
|
|
- `<query xmlns="http://jabber.org/protocol/disco#info" node="x-roomuser-item"/></iq>`);
|
|
|
|
|
|
+ }).then(node => {
|
|
|
|
+ const iq = node.nodeTree;
|
|
|
|
+ expect(node.toLocaleString()).toBe(
|
|
|
|
+ `<iq from="dummy@localhost/resource" id="${iq.getAttribute('id')}" to="lounge@localhost" `+
|
|
|
|
+ `type="get" xmlns="jabber:client">`+
|
|
|
|
+ `<query node="x-roomuser-item" xmlns="http://jabber.org/protocol/disco#info"/></iq>`);
|
|
|
|
|
|
/* <iq from='coven@chat.shakespeare.lit'
|
|
/* <iq from='coven@chat.shakespeare.lit'
|
|
* id='getnick1'
|
|
* id='getnick1'
|
|
@@ -1403,11 +1405,12 @@
|
|
expect(window.prompt).toHaveBeenCalled();
|
|
expect(window.prompt).toHaveBeenCalled();
|
|
expect(view.model.directInvite).toHaveBeenCalled();
|
|
expect(view.model.directInvite).toHaveBeenCalled();
|
|
expect(sent_stanza.toLocaleString()).toBe(
|
|
expect(sent_stanza.toLocaleString()).toBe(
|
|
- "<message from='dummy@localhost/resource' to='felix.amsel@localhost' id='" +
|
|
|
|
- sent_stanza.nodeTree.getAttribute('id') +
|
|
|
|
- "' xmlns='jabber:client'>"+
|
|
|
|
- "<x xmlns='jabber:x:conference' jid='lounge@localhost' reason='Please join!'/>"+
|
|
|
|
- "</message>"
|
|
|
|
|
|
+ `<message from="dummy@localhost/resource" `+
|
|
|
|
+ `id="${sent_stanza.nodeTree.getAttribute("id")}" `+
|
|
|
|
+ `to="felix.amsel@localhost" `+
|
|
|
|
+ `xmlns="jabber:client">`+
|
|
|
|
+ `<x jid="lounge@localhost" reason="Please join!" xmlns="jabber:x:conference"/>`+
|
|
|
|
+ `</message>`
|
|
);
|
|
);
|
|
}
|
|
}
|
|
done();
|
|
done();
|
|
@@ -1722,15 +1725,16 @@
|
|
|
|
|
|
_converse.api.rooms.open(room_jid, {'nick': 'some1'})
|
|
_converse.api.rooms.open(room_jid, {'nick': 'some1'})
|
|
.then(() => {
|
|
.then(() => {
|
|
- return test_utils.waitUntil(() => _.get(_.filter(
|
|
|
|
|
|
+ return test_utils.waitUntil(() => _.filter(
|
|
IQ_stanzas,
|
|
IQ_stanzas,
|
|
iq => iq.nodeTree.querySelector(
|
|
iq => iq.nodeTree.querySelector(
|
|
`iq[to="${room_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
|
|
`iq[to="${room_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
|
|
- )).pop(), 'nodeTree'));
|
|
|
|
- }).then(stanza => {
|
|
|
|
|
|
+ )).pop());
|
|
|
|
+ }).then(node => {
|
|
// Check that the groupchat queried for the feautures.
|
|
// Check that the groupchat queried for the feautures.
|
|
- expect(stanza.outerHTML).toBe(
|
|
|
|
- `<iq from="dummy@localhost/resource" to="${room_jid}" type="get" xmlns="jabber:client" id="${stanza.getAttribute("id")}">`+
|
|
|
|
|
|
+ const stanza = node.nodeTree;
|
|
|
|
+ expect(node.toLocaleString()).toBe(
|
|
|
|
+ `<iq from="dummy@localhost/resource" id="${stanza.getAttribute("id")}" to="${room_jid}" type="get" xmlns="jabber:client">`+
|
|
`<query xmlns="http://jabber.org/protocol/disco#info"/>`+
|
|
`<query xmlns="http://jabber.org/protocol/disco#info"/>`+
|
|
`</iq>`);
|
|
`</iq>`);
|
|
|
|
|
|
@@ -2130,8 +2134,8 @@
|
|
keyCode: 13
|
|
keyCode: 13
|
|
});
|
|
});
|
|
expect(_converse.connection.send).toHaveBeenCalled();
|
|
expect(_converse.connection.send).toHaveBeenCalled();
|
|
- expect(sent_stanza.outerHTML).toBe(
|
|
|
|
- `<iq to="lounge@muc.localhost" type="set" xmlns="jabber:client" id="${sent_stanza.getAttribute('id')}">`+
|
|
|
|
|
|
+ expect(Strophe.serialize(sent_stanza)).toBe(
|
|
|
|
+ `<iq id="${sent_stanza.getAttribute('id')}" to="lounge@muc.localhost" type="set" xmlns="jabber:client">`+
|
|
`<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
`<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
`<item affiliation="member" jid="marc@localhost">`+
|
|
`<item affiliation="member" jid="marc@localhost">`+
|
|
`<reason>Welcome to the club!</reason>`+
|
|
`<reason>Welcome to the club!</reason>`+
|
|
@@ -2148,19 +2152,14 @@
|
|
});
|
|
});
|
|
_converse.connection.IQ_stanzas = [];
|
|
_converse.connection.IQ_stanzas = [];
|
|
_converse.connection._dataRecv(test_utils.createRequest(result));
|
|
_converse.connection._dataRecv(test_utils.createRequest(result));
|
|
-
|
|
|
|
- return test_utils.waitUntil(() => {
|
|
|
|
- return _.filter(
|
|
|
|
- _converse.connection.IQ_stanzas,
|
|
|
|
- (iq) => {
|
|
|
|
- const node = iq.nodeTree.querySelector('iq[to="lounge@muc.localhost"][type="get"] item[affiliation="member"]');
|
|
|
|
- if (node) { iq_stanza = iq.nodeTree;}
|
|
|
|
- return node;
|
|
|
|
- }).length;
|
|
|
|
- });
|
|
|
|
- }).then(() => {
|
|
|
|
- expect(iq_stanza.outerHTML).toBe(
|
|
|
|
- `<iq to="lounge@muc.localhost" type="get" xmlns="jabber:client" id="${iq_stanza.getAttribute('id')}">`+
|
|
|
|
|
|
+ return test_utils.waitUntil(() => _.filter(
|
|
|
|
+ _converse.connection.IQ_stanzas,
|
|
|
|
+ iq => iq.nodeTree.querySelector('iq[to="lounge@muc.localhost"][type="get"] item[affiliation="member"]')).pop()
|
|
|
|
+ );
|
|
|
|
+ }).then(node => {
|
|
|
|
+ iq_stanza = node.nodeTree;
|
|
|
|
+ expect(node.toLocaleString()).toBe(
|
|
|
|
+ `<iq id="${iq_stanza.getAttribute('id')}" to="lounge@muc.localhost" type="get" xmlns="jabber:client">`+
|
|
`<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
`<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
`<item affiliation="member"/>`+
|
|
`<item affiliation="member"/>`+
|
|
`</query>`+
|
|
`</query>`+
|
|
@@ -2178,18 +2177,14 @@
|
|
_converse.connection._dataRecv(test_utils.createRequest(result));
|
|
_converse.connection._dataRecv(test_utils.createRequest(result));
|
|
|
|
|
|
expect(view.model.occupants.length).toBe(2);
|
|
expect(view.model.occupants.length).toBe(2);
|
|
- return test_utils.waitUntil(() => {
|
|
|
|
- return _.filter(
|
|
|
|
- _converse.connection.IQ_stanzas,
|
|
|
|
- (iq) => {
|
|
|
|
- const node = iq.nodeTree.querySelector('iq[to="lounge@muc.localhost"][type="get"] item[affiliation="owner"]');
|
|
|
|
- if (node) { iq_stanza = iq.nodeTree;}
|
|
|
|
- return node;
|
|
|
|
- }).length;
|
|
|
|
- });
|
|
|
|
- }).then(() => {
|
|
|
|
- expect(iq_stanza.outerHTML).toBe(
|
|
|
|
- `<iq to="lounge@muc.localhost" type="get" xmlns="jabber:client" id="${iq_stanza.getAttribute('id')}">`+
|
|
|
|
|
|
+ return test_utils.waitUntil(() => _.filter(
|
|
|
|
+ _converse.connection.IQ_stanzas,
|
|
|
|
+ (iq) => iq.nodeTree.querySelector('iq[to="lounge@muc.localhost"][type="get"] item[affiliation="owner"]')).pop()
|
|
|
|
+ );
|
|
|
|
+ }).then(node => {
|
|
|
|
+ iq_stanza = node.nodeTree;
|
|
|
|
+ expect(node.toLocaleString()).toBe(
|
|
|
|
+ `<iq id="${iq_stanza.getAttribute('id')}" to="lounge@muc.localhost" type="get" xmlns="jabber:client">`+
|
|
`<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
`<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
`<item affiliation="owner"/>`+
|
|
`<item affiliation="owner"/>`+
|
|
`</query>`+
|
|
`</query>`+
|
|
@@ -2207,18 +2202,14 @@
|
|
_converse.connection._dataRecv(test_utils.createRequest(result));
|
|
_converse.connection._dataRecv(test_utils.createRequest(result));
|
|
|
|
|
|
expect(view.model.occupants.length).toBe(2);
|
|
expect(view.model.occupants.length).toBe(2);
|
|
- return test_utils.waitUntil(() => {
|
|
|
|
- return _.filter(
|
|
|
|
- _converse.connection.IQ_stanzas,
|
|
|
|
- (iq) => {
|
|
|
|
- const node = iq.nodeTree.querySelector('iq[to="lounge@muc.localhost"][type="get"] item[affiliation="admin"]');
|
|
|
|
- if (node) { iq_stanza = iq.nodeTree;}
|
|
|
|
- return node;
|
|
|
|
- }).length;
|
|
|
|
- });
|
|
|
|
- }).then(() => {
|
|
|
|
- expect(iq_stanza.outerHTML).toBe(
|
|
|
|
- `<iq to="lounge@muc.localhost" type="get" xmlns="jabber:client" id="${iq_stanza.getAttribute('id')}">`+
|
|
|
|
|
|
+ return test_utils.waitUntil(() => _.filter(
|
|
|
|
+ _converse.connection.IQ_stanzas,
|
|
|
|
+ (iq) => iq.nodeTree.querySelector('iq[to="lounge@muc.localhost"][type="get"] item[affiliation="admin"]')).pop()
|
|
|
|
+ );
|
|
|
|
+ }).then(node => {
|
|
|
|
+ const iq_stanza = node.nodeTree;
|
|
|
|
+ expect(node.toLocaleString()).toBe(
|
|
|
|
+ `<iq id="${iq_stanza.getAttribute('id')}" to="lounge@muc.localhost" type="get" xmlns="jabber:client">`+
|
|
`<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
`<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
`<item affiliation="admin"/>`+
|
|
`<item affiliation="admin"/>`+
|
|
`</query>`+
|
|
`</query>`+
|
|
@@ -2276,8 +2267,8 @@
|
|
});
|
|
});
|
|
|
|
|
|
expect(sent_stanza.textContent).toBe('This is a new subject');
|
|
expect(sent_stanza.textContent).toBe('This is a new subject');
|
|
- expect(sent_stanza.outerHTML).toBe(
|
|
|
|
- '<message to="lounge@localhost" from="dummy@localhost/resource" type="groupchat" xmlns="jabber:client">'+
|
|
|
|
|
|
+ expect(Strophe.serialize(sent_stanza).toLocaleString()).toBe(
|
|
|
|
+ '<message from="dummy@localhost/resource" to="lounge@localhost" type="groupchat" xmlns="jabber:client">'+
|
|
'<subject xmlns="jabber:client">This is a new subject</subject>'+
|
|
'<subject xmlns="jabber:client">This is a new subject</subject>'+
|
|
'</message>');
|
|
'</message>');
|
|
|
|
|
|
@@ -2289,8 +2280,8 @@
|
|
keyCode: 13
|
|
keyCode: 13
|
|
});
|
|
});
|
|
expect(sent_stanza.textContent).toBe('This is yet another subject');
|
|
expect(sent_stanza.textContent).toBe('This is yet another subject');
|
|
- expect(sent_stanza.outerHTML).toBe(
|
|
|
|
- '<message to="lounge@localhost" from="dummy@localhost/resource" type="groupchat" xmlns="jabber:client">'+
|
|
|
|
|
|
+ expect(Strophe.serialize(sent_stanza).toLocaleString()).toBe(
|
|
|
|
+ '<message from="dummy@localhost/resource" to="lounge@localhost" type="groupchat" xmlns="jabber:client">'+
|
|
'<subject xmlns="jabber:client">This is yet another subject</subject>'+
|
|
'<subject xmlns="jabber:client">This is yet another subject</subject>'+
|
|
'</message>');
|
|
'</message>');
|
|
done();
|
|
done();
|
|
@@ -2380,13 +2371,13 @@
|
|
expect(view.showErrorMessage.calls.count()).toBe(2);
|
|
expect(view.showErrorMessage.calls.count()).toBe(2);
|
|
// Check that the member list now gets updated
|
|
// Check that the member list now gets updated
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
- "<iq to='lounge@localhost' type='set' xmlns='jabber:client' id='"+IQ_id+"'>"+
|
|
|
|
- "<query xmlns='http://jabber.org/protocol/muc#admin'>"+
|
|
|
|
- "<item affiliation='owner' jid='annoyingGuy'>"+
|
|
|
|
- "<reason>You're responsible</reason>"+
|
|
|
|
- "</item>"+
|
|
|
|
- "</query>"+
|
|
|
|
- "</iq>");
|
|
|
|
|
|
+ `<iq id="${IQ_id}" to="lounge@localhost" type="set" xmlns="jabber:client">`+
|
|
|
|
+ `<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
|
|
+ `<item affiliation="owner" jid="annoyingGuy">`+
|
|
|
|
+ `<reason>You're responsible</reason>`+
|
|
|
|
+ `</item>`+
|
|
|
|
+ `</query>`+
|
|
|
|
+ `</iq>`);
|
|
|
|
|
|
presence = $pres({
|
|
presence = $pres({
|
|
'from': 'lounge@localhost/annoyingGuy',
|
|
'from': 'lounge@localhost/annoyingGuy',
|
|
@@ -2461,13 +2452,13 @@
|
|
expect(view.model.setAffiliation).toHaveBeenCalled();
|
|
expect(view.model.setAffiliation).toHaveBeenCalled();
|
|
// Check that the member list now gets updated
|
|
// Check that the member list now gets updated
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
- "<iq to='lounge@localhost' type='set' xmlns='jabber:client' id='"+IQ_id+"'>"+
|
|
|
|
- "<query xmlns='http://jabber.org/protocol/muc#admin'>"+
|
|
|
|
- "<item affiliation='outcast' jid='annoyingGuy'>"+
|
|
|
|
- "<reason>You're annoying</reason>"+
|
|
|
|
- "</item>"+
|
|
|
|
- "</query>"+
|
|
|
|
- "</iq>");
|
|
|
|
|
|
+ `<iq id="${IQ_id}" to="lounge@localhost" type="set" xmlns="jabber:client">`+
|
|
|
|
+ `<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
|
|
+ `<item affiliation="outcast" jid="annoyingGuy">`+
|
|
|
|
+ `<reason>You're annoying</reason>`+
|
|
|
|
+ `</item>`+
|
|
|
|
+ `</query>`+
|
|
|
|
+ `</iq>`);
|
|
|
|
|
|
presence = $pres({
|
|
presence = $pres({
|
|
'from': 'lounge@localhost/annoyingGuy',
|
|
'from': 'lounge@localhost/annoyingGuy',
|
|
@@ -2541,13 +2532,13 @@
|
|
expect(view.showErrorMessage.calls.count()).toBe(1);
|
|
expect(view.showErrorMessage.calls.count()).toBe(1);
|
|
expect(view.modifyRole).toHaveBeenCalled();
|
|
expect(view.modifyRole).toHaveBeenCalled();
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
- "<iq to='lounge@localhost' type='set' xmlns='jabber:client' id='"+IQ_id+"'>"+
|
|
|
|
- "<query xmlns='http://jabber.org/protocol/muc#admin'>"+
|
|
|
|
- "<item nick='annoyingGuy' role='none'>"+
|
|
|
|
- "<reason>You're annoying</reason>"+
|
|
|
|
- "</item>"+
|
|
|
|
- "</query>"+
|
|
|
|
- "</iq>");
|
|
|
|
|
|
+ `<iq id="${IQ_id}" to="lounge@localhost" type="set" xmlns="jabber:client">`+
|
|
|
|
+ `<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
|
|
+ `<item nick="annoyingGuy" role="none">`+
|
|
|
|
+ `<reason>You're annoying</reason>`+
|
|
|
|
+ `</item>`+
|
|
|
|
+ `</query>`+
|
|
|
|
+ `</iq>`);
|
|
|
|
|
|
/* <presence
|
|
/* <presence
|
|
* from='harfleur@chat.shakespeare.lit/pistol'
|
|
* from='harfleur@chat.shakespeare.lit/pistol'
|
|
@@ -2645,13 +2636,13 @@
|
|
expect(view.showErrorMessage.calls.count()).toBe(1);
|
|
expect(view.showErrorMessage.calls.count()).toBe(1);
|
|
expect(view.modifyRole).toHaveBeenCalled();
|
|
expect(view.modifyRole).toHaveBeenCalled();
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
- "<iq to='lounge@localhost' type='set' xmlns='jabber:client' id='"+IQ_id+"'>"+
|
|
|
|
- "<query xmlns='http://jabber.org/protocol/muc#admin'>"+
|
|
|
|
- "<item nick='trustworthyguy' role='moderator'>"+
|
|
|
|
- "<reason>You're trustworthy</reason>"+
|
|
|
|
- "</item>"+
|
|
|
|
- "</query>"+
|
|
|
|
- "</iq>");
|
|
|
|
|
|
+ `<iq id="${IQ_id}" to="lounge@localhost" type="set" xmlns="jabber:client">`+
|
|
|
|
+ `<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
|
|
+ `<item nick="trustworthyguy" role="moderator">`+
|
|
|
|
+ `<reason>You're trustworthy</reason>`+
|
|
|
|
+ `</item>`+
|
|
|
|
+ `</query>`+
|
|
|
|
+ `</iq>`);
|
|
|
|
|
|
/* <presence
|
|
/* <presence
|
|
* from='coven@chat.shakespeare.lit/thirdwitch'
|
|
* from='coven@chat.shakespeare.lit/thirdwitch'
|
|
@@ -2682,13 +2673,13 @@
|
|
expect(view.showChatEvent.calls.count()).toBe(1);
|
|
expect(view.showChatEvent.calls.count()).toBe(1);
|
|
expect(view.modifyRole).toHaveBeenCalled();
|
|
expect(view.modifyRole).toHaveBeenCalled();
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
- "<iq to='lounge@localhost' type='set' xmlns='jabber:client' id='"+IQ_id+"'>"+
|
|
|
|
- "<query xmlns='http://jabber.org/protocol/muc#admin'>"+
|
|
|
|
- "<item nick='trustworthyguy' role='participant'>"+
|
|
|
|
- "<reason>Perhaps not</reason>"+
|
|
|
|
- "</item>"+
|
|
|
|
- "</query>"+
|
|
|
|
- "</iq>");
|
|
|
|
|
|
+ `<iq id="${IQ_id}" to="lounge@localhost" type="set" xmlns="jabber:client">`+
|
|
|
|
+ `<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
|
|
+ `<item nick="trustworthyguy" role="participant">`+
|
|
|
|
+ `<reason>Perhaps not</reason>`+
|
|
|
|
+ `</item>`+
|
|
|
|
+ `</query>`+
|
|
|
|
+ `</iq>`);
|
|
|
|
|
|
/* <presence
|
|
/* <presence
|
|
* from='coven@chat.shakespeare.lit/thirdwitch'
|
|
* from='coven@chat.shakespeare.lit/thirdwitch'
|
|
@@ -2783,13 +2774,13 @@
|
|
expect(view.showErrorMessage.calls.count()).toBe(1);
|
|
expect(view.showErrorMessage.calls.count()).toBe(1);
|
|
expect(view.modifyRole).toHaveBeenCalled();
|
|
expect(view.modifyRole).toHaveBeenCalled();
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
- "<iq to='lounge@localhost' type='set' xmlns='jabber:client' id='"+IQ_id+"'>"+
|
|
|
|
- "<query xmlns='http://jabber.org/protocol/muc#admin'>"+
|
|
|
|
- "<item nick='annoyingGuy' role='visitor'>"+
|
|
|
|
- "<reason>You're annoying</reason>"+
|
|
|
|
- "</item>"+
|
|
|
|
- "</query>"+
|
|
|
|
- "</iq>");
|
|
|
|
|
|
+ `<iq id="${IQ_id}" to="lounge@localhost" type="set" xmlns="jabber:client">`+
|
|
|
|
+ `<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
|
|
+ `<item nick="annoyingGuy" role="visitor">`+
|
|
|
|
+ `<reason>You're annoying</reason>`+
|
|
|
|
+ `</item>`+
|
|
|
|
+ `</query>`+
|
|
|
|
+ `</iq>`);
|
|
|
|
|
|
/* <presence
|
|
/* <presence
|
|
* from='coven@chat.shakespeare.lit/thirdwitch'
|
|
* from='coven@chat.shakespeare.lit/thirdwitch'
|
|
@@ -2820,13 +2811,13 @@
|
|
expect(view.showChatEvent.calls.count()).toBe(1);
|
|
expect(view.showChatEvent.calls.count()).toBe(1);
|
|
expect(view.modifyRole).toHaveBeenCalled();
|
|
expect(view.modifyRole).toHaveBeenCalled();
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
expect(sent_IQ.toLocaleString()).toBe(
|
|
- "<iq to='lounge@localhost' type='set' xmlns='jabber:client' id='"+IQ_id+"'>"+
|
|
|
|
- "<query xmlns='http://jabber.org/protocol/muc#admin'>"+
|
|
|
|
- "<item nick='annoyingGuy' role='participant'>"+
|
|
|
|
- "<reason>Now you can talk again</reason>"+
|
|
|
|
- "</item>"+
|
|
|
|
- "</query>"+
|
|
|
|
- "</iq>");
|
|
|
|
|
|
+ `<iq id="${IQ_id}" to="lounge@localhost" type="set" xmlns="jabber:client">`+
|
|
|
|
+ `<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
|
|
+ `<item nick="annoyingGuy" role="participant">`+
|
|
|
|
+ `<reason>Now you can talk again</reason>`+
|
|
|
|
+ `</item>`+
|
|
|
|
+ `</query>`+
|
|
|
|
+ `</iq>`);
|
|
|
|
|
|
/* <presence
|
|
/* <presence
|
|
* from='coven@chat.shakespeare.lit/thirdwitch'
|
|
* from='coven@chat.shakespeare.lit/thirdwitch'
|
|
@@ -3160,15 +3151,16 @@
|
|
|
|
|
|
_converse.api.rooms.open(room_jid, {'nick': 'dummy'})
|
|
_converse.api.rooms.open(room_jid, {'nick': 'dummy'})
|
|
.then(() => {
|
|
.then(() => {
|
|
- return test_utils.waitUntil(() => _.get(_.filter(
|
|
|
|
|
|
+ return test_utils.waitUntil(() => _.filter(
|
|
IQ_stanzas,
|
|
IQ_stanzas,
|
|
iq => iq.nodeTree.querySelector(
|
|
iq => iq.nodeTree.querySelector(
|
|
`iq[to="${room_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
|
|
`iq[to="${room_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
|
|
- )).pop(), 'nodeTree'));
|
|
|
|
- }).then(stanza => {
|
|
|
|
|
|
+ )).pop());
|
|
|
|
+ }).then(node => {
|
|
// Check that the groupchat queried for the feautures.
|
|
// Check that the groupchat queried for the feautures.
|
|
- expect(stanza.outerHTML).toBe(
|
|
|
|
- `<iq from="dummy@localhost/resource" to="${room_jid}" type="get" xmlns="jabber:client" id="${stanza.getAttribute("id")}">`+
|
|
|
|
|
|
+ const stanza = node.nodeTree;
|
|
|
|
+ expect(node.toLocaleString()).toBe(
|
|
|
|
+ `<iq from="dummy@localhost/resource" id="${stanza.getAttribute("id")}" to="${room_jid}" type="get" xmlns="jabber:client">`+
|
|
`<query xmlns="http://jabber.org/protocol/disco#info"/>`+
|
|
`<query xmlns="http://jabber.org/protocol/disco#info"/>`+
|
|
`</iq>`);
|
|
`</iq>`);
|
|
|
|
|
|
@@ -3215,23 +3207,23 @@
|
|
var member_iq_id = IQ_ids.pop();
|
|
var member_iq_id = IQ_ids.pop();
|
|
|
|
|
|
expect(sent_IQs.pop().toLocaleString()).toBe(
|
|
expect(sent_IQs.pop().toLocaleString()).toBe(
|
|
- "<iq to='coven@chat.shakespeare.lit' type='get' xmlns='jabber:client' id='"+admin_iq_id+"'>"+
|
|
|
|
- "<query xmlns='http://jabber.org/protocol/muc#admin'>"+
|
|
|
|
- "<item affiliation='admin'/>"+
|
|
|
|
- "</query>"+
|
|
|
|
- "</iq>");
|
|
|
|
|
|
+ `<iq id="${admin_iq_id}" to="coven@chat.shakespeare.lit" type="get" xmlns="jabber:client">`+
|
|
|
|
+ `<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
|
|
+ `<item affiliation="admin"/>`+
|
|
|
|
+ `</query>`+
|
|
|
|
+ `</iq>`);
|
|
expect(sent_IQs.pop().toLocaleString()).toBe(
|
|
expect(sent_IQs.pop().toLocaleString()).toBe(
|
|
- "<iq to='coven@chat.shakespeare.lit' type='get' xmlns='jabber:client' id='"+owner_iq_id+"'>"+
|
|
|
|
- "<query xmlns='http://jabber.org/protocol/muc#admin'>"+
|
|
|
|
- "<item affiliation='owner'/>"+
|
|
|
|
- "</query>"+
|
|
|
|
- "</iq>");
|
|
|
|
|
|
+ `<iq id="${owner_iq_id}" to="coven@chat.shakespeare.lit" type="get" xmlns="jabber:client">`+
|
|
|
|
+ `<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
|
|
+ `<item affiliation="owner"/>`+
|
|
|
|
+ `</query>`+
|
|
|
|
+ `</iq>`);
|
|
expect(sent_IQs.pop().toLocaleString()).toBe(
|
|
expect(sent_IQs.pop().toLocaleString()).toBe(
|
|
- "<iq to='coven@chat.shakespeare.lit' type='get' xmlns='jabber:client' id='"+member_iq_id+"'>"+
|
|
|
|
- "<query xmlns='http://jabber.org/protocol/muc#admin'>"+
|
|
|
|
- "<item affiliation='member'/>"+
|
|
|
|
- "</query>"+
|
|
|
|
- "</iq>");
|
|
|
|
|
|
+ `<iq id="${member_iq_id}" to="coven@chat.shakespeare.lit" type="get" xmlns="jabber:client">`+
|
|
|
|
+ `<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
|
|
+ `<item affiliation="member"/>`+
|
|
|
|
+ `</query>`+
|
|
|
|
+ `</iq>`);
|
|
|
|
|
|
/* Now the service sends the member list to the user
|
|
/* Now the service sends the member list to the user
|
|
*
|
|
*
|
|
@@ -3294,18 +3286,18 @@
|
|
)).pop(), 'nodeTree'));
|
|
)).pop(), 'nodeTree'));
|
|
}).then(stanza => {
|
|
}).then(stanza => {
|
|
expect(stanza.outerHTML,
|
|
expect(stanza.outerHTML,
|
|
- "<iq to='coven@chat.shakespeare.lit' type='set' xmlns='jabber:client' id='"+IQ_ids.pop()+"'>"+
|
|
|
|
- "<query xmlns='http://jabber.org/protocol/muc#admin'>"+
|
|
|
|
- "<item affiliation='member' jid='"+invitee_jid+"'>"+
|
|
|
|
- "<reason>Please join this groupchat</reason>"+
|
|
|
|
- "</item>"+
|
|
|
|
- "</query>"+
|
|
|
|
- "</iq>");
|
|
|
|
|
|
+ `<iq id="${IQ_ids.pop()}" to="coven@chat.shakespeare.lit" type="set" xmlns="jabber:client">`+
|
|
|
|
+ `<query xmlns="http://jabber.org/protocol/muc#admin">`+
|
|
|
|
+ `<item affiliation="member" jid="${invitee_jid}">`+
|
|
|
|
+ `<reason>Please join this groupchat</reason>`+
|
|
|
|
+ `</item>`+
|
|
|
|
+ `</query>`+
|
|
|
|
+ `</iq>`);
|
|
// Finally check that the user gets invited.
|
|
// Finally check that the user gets invited.
|
|
expect(sent_stanza.toLocaleString()).toBe( // Strophe adds the xmlns attr (although not in spec)
|
|
expect(sent_stanza.toLocaleString()).toBe( // Strophe adds the xmlns attr (although not in spec)
|
|
- "<message from='dummy@localhost/resource' to='"+invitee_jid+"' id='"+sent_id+"' xmlns='jabber:client'>"+
|
|
|
|
- "<x xmlns='jabber:x:conference' jid='coven@chat.shakespeare.lit' reason='Please join this groupchat'/>"+
|
|
|
|
- "</message>"
|
|
|
|
|
|
+ `<message from="dummy@localhost/resource" id="${sent_id}" to="${invitee_jid}" xmlns="jabber:client">`+
|
|
|
|
+ `<x jid="coven@chat.shakespeare.lit" reason="Please join this groupchat" xmlns="jabber:x:conference"/>`+
|
|
|
|
+ `</message>`
|
|
);
|
|
);
|
|
done();
|
|
done();
|
|
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
|
|
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
|
|
@@ -3443,9 +3435,9 @@
|
|
return test_utils.waitUntil(() => _converse.chatboxes.length);
|
|
return test_utils.waitUntil(() => _converse.chatboxes.length);
|
|
}).then(() => {
|
|
}).then(() => {
|
|
expect(sent_stanza.toLocaleString()).toBe(
|
|
expect(sent_stanza.toLocaleString()).toBe(
|
|
- "<iq to='chat.shakespear.lit' from='dummy@localhost/resource' type='get' xmlns='jabber:client' id='"+IQ_id+"'>"+
|
|
|
|
- "<query xmlns='http://jabber.org/protocol/disco#items'/>"+
|
|
|
|
- "</iq>"
|
|
|
|
|
|
+ `<iq from="dummy@localhost/resource" id="${IQ_id}" to="chat.shakespear.lit" type="get" xmlns="jabber:client">`+
|
|
|
|
+ `<query xmlns="http://jabber.org/protocol/disco#items"/>`+
|
|
|
|
+ `</iq>`
|
|
);
|
|
);
|
|
|
|
|
|
var iq = $iq({
|
|
var iq = $iq({
|