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
ce849aaf
Commit
ce849aaf
authored
Mar 27, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix failing tests
parent
08ab2e54
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
22 deletions
+33
-22
spec/protocol.js
spec/protocol.js
+2
-2
spec/roster.js
spec/roster.js
+28
-14
src/converse-core.js
src/converse-core.js
+2
-2
src/converse-rosterview.js
src/converse-rosterview.js
+1
-4
No files found.
spec/protocol.js
View file @
ce849aaf
...
...
@@ -69,7 +69,7 @@
var
cbview
=
_converse
.
chatboxviews
.
get
(
'
controlbox
'
);
spyOn
(
_converse
.
roster
,
"
addAndSubscribe
"
).
and
.
callThrough
();
spyOn
(
_converse
.
roster
,
"
addContact
"
).
and
.
callThrough
();
spyOn
(
_converse
.
roster
,
"
addContact
ToRoster
"
).
and
.
callThrough
();
spyOn
(
_converse
.
roster
,
"
sendContactAddIQ
"
).
and
.
callThrough
();
spyOn
(
_converse
.
api
.
vcard
,
"
get
"
).
and
.
callThrough
();
...
...
@@ -100,7 +100,7 @@
*/
expect
(
modal
.
addContactFromForm
).
toHaveBeenCalled
();
expect
(
_converse
.
roster
.
addAndSubscribe
).
toHaveBeenCalled
();
expect
(
_converse
.
roster
.
addContact
).
toHaveBeenCalled
();
expect
(
_converse
.
roster
.
addContact
ToRoster
).
toHaveBeenCalled
();
/* _converse request consists of sending an IQ
* stanza of type='set' containing a <query/> element qualified by
...
...
spec/roster.js
View file @
ce849aaf
...
...
@@ -584,26 +584,33 @@
var
name
=
mock
.
pend_names
[
0
];
var
jid
=
name
.
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
contact
=
_converse
.
roster
.
get
(
jid
);
var
sent_IQ
;
spyOn
(
window
,
'
confirm
'
).
and
.
returnValue
(
true
);
spyOn
(
contact
,
'
unauthorize
'
).
and
.
callFake
(
function
()
{
return
contact
;
});
spyOn
(
contact
,
'
removeFromRoster
'
);
spyOn
(
_converse
.
connection
,
'
sendIQ
'
).
and
.
callFake
(
function
(
iq
,
callback
)
{
if
(
typeof
callback
===
"
function
"
)
{
return
callback
();
}
});
spyOn
(
contact
,
'
removeFromRoster
'
).
and
.
callThrough
();
test_utils
.
waitUntil
(
function
()
{
return
$
(
_converse
.
rosterview
.
el
).
find
(
"
.pending-contact-name:contains('
"
+
name
+
"
')
"
).
length
;
return
$
(
_converse
.
rosterview
.
el
).
find
(
"
.pending-contact-name:contains('
"
+
name
+
"
')
"
).
length
;
},
700
).
then
(
function
()
{
var
sendIQ
=
_converse
.
connection
.
sendIQ
;
spyOn
(
_converse
.
connection
,
'
sendIQ
'
).
and
.
callFake
(
function
(
iq
,
callback
,
errback
)
{
sent_IQ
=
iq
;
callback
();
});
$
(
_converse
.
rosterview
.
el
).
find
(
"
.pending-contact-name:contains('
"
+
name
+
"
')
"
)
.
parent
().
siblings
(
'
.remove-xmpp-contact
'
)[
0
].
click
();
return
test_utils
.
waitUntil
(
function
()
{
return
$
(
_converse
.
rosterview
.
el
).
find
(
"
.pending-contact-name:contains('
"
+
name
+
"
')
"
).
length
===
0
},
7
00
)
},
10
00
)
}).
then
(
function
()
{
expect
(
window
.
confirm
).
toHaveBeenCalled
();
expect
(
_converse
.
connection
.
sendIQ
).
toHaveBeenCalled
();
expect
(
contact
.
removeFromRoster
).
toHaveBeenCalled
();
expect
(
_converse
.
connection
.
sendIQ
).
toHaveBeenCalled
();
expect
(
sent_IQ
.
toLocaleString
()).
toBe
(
"
<iq type='set' xmlns='jabber:client'>
"
+
"
<query xmlns='jabber:iq:roster'>
"
+
"
<item jid='suleyman.van.beusichem@localhost' subscription='remove'/>
"
+
"
</query>
"
+
"
</iq>
"
);
done
();
});
}));
...
...
@@ -771,6 +778,7 @@
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
var
sent_IQ
;
_addContacts
(
_converse
);
test_utils
.
waitUntil
(
function
()
{
return
$
(
_converse
.
rosterview
.
el
).
find
(
'
li
'
).
length
;
...
...
@@ -779,15 +787,21 @@
var
jid
=
name
.
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
contact
=
_converse
.
roster
.
get
(
jid
);
spyOn
(
window
,
'
confirm
'
).
and
.
returnValue
(
true
);
spyOn
(
contact
,
'
removeFromRoster
'
);
spyOn
(
_converse
.
connection
,
'
sendIQ
'
).
and
.
callFake
(
function
(
iq
,
callback
)
{
if
(
typeof
callback
===
"
function
"
)
{
return
callback
();
}
spyOn
(
contact
,
'
removeFromRoster
'
).
and
.
callThrough
();
var
sendIQ
=
_converse
.
connection
.
sendIQ
;
spyOn
(
_converse
.
connection
,
'
sendIQ
'
).
and
.
callFake
(
function
(
iq
,
callback
,
errback
)
{
sent_IQ
=
iq
;
callback
();
});
$
(
_converse
.
rosterview
.
el
).
find
(
"
.open-chat:contains('
"
+
name
+
"
')
"
)
.
parent
().
find
(
'
.remove-xmpp-contact
'
)[
0
].
click
();
expect
(
window
.
confirm
).
toHaveBeenCalled
();
expect
(
_converse
.
connection
.
sendIQ
).
toHaveBeenCalled
();
expect
(
sent_IQ
.
toLocaleString
()).
toBe
(
"
<iq type='set' xmlns='jabber:client'>
"
+
"
<query xmlns='jabber:iq:roster'><item jid='max.frankfurter@localhost' subscription='remove'/></query>
"
+
"
</iq>
"
);
expect
(
contact
.
removeFromRoster
).
toHaveBeenCalled
();
expect
(
$
(
_converse
.
rosterview
.
el
).
find
(
"
.open-chat:contains('
"
+
name
+
"
')
"
).
length
).
toEqual
(
0
);
done
();
...
...
@@ -812,7 +826,7 @@
return
$
(
_converse
.
rosterview
.
el
).
find
(
'
.roster-group:visible li
'
).
length
;
},
700
).
then
(
function
()
{
spyOn
(
window
,
'
confirm
'
).
and
.
returnValue
(
true
);
spyOn
(
contact
,
'
removeFromRoster
'
);
spyOn
(
contact
,
'
removeFromRoster
'
)
.
and
.
callThrough
()
;
spyOn
(
_converse
.
connection
,
'
sendIQ
'
).
and
.
callFake
(
function
(
iq
,
callback
)
{
if
(
typeof
callback
===
"
function
"
)
{
return
callback
();
}
});
...
...
src/converse-core.js
View file @
ce849aaf
...
...
@@ -1034,7 +1034,7 @@
}
},
removeFromRoster
(
callback
)
{
removeFromRoster
(
callback
,
errback
)
{
/* Instruct the XMPP server to remove this contact from our roster
* Parameters:
* (Function) callback
...
...
@@ -1042,7 +1042,7 @@
const
iq
=
$iq
({
type
:
'
set
'
})
.
c
(
'
query
'
,
{
xmlns
:
Strophe
.
NS
.
ROSTER
})
.
c
(
'
item
'
,
{
jid
:
this
.
get
(
'
jid
'
),
subscription
:
"
remove
"
});
_converse
.
connection
.
sendIQ
(
iq
,
callback
,
call
back
);
_converse
.
connection
.
sendIQ
(
iq
,
callback
,
err
back
);
return
this
;
}
});
...
...
src/converse-rosterview.js
View file @
ce849aaf
...
...
@@ -495,10 +495,7 @@
if
(
!
_converse
.
allow_contact_removal
)
{
return
;
}
const
result
=
confirm
(
__
(
"
Are you sure you want to remove this contact?
"
));
if
(
result
===
true
)
{
const
iq
=
$iq
({
type
:
'
set
'
})
.
c
(
'
query
'
,
{
xmlns
:
Strophe
.
NS
.
ROSTER
})
.
c
(
'
item
'
,
{
jid
:
this
.
model
.
get
(
'
jid
'
),
subscription
:
"
remove
"
});
_converse
.
connection
.
sendIQ
(
iq
,
this
.
model
.
removeFromRoster
(
(
iq
)
=>
{
this
.
model
.
destroy
();
this
.
remove
();
...
...
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