-
-
Notifications
You must be signed in to change notification settings - Fork 776
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
165 additions
and
203 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,8 +128,8 @@ describe("A MUC message", function () { | |
|
||
const muc_jid = '[email protected]'; | ||
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.api.connection.get().getUniqueId()}' > | ||
const received_stanza = stx` | ||
<message xmlns="jabber:client" to='${_converse.jid}' from='${muc_jid}/mallory' type='groupchat' id='${_converse.api.connection.get().getUniqueId()}' > | ||
<reply xmlns='urn:xmpp:reply:0' id='${_converse.api.connection.get().getUniqueId()}' to='${_converse.jid}'/> | ||
<fallback xmlns='urn:xmpp:feature-fallback:0' for='urn:xmpp:reply:0'> | ||
<body start='0' end='10'/> | ||
|
@@ -139,7 +139,7 @@ describe("A MUC message", function () { | |
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\n pong'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ const { Promise, $msg, Strophe, sizzle, u } = converse.env; | |
|
||
describe("A Chat Message", function () { | ||
|
||
beforeAll(() => jasmine.addMatchers({ toEqualStanza: jasmine.toEqualStanza })); | ||
|
||
it("can be sent as a correction by using the up arrow", | ||
mock.initConverse(['chatBoxesFetched'], {}, async function (_converse) { | ||
|
||
|
@@ -56,16 +58,16 @@ describe("A Chat Message", function () { | |
|
||
expect(api.connection.get().send).toHaveBeenCalled(); | ||
const msg = api.connection.get().send.calls.all()[0].args[0]; | ||
expect(Strophe.serialize(msg)) | ||
.toBe(`<message from="[email protected]/orchard" id="${msg.getAttribute("id")}" `+ | ||
`to="[email protected]" type="chat" `+ | ||
`xmlns="jabber:client">`+ | ||
`<body>But soft, what light through yonder window breaks?</body>`+ | ||
`<active xmlns="http://jabber.org/protocol/chatstates"/>`+ | ||
`<request xmlns="urn:xmpp:receipts"/>`+ | ||
`<replace id="${first_msg.get("msgid")}" xmlns="urn:xmpp:message-correct:0"/>`+ | ||
`<origin-id id="${msg.querySelector('origin-id').getAttribute("id")}" xmlns="urn:xmpp:sid:0"/>`+ | ||
`</message>`); | ||
expect(msg).toEqualStanza( | ||
stx`<message from="[email protected]/orchard" id="${msg.getAttribute("id")}" | ||
to="[email protected]" type="chat" | ||
xmlns="jabber:client"> | ||
<body>But soft, what light through yonder window breaks?</body> | ||
<active xmlns="http://jabber.org/protocol/chatstates"/> | ||
<request xmlns="urn:xmpp:receipts"/> | ||
<replace id="${first_msg.get("msgid")}" xmlns="urn:xmpp:message-correct:0"/> | ||
<origin-id id="${msg.querySelector('origin-id').getAttribute("id")}" xmlns="urn:xmpp:sid:0"/> | ||
</message>`); | ||
expect(view.model.messages.models.length).toBe(1); | ||
const corrected_message = view.model.messages.at(0); | ||
expect(corrected_message.get('msgid')).toBe(first_msg.get('msgid')); | ||
|
Oops, something went wrong.