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
ac0042fd
Commit
ac0042fd
authored
Mar 04, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend the "close chat" test with a normal chatbox usecase
parent
c030494e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
10 deletions
+24
-10
converse.js
converse.js
+1
-1
spec/chatbox.js
spec/chatbox.js
+20
-7
tests/utils.js
tests/utils.js
+3
-2
No files found.
converse.js
View file @
ac0042fd
...
...
@@ -2537,7 +2537,7 @@
openChat
:
function
(
ev
)
{
ev
.
preventDefault
();
converse
.
chatboxesview
.
showChatBox
({
return
converse
.
chatboxesview
.
showChatBox
({
'
id
'
:
this
.
model
.
get
(
'
jid
'
),
'
jid
'
:
this
.
model
.
get
(
'
jid
'
),
'
fullname
'
:
this
.
model
.
get
(
'
fullname
'
),
...
...
spec/chatbox.js
View file @
ac0042fd
...
...
@@ -77,21 +77,34 @@
}.
bind
(
converse
));
},
converse
));
it
(
"
can be closed again by clicking a DOM element with class 'close-chatbox-button'
"
,
$
.
proxy
(
function
()
{
it
(
"
can be closed by clicking a DOM element with class 'close-chatbox-button'
"
,
$
.
proxy
(
function
()
{
var
chatbox
=
utils
.
openChatBoxes
(
1
)[
0
],
controlview
=
this
.
chatboxesview
.
views
.
controlbox
,
// The controlbox is currently open
chatview
=
this
.
chatboxesview
.
views
[
chatbox
.
get
(
'
jid
'
)];
spyOn
(
chatview
,
'
closeChat
'
).
andCallThrough
();
spyOn
(
controlview
,
'
closeChat
'
).
andCallThrough
();
spyOn
(
converse
,
'
emit
'
);
var
view
=
this
.
chatboxesview
.
views
.
controlbox
;
// The controlbox is currently open
spyOn
(
view
,
'
closeChat
'
).
andCallThrough
();
view
.
delegateEvents
();
// We need to rebind all events otherwise our spy won't be called
// We need to rebind all events otherwise our spy won't be called
controlview
.
delegateEvents
();
chatview
.
delegateEvents
();
runs
(
function
()
{
view
.
$el
.
find
(
'
.close-chatbox-button
'
).
click
();
controlview
.
$el
.
find
(
'
.close-chatbox-button
'
).
click
();
});
waits
(
250
);
runs
(
function
()
{
expect
(
controlview
.
closeChat
).
toHaveBeenCalled
();
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
onChatBoxClosed
'
,
jasmine
.
any
(
Object
));
expect
(
converse
.
emit
.
callCount
,
1
);
chatview
.
$el
.
find
(
'
.close-chatbox-button
'
).
click
();
});
waits
(
250
);
runs
(
function
()
{
expect
(
view
.
closeChat
).
toHaveBeenCalled
();
expect
(
chat
view
.
closeChat
).
toHaveBeenCalled
();
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
onChatBoxClosed
'
,
jasmine
.
any
(
Object
));
expect
(
converse
.
emit
.
callCount
,
2
);
});
// TODO: Open a normal chatbox and close it again...
},
converse
));
it
(
"
will be removed from localStorage when closed
"
,
$
.
proxy
(
function
()
{
...
...
tests/utils.js
View file @
ac0042fd
...
...
@@ -78,11 +78,12 @@
};
utils
.
openChatBoxes
=
function
(
amount
)
{
var
i
=
0
,
jid
;
var
i
=
0
,
jid
,
views
=
[]
;
for
(
i
;
i
<
amount
;
i
++
)
{
jid
=
mock
.
cur_names
[
i
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
converse
.
rosterview
.
rosteritemviews
[
jid
].
openChat
(
mock
.
event
);
views
[
i
]
=
converse
.
rosterview
.
rosteritemviews
[
jid
].
openChat
(
mock
.
event
);
}
return
views
;
};
utils
.
openChatBoxFor
=
function
(
jid
)
{
...
...
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