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
88e74975
Commit
88e74975
authored
Nov 14, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix failing tests due to avatar changes
parent
35057505
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
51 deletions
+49
-51
spec/chatroom.js
spec/chatroom.js
+45
-46
spec/messages.js
spec/messages.js
+4
-5
No files found.
spec/chatroom.js
View file @
88e74975
...
...
@@ -2642,56 +2642,55 @@
it
(
"
takes /topic to set the groupchat topic
"
,
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
async
function
(
done
,
_converse
)
{
test_utils
.
openAndEnterChatRoom
(
_converse
,
'
lounge
'
,
'
localhost
'
,
'
dummy
'
).
then
(
function
()
{
var
sent_stanza
;
var
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
spyOn
(
view
,
'
onMessageSubmitted
'
).
and
.
callThrough
(
);
spyOn
(
view
,
'
clearMessages
'
)
;
spyOn
(
_converse
.
connection
,
'
send
'
).
and
.
callFake
(
function
(
stanza
)
{
sent_stanza
=
stanza
;
});
// Check the alias /topic
var
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
textarea
.
value
=
'
/topic This is the groupchat subject
'
;
view
.
keyPressed
({
target
:
textarea
,
preventDefault
:
_
.
noop
,
keyCode
:
13
});
expect
(
view
.
onMessageSubmitted
).
toHaveBeenCalled
();
expect
(
_converse
.
connection
.
send
).
toHaveBeenCalled
();
expect
(
sent_stanza
.
textContent
).
toBe
(
'
This is the groupchat subject
'
);
await
test_utils
.
openAndEnterChatRoom
(
_converse
,
'
lounge
'
,
'
localhost
'
,
'
dummy
'
);
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
)
;
spyOn
(
view
,
'
onMessageSubmitted
'
).
and
.
callThrough
(
);
spyOn
(
view
,
'
clearMessages
'
);
let
sent_stanza
;
spyOn
(
_converse
.
connection
,
'
send
'
).
and
.
callFake
(
function
(
stanza
)
{
sent_stanza
=
stanza
;
});
// Check the alias /topic
const
textarea
=
view
.
el
.
querySelector
(
'
.chat-textarea
'
);
textarea
.
value
=
'
/topic This is the groupchat subject
'
;
view
.
keyPressed
({
target
:
textarea
,
preventDefault
:
_
.
noop
,
keyCode
:
13
});
expect
(
view
.
onMessageSubmitted
).
toHaveBeenCalled
();
expect
(
_converse
.
connection
.
send
).
toHaveBeenCalled
();
expect
(
sent_stanza
.
textContent
).
toBe
(
'
This is the groupchat subject
'
);
// Check /subject
textarea
.
value
=
'
/subject This is a new subject
'
;
view
.
keyPressed
({
target
:
textarea
,
preventDefault
:
_
.
noop
,
keyCode
:
13
});
// Check /subject
textarea
.
value
=
'
/subject This is a new subject
'
;
view
.
keyPressed
({
target
:
textarea
,
preventDefault
:
_
.
noop
,
keyCode
:
13
});
expect
(
sent_stanza
.
textContent
).
toBe
(
'
This is a new subject
'
);
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>
'
+
'
</message>
'
);
expect
(
sent_stanza
.
textContent
).
toBe
(
'
This is a new subject
'
);
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>
'
+
'
</message>
'
);
// Check case insensitivity
textarea
.
value
=
'
/Subject This is yet another subject
'
;
view
.
keyPressed
({
target
:
textarea
,
preventDefault
:
_
.
noop
,
keyCode
:
13
});
expect
(
sent_stanza
.
textContent
).
toBe
(
'
This is yet another subject
'
);
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>
'
+
'
</message>
'
);
done
();
}).
catch
(
_
.
partial
(
console
.
error
,
_
));
// Check case insensitivity
textarea
.
value
=
'
/Subject This is yet another subject
'
;
view
.
keyPressed
({
target
:
textarea
,
preventDefault
:
_
.
noop
,
keyCode
:
13
});
expect
(
sent_stanza
.
textContent
).
toBe
(
'
This is yet another subject
'
);
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>
'
+
'
</message>
'
);
done
();
}));
it
(
"
takes /clear to clear messages
"
,
...
...
spec/messages.js
View file @
88e74975
...
...
@@ -505,9 +505,10 @@
it
(
"
can be a carbon message, as defined in XEP-0280
"
,
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
async
function
(
done
,
_converse
)
{
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
async
function
(
done
,
_converse
)
{
test_utils
.
createContacts
(
_converse
,
'
current
'
);
test_utils
.
openControlBox
();
...
...
@@ -549,7 +550,6 @@
expect
(
chat_content
.
querySelector
(
'
.chat-msg .chat-msg__text
'
).
textContent
).
toEqual
(
msgtext
);
expect
(
chat_content
.
querySelector
(
'
.chat-msg__time
'
).
textContent
.
match
(
/^
[
0-9
][
0-9
]
:
[
0-9
][
0-9
]
/
)).
toBeTruthy
();
await
test_utils
.
waitUntil
(()
=>
chatbox
.
vcard
.
get
(
'
fullname
'
)
===
'
Candice van der Knijff
'
)
await
new
Promise
((
resolve
,
reject
)
=>
view
.
model
.
messages
.
once
(
'
rendered
'
,
resolve
));
expect
(
chat_content
.
querySelector
(
'
span.chat-msg__author
'
).
textContent
.
trim
()).
toBe
(
'
Candice van der Knijff
'
);
done
();
}));
...
...
@@ -2154,7 +2154,6 @@
target
:
textarea
,
keyCode
:
38
// Up arrow
});
await
new
Promise
((
resolve
,
reject
)
=>
view
.
model
.
messages
.
once
(
'
rendered
'
,
resolve
));
expect
(
textarea
.
value
).
toBe
(
'
But soft, what light through yonder window breaks?
'
);
expect
(
view
.
model
.
messages
.
at
(
0
).
get
(
'
correcting
'
)).
toBe
(
true
);
expect
(
view
.
el
.
querySelectorAll
(
'
.chat-msg
'
).
length
).
toBe
(
2
);
...
...
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