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
0be33b81
Commit
0be33b81
authored
Jul 19, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests
parent
a338ede0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
spec/controlbox.js
spec/controlbox.js
+12
-3
No files found.
spec/controlbox.js
View file @
0be33b81
...
@@ -410,7 +410,8 @@
...
@@ -410,7 +410,8 @@
it
(
"
can be added to the roster and they will be sorted alphabetically
"
,
$
.
proxy
(
function
()
{
it
(
"
can be added to the roster and they will be sorted alphabetically
"
,
$
.
proxy
(
function
()
{
converse
.
rosterview
.
model
.
reset
();
// We want to manually create users so that we can spy
converse
.
rosterview
.
model
.
reset
();
// We want to manually create users so that we can spy
var
i
,
t
;
var
i
,
children
;
var
names
=
[];
spyOn
(
converse
,
'
emit
'
);
spyOn
(
converse
,
'
emit
'
);
spyOn
(
this
.
rosterview
,
'
render
'
).
andCallThrough
();
spyOn
(
this
.
rosterview
,
'
render
'
).
andCallThrough
();
spyOn
(
this
.
controlboxtoggle
,
'
showControlBox
'
).
andCallThrough
();
spyOn
(
this
.
controlboxtoggle
,
'
showControlBox
'
).
andCallThrough
();
...
@@ -425,8 +426,14 @@
...
@@ -425,8 +426,14 @@
});
});
expect
(
this
.
rosterview
.
render
).
toHaveBeenCalled
();
expect
(
this
.
rosterview
.
render
).
toHaveBeenCalled
();
// Check that they are sorted alphabetically
// Check that they are sorted alphabetically
t
=
this
.
rosterview
.
$el
.
find
(
'
dt#xmpp-contact-requests
'
).
siblings
(
'
dd.requesting-xmpp-contact
'
).
children
(
'
div
'
).
text
().
replace
(
/AcceptDecline/g
,
''
);
children
=
this
.
rosterview
.
$el
.
find
(
'
dt#xmpp-contact-requests
'
).
siblings
(
'
dd.requesting-xmpp-contact
'
).
children
(
'
span
'
);
expect
(
t
).
toEqual
(
mock
.
req_names
.
slice
(
0
,
i
+
1
).
sort
().
join
(
''
));
names
=
[];
children
.
each
(
function
(
idx
,
item
)
{
if
(
!
$
(
item
).
hasClass
(
'
request-actions
'
))
{
names
.
push
(
$
(
item
).
text
().
replace
(
/^
\s
+|
\s
+$/g
,
''
));
}
});
expect
(
names
.
join
(
''
)).
toEqual
(
mock
.
req_names
.
slice
(
0
,
i
+
1
).
sort
().
join
(
''
));
// When a requesting contact is added, the controlbox must
// When a requesting contact is added, the controlbox must
// be opened.
// be opened.
expect
(
this
.
controlboxtoggle
.
showControlBox
).
toHaveBeenCalled
();
expect
(
this
.
controlboxtoggle
.
showControlBox
).
toHaveBeenCalled
();
...
@@ -459,11 +466,13 @@
...
@@ -459,11 +466,13 @@
spyOn
(
converse
,
'
emit
'
);
spyOn
(
converse
,
'
emit
'
);
spyOn
(
this
.
connection
.
roster
,
'
unauthorize
'
);
spyOn
(
this
.
connection
.
roster
,
'
unauthorize
'
);
spyOn
(
this
.
rosterview
,
'
removeRosterItemView
'
).
andCallThrough
();
spyOn
(
this
.
rosterview
,
'
removeRosterItemView
'
).
andCallThrough
();
spyOn
(
window
,
'
confirm
'
).
andReturn
(
true
);
spyOn
(
view
,
'
declineRequest
'
).
andCallThrough
();
spyOn
(
view
,
'
declineRequest
'
).
andCallThrough
();
view
.
delegateEvents
();
// We need to rebind all events otherwise our spy won't be called
view
.
delegateEvents
();
// We need to rebind all events otherwise our spy won't be called
var
accept_button
=
view
.
$el
.
find
(
'
.decline-xmpp-request
'
);
var
accept_button
=
view
.
$el
.
find
(
'
.decline-xmpp-request
'
);
accept_button
.
click
();
accept_button
.
click
();
expect
(
view
.
declineRequest
).
toHaveBeenCalled
();
expect
(
view
.
declineRequest
).
toHaveBeenCalled
();
expect
(
window
.
confirm
).
toHaveBeenCalled
();
expect
(
this
.
rosterview
.
removeRosterItemView
).
toHaveBeenCalled
();
expect
(
this
.
rosterview
.
removeRosterItemView
).
toHaveBeenCalled
();
expect
(
this
.
connection
.
roster
.
unauthorize
).
toHaveBeenCalled
();
expect
(
this
.
connection
.
roster
.
unauthorize
).
toHaveBeenCalled
();
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
rosterViewUpdated
'
);
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
rosterViewUpdated
'
);
...
...
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