Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
a36ba226
Commit
a36ba226
authored
Jun 28, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test message stanza with spoiler
parent
2cb1af3d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
spec/spoilers.js
spec/spoilers.js
+14
-14
No files found.
spec/spoilers.js
View file @
a36ba226
...
@@ -208,21 +208,22 @@ describe("A spoiler message", function () {
...
@@ -208,21 +208,22 @@ describe("A spoiler message", function () {
});
});
await
new
Promise
(
resolve
=>
view
.
model
.
messages
.
once
(
'
rendered
'
,
resolve
));
await
new
Promise
(
resolve
=>
view
.
model
.
messages
.
once
(
'
rendered
'
,
resolve
));
/* Test the XML stanza
*
* <message from="romeo@montague.lit/orchard"
* to="max.frankfurter@montague.lit"
* type="chat"
* id="4547c38b-d98b-45a5-8f44-b4004dbc335e"
* xmlns="jabber:client">
* <body>This is the spoiler</body>
* <active xmlns="http://jabber.org/protocol/chatstates"/>
* <spoiler xmlns="urn:xmpp:spoiler:0">This is the hint</spoiler>
* </message>"
*/
const
stanza
=
_converse
.
connection
.
send
.
calls
.
argsFor
(
0
)[
0
].
tree
();
const
stanza
=
_converse
.
connection
.
send
.
calls
.
argsFor
(
0
)[
0
].
tree
();
const
spoiler_el
=
stanza
.
querySelector
(
'
spoiler[xmlns="urn:xmpp:spoiler:0"]
'
);
expect
(
Strophe
.
serialize
(
stanza
)).
toBe
(
`<message from="romeo@montague.lit/orchard" `
+
`id="
${
stanza
.
getAttribute
(
'
id
'
)}
" `
+
`to="mercutio@montague.lit" `
+
`type="chat" `
+
`xmlns="jabber:client">`
+
`<body>This is the spoiler</body>`
+
`<active xmlns="http://jabber.org/protocol/chatstates"/>`
+
`<request xmlns="urn:xmpp:receipts"/>`
+
`<spoiler xmlns="urn:xmpp:spoiler:0">This is the hint</spoiler>`
+
`<origin-id id="
${
stanza
.
querySelector
(
'
origin-id
'
).
getAttribute
(
'
id
'
)}
" xmlns="urn:xmpp:sid:0"/>`
+
`</message>`
);
const
spoiler_el
=
stanza
.
querySelector
(
'
spoiler[xmlns="urn:xmpp:spoiler:0"]
'
);
expect
(
spoiler_el
===
null
).
toBeFalsy
();
expect
(
spoiler_el
===
null
).
toBeFalsy
();
expect
(
spoiler_el
.
textContent
).
toBe
(
'
This is the hint
'
);
expect
(
spoiler_el
.
textContent
).
toBe
(
'
This is the hint
'
);
...
@@ -230,7 +231,6 @@ describe("A spoiler message", function () {
...
@@ -230,7 +231,6 @@ describe("A spoiler message", function () {
const
body_el
=
stanza
.
querySelector
(
'
body
'
);
const
body_el
=
stanza
.
querySelector
(
'
body
'
);
expect
(
body_el
.
textContent
).
toBe
(
spoiler
);
expect
(
body_el
.
textContent
).
toBe
(
spoiler
);
/* Test the HTML spoiler message */
expect
(
view
.
el
.
querySelector
(
'
.chat-msg__author
'
).
textContent
.
trim
()).
toBe
(
'
Romeo Montague
'
);
expect
(
view
.
el
.
querySelector
(
'
.chat-msg__author
'
).
textContent
.
trim
()).
toBe
(
'
Romeo Montague
'
);
const
message_content
=
view
.
el
.
querySelector
(
'
.chat-msg__text
'
);
const
message_content
=
view
.
el
.
querySelector
(
'
.chat-msg__text
'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment