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
0f0599d5
Commit
0f0599d5
authored
Apr 13, 2013
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extended the test
parent
8525ee50
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
spec/MainSpec.js
spec/MainSpec.js
+21
-9
No files found.
spec/MainSpec.js
View file @
0f0599d5
...
...
@@ -28,6 +28,7 @@
'
listRooms
'
:
function
()
{}
}
};
this
.
bare_jid
=
'
dummy@localhost
'
;
this
.
prebind
=
true
;
this
.
connection
=
mock_connection
;
this
.
chatboxes
=
new
this
.
ChatBoxes
();
...
...
@@ -38,6 +39,8 @@
window
.
localStorage
.
removeItem
(
key
);
this
.
roster
.
localStorage
=
new
Backbone
.
LocalStorage
(
key
);
window
.
localStorage
.
removeItem
(
hex_sha1
(
'
converse.chatboxes-
'
+
this
.
bare_jid
));
this
.
chatboxes
.
onConnected
();
this
.
rosterview
=
new
this
.
RosterView
({
'
model
'
:
this
.
roster
});
this
.
rosterview
.
render
();
...
...
@@ -259,15 +262,24 @@
describe
(
"
Chatboxes
"
,
$
.
proxy
(
function
()
{
it
(
"
are created when you click on a roster item
"
,
$
.
proxy
(
function
()
{
var
$el
=
$
(
this
.
rosterview
.
$el
.
find
(
'
dt#xmpp-contacts
'
).
siblings
(
'
dd.current-xmpp-contact.online
'
).
find
(
'
a.open-chat
'
)[
0
]);
var
click
=
jQuery
.
Event
(
"
click
"
,
{
target
:
$el
});
var
jid
=
$el
.
text
().
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
view
=
this
.
rosterview
.
rosteritemviews
[
jid
];
spyOn
(
view
,
'
openChat
'
);
var
i
,
$el
,
click
,
jid
,
view
;
// showControlBox was called earlier, so the controlbox is
// visible, but no other chat boxes have been created.
expect
(
this
.
chatboxes
.
length
).
toEqual
(
1
);
var
online_contacts
=
this
.
rosterview
.
$el
.
find
(
'
dt#xmpp-contacts
'
).
siblings
(
'
dd.current-xmpp-contact.online
'
).
find
(
'
a.open-chat
'
);
for
(
i
=
0
;
i
<
online_contacts
.
length
;
i
++
)
{
$el
=
$
(
online_contacts
[
i
]);
click
=
jQuery
.
Event
(
"
click
"
,
{
target
:
$el
});
jid
=
$el
.
text
().
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
view
=
this
.
rosterview
.
rosteritemviews
[
jid
];
spyOn
(
view
,
'
openChat
'
).
andCallThrough
();
// We need to rebind all events otherwise our spy won't work.
view
.
delegateEvents
();
var
ev
=
$el
.
click
();
expect
(
view
.
openChat
).
toHaveBeenCalled
();
expect
(
this
.
chatboxes
.
length
).
toEqual
(
i
+
2
);
}
},
xmppchat
));
},
xmppchat
));
...
...
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