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
850c6aa2
Commit
850c6aa2
authored
Mar 16, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix more failing tests
parent
56e28070
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
40 deletions
+45
-40
spec/chatbox.js
spec/chatbox.js
+2
-3
spec/presence.js
spec/presence.js
+28
-14
spec/protocol.js
spec/protocol.js
+14
-21
src/converse-rosterview.js
src/converse-rosterview.js
+0
-1
src/templates/chat_status_modal.html
src/templates/chat_status_modal.html
+1
-1
No files found.
spec/chatbox.js
View file @
850c6aa2
...
...
@@ -366,8 +366,7 @@
test_utils
.
openControlBox
();
test_utils
.
waitUntil
(
function
()
{
return
$
(
_converse
.
rosterview
.
el
).
find
(
'
.roster-group
'
).
length
;
},
300
)
.
then
(
function
()
{
},
300
).
then
(
function
()
{
spyOn
(
_converse
,
'
emit
'
);
spyOn
(
_converse
.
chatboxviews
,
'
trimChats
'
);
_converse
.
chatboxes
.
browserStorage
.
_clear
();
...
...
spec/presence.js
View file @
850c6aa2
...
...
@@ -13,6 +13,7 @@
var
Strophe
=
converse
.
env
.
Strophe
;
var
$iq
=
converse
.
env
.
$iq
;
var
$pres
=
converse
.
env
.
$pres
;
var
u
=
converse
.
env
.
utils
;
// See: https://xmpp.org/rfcs/rfc3921.html
describe
(
"
A sent presence stanza
"
,
function
()
{
...
...
@@ -56,21 +57,34 @@
spyOn
(
view
.
model
,
'
sendPresence
'
).
and
.
callThrough
();
spyOn
(
_converse
.
connection
,
'
send
'
).
and
.
callThrough
();
view
.
el
.
querySelector
(
'
a.change-xmpp-status-message
'
).
click
();
var
cbview
=
_converse
.
chatboxviews
.
get
(
'
controlbox
'
);
cbview
.
el
.
querySelector
(
'
.change-status
'
).
click
()
var
modal
=
_converse
.
xmppstatusview
.
status_modal
;
test_utils
.
waitUntil
(
function
()
{
return
u
.
isVisible
(
modal
.
el
);
},
1000
).
then
(
function
()
{
var
msg
=
'
My custom status
'
;
view
.
el
.
querySelector
(
'
input.custom-xmpp-status
'
).
value
=
msg
;
view
.
el
.
querySelector
(
'
[type="submit"]
'
).
click
();
modal
.
el
.
querySelector
(
'
input[name="status_message"]
'
).
value
=
msg
;
modal
.
el
.
querySelector
(
'
[type="submit"]
'
).
click
();
expect
(
view
.
model
.
sendPresence
).
toHaveBeenCalled
();
expect
(
_converse
.
connection
.
send
.
calls
.
mostRecent
().
args
[
0
].
toLocaleString
())
.
toBe
(
"
<presence xmlns='jabber:client'><status>My custom status</status><priority>0</priority></presence>
"
)
view
.
el
.
querySelector
(
'
a.choose-xmpp-status
'
).
click
();
view
.
el
.
querySelectorAll
(
'
.dropdown dd ul li a
'
)[
1
].
click
();
// Change status to "dnd"
return
test_utils
.
waitUntil
(
function
()
{
return
modal
.
el
.
getAttribute
(
'
aria-hidden
'
)
===
"
true
"
;
});
}).
then
(
function
()
{
cbview
.
el
.
querySelector
(
'
.change-status
'
).
click
()
return
test_utils
.
waitUntil
(
function
()
{
return
modal
.
el
.
getAttribute
(
'
aria-hidden
'
)
===
"
false
"
;
},
1000
);
}).
then
(
function
()
{
modal
.
el
.
querySelector
(
'
label[for="radio-busy"]
'
).
click
();
// Change status to "dnd"
modal
.
el
.
querySelector
(
'
[type="submit"]
'
).
click
();
expect
(
_converse
.
connection
.
send
.
calls
.
mostRecent
().
args
[
0
].
toLocaleString
())
.
toBe
(
"
<presence xmlns='jabber:client'><show>dnd</show><status>My custom status</status><priority>0</priority></presence>
"
)
done
();
});
}));
});
...
...
spec/protocol.js
View file @
850c6aa2
...
...
@@ -11,6 +11,7 @@
var
$iq
=
converse
.
env
.
$iq
;
var
$pres
=
converse
.
env
.
$pres
;
var
_
=
converse
.
env
.
_
;
var
u
=
converse
.
env
.
utils
;
// See:
// https://xmpp.org/rfcs/rfc3921.html
...
...
@@ -54,7 +55,7 @@
{
roster_groups
:
false
},
function
(
done
,
_converse
)
{
var
contact
,
sent_stanza
,
IQ_id
,
stanza
;
var
contact
,
sent_stanza
,
IQ_id
,
stanza
,
modal
;
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
'
localhost
'
,
[],
[
'
vcard-temp
'
])
.
then
(
function
()
{
return
test_utils
.
waitUntil
(
function
()
{
...
...
@@ -65,8 +66,8 @@
* the interaction between roster items and subscription states.
*/
test_utils
.
openControlBox
(
_converse
);
var
panel
=
_converse
.
chatboxviews
.
get
(
'
controlbox
'
).
contactspanel
;
spyOn
(
panel
,
"
addContactFromForm
"
).
and
.
callThrough
();
var
cbview
=
_converse
.
chatboxviews
.
get
(
'
controlbox
'
)
;
spyOn
(
_converse
.
roster
,
"
addAndSubscribe
"
).
and
.
callThrough
();
spyOn
(
_converse
.
roster
,
"
addContact
"
).
and
.
callThrough
();
spyOn
(
_converse
.
roster
,
"
sendContactAddIQ
"
).
and
.
callThrough
();
...
...
@@ -77,21 +78,18 @@
sent_stanza
=
iq
;
IQ_id
=
sendIQ
.
bind
(
this
)(
iq
,
callback
,
errback
);
});
panel
.
delegateEvents
();
// Rebind all events so that our spy gets called
/* Add a new contact through the UI */
var
form
=
panel
.
el
.
querySelector
(
'
form.add-xmpp-contact
'
);
expect
(
_
.
isNull
(
form
)).
toBeTruthy
();
// Click the "Add a contact" link.
panel
.
el
.
querySelector
(
'
.toggle-xmpp-contact-form
'
).
click
();
// Check that the form appears
form
=
panel
.
el
.
querySelector
(
'
form.add-xmpp-contact
'
);
expect
(
form
.
parentElement
.
offsetHeight
).
not
.
toBe
(
0
);
expect
(
_
.
includes
(
form
.
parentElement
.
classList
,
'
collapsed
'
)).
toBeFalsy
();
cbview
.
el
.
querySelector
(
'
.add-contact
'
).
click
()
modal
=
_converse
.
rosterview
.
add_contact_modal
;
return
test_utils
.
waitUntil
(
function
()
{
return
u
.
isVisible
(
modal
.
el
);
},
1000
);
}).
then
(
function
()
{
spyOn
(
modal
,
"
addContactFromForm
"
).
and
.
callThrough
();
modal
.
delegateEvents
();
// Fill in the form and submit
var
form
=
modal
.
el
.
querySelector
(
'
form.add-xmpp-contact
'
);
form
.
querySelector
(
'
input
'
).
value
=
'
contact@example.org
'
;
form
.
querySelector
(
'
[type="submit"]
'
).
click
();
...
...
@@ -100,15 +98,10 @@
* subscription, the user's client SHOULD perform a "roster set"
* for the new roster item.
*/
expect
(
pane
l
.
addContactFromForm
).
toHaveBeenCalled
();
expect
(
moda
l
.
addContactFromForm
).
toHaveBeenCalled
();
expect
(
_converse
.
roster
.
addAndSubscribe
).
toHaveBeenCalled
();
expect
(
_converse
.
roster
.
addContact
).
toHaveBeenCalled
();
// The form should not be visible anymore (by virtue of its
// parent being collapsed)
expect
(
form
.
parentElement
.
offsetHeight
).
toBe
(
0
);
expect
(
_
.
includes
(
form
.
parentElement
.
classList
,
'
collapsed
'
)).
toBeTrue
;
/* _converse request consists of sending an IQ
* stanza of type='set' containing a <query/> element qualified by
* the 'jabber:iq:roster' namespace, which in turn contains an
...
...
src/converse-rosterview.js
View file @
850c6aa2
...
...
@@ -128,7 +128,6 @@
_converse
.
AddContactModal
=
_converse
.
BootstrapModal
.
extend
({
events
:
{
'
click a.subscribe-to-user
'
:
'
addContactFromList
'
,
'
submit form
'
:
'
addContactFromForm
'
,
'
submit form.search-xmpp-contact
'
:
'
searchContacts
'
},
...
...
src/templates/chat_status_modal.html
View file @
850c6aa2
...
...
@@ -19,7 +19,7 @@
</div>
<div
class=
"custom-control custom-radio"
>
<input
{[
if
(o.status =
==
'
busy
')
{
]}
checked=
"checked"
{[
}
]}
type=
"radio"
id=
"radio-busy"
value=
"
busy
"
name=
"chat_status"
class=
"custom-control-input"
>
type=
"radio"
id=
"radio-busy"
value=
"
dnd
"
name=
"chat_status"
class=
"custom-control-input"
>
<label
class=
"custom-control-label"
for=
"radio-busy"
>
<span
class=
"fa fa-minus-circle"
></span>
{{{o.label_busy}}}
</label>
</div>
...
...
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