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
c6a32b84
Commit
c6a32b84
authored
Jun 02, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix chatroom tests
parent
ef9fd961
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
22 deletions
+26
-22
converse.js
converse.js
+3
-1
spec/chatbox.js
spec/chatbox.js
+5
-4
spec/chatroom.js
spec/chatroom.js
+18
-17
No files found.
converse.js
View file @
c6a32b84
...
...
@@ -1314,6 +1314,7 @@
}
else
{
this
.
model
.
trigger
(
'
hide
'
);
}
converse
.
emit
(
'
onChatBoxClosed
'
,
this
);
return
this
;
},
...
...
@@ -1323,6 +1324,7 @@
this
.
$el
.
insertAfter
(
converse
.
chatboxviews
.
get
(
"
controlbox
"
).
$el
).
show
();
this
.
focus
();
converse
.
refreshWebkit
();
converse
.
emit
(
'
onChatBoxMaximized
'
,
this
);
this
.
model
.
trigger
(
'
maximized
'
,
this
.
model
);
},
...
...
@@ -1334,7 +1336,7 @@
'
time_minimized
'
:
moment
().
format
()
});
this
.
$el
.
hide
(
'
fast
'
,
converse
.
refreshwebkit
);
converse
.
emit
(
'
onChatBox
Toggl
ed
'
,
this
);
converse
.
emit
(
'
onChatBox
Minimiz
ed
'
,
this
);
},
updateVCard
:
function
()
{
...
...
spec/chatbox.js
View file @
c6a32b84
...
...
@@ -181,12 +181,12 @@
});
},
converse
));
it
(
"
can be
toggl
ed by clicking a DOM element with class 'toggle-chatbox-button'
"
,
function
()
{
it
(
"
can be
minimiz
ed by clicking a DOM element with class 'toggle-chatbox-button'
"
,
function
()
{
var
chatbox
=
utils
.
openChatBoxes
(
1
)[
0
],
chatview
=
this
.
chatboxviews
.
get
(
chatbox
.
get
(
'
jid
'
)),
trimmed_chatboxes
=
this
.
chatboxviews
.
trimmed_chatboxes_view
;
spyOn
(
chatview
,
'
maximize
'
).
andCallThrough
();
spyOn
(
chatview
,
'
toggl
e
'
).
andCallThrough
();
spyOn
(
chatview
,
'
minimiz
e
'
).
andCallThrough
();
spyOn
(
converse
,
'
emit
'
);
spyOn
(
trimmed_chatboxes
,
'
onChanged
'
).
andCallThrough
();
// We need to rebind all events otherwise our spy won't be called
...
...
@@ -197,8 +197,8 @@
});
waits
(
50
);
runs
(
function
()
{
expect
(
chatview
.
toggl
e
).
toHaveBeenCalled
();
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
onChatBox
Toggl
ed
'
,
jasmine
.
any
(
Object
));
expect
(
chatview
.
minimiz
e
).
toHaveBeenCalled
();
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
onChatBox
Minimiz
ed
'
,
jasmine
.
any
(
Object
));
expect
(
converse
.
emit
.
callCount
,
2
);
expect
(
chatview
.
$el
.
is
(
'
:visible
'
)).
toBeFalsy
();
expect
(
chatview
.
model
.
get
(
'
minimized
'
)).
toBeTruthy
();
...
...
@@ -211,6 +211,7 @@
runs
(
function
()
{
expect
(
trimmed_chatboxes
.
onChanged
).
toHaveBeenCalled
();
expect
(
chatview
.
maximize
).
toHaveBeenCalled
();
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
onChatBoxMaximized
'
,
jasmine
.
any
(
Object
));
expect
(
chatview
.
$el
.
find
(
'
.chat-body
'
).
is
(
'
:visible
'
)).
toBeTruthy
();
expect
(
chatview
.
$el
.
find
(
'
.toggle-chatbox-button
'
).
hasClass
(
'
icon-minus
'
)).
toBeTruthy
();
expect
(
chatview
.
$el
.
find
(
'
.toggle-chatbox-button
'
).
hasClass
(
'
icon-plus
'
)).
toBeFalsy
();
...
...
spec/chatroom.js
View file @
c6a32b84
...
...
@@ -139,33 +139,34 @@
this
.
rosterview
.
render
();
},
converse
));
it
(
"
can be
toggl
ed by clicking a DOM element with class 'toggle-chatbox-button'
"
,
function
()
{
it
(
"
can be
minimiz
ed by clicking a DOM element with class 'toggle-chatbox-button'
"
,
function
()
{
var
view
=
this
.
chatboxviews
.
get
(
'
lounge@muc.localhost
'
),
chatroom
=
view
.
model
,
$el
;
spyOn
(
view
,
'
toggle
'
).
andCallThrough
();
trimmed_chatboxes
=
this
.
chatboxviews
.
trimmed_chatboxes_view
;
spyOn
(
view
,
'
minimize
'
).
andCallThrough
();
spyOn
(
view
,
'
maximize
'
).
andCallThrough
();
spyOn
(
converse
,
'
emit
'
);
view
.
delegateEvents
();
// We need to rebind all events otherwise our spy won't be called
runs
(
function
()
{
view
.
$el
.
find
(
'
.toggle-chatbox-button
'
).
click
();
});
waits
(
2
50
);
waits
(
50
);
runs
(
function
()
{
expect
(
view
.
toggl
e
).
toHaveBeenCalled
();
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
onChatBox
Toggl
ed
'
,
jasmine
.
any
(
Object
));
expect
(
view
.
minimiz
e
).
toHaveBeenCalled
();
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
onChatBox
Minimiz
ed
'
,
jasmine
.
any
(
Object
));
expect
(
converse
.
emit
.
callCount
,
2
);
expect
(
view
.
$el
.
find
(
'
.chat-body
'
).
is
(
'
:visible
'
)).
toBeFalsy
();
expect
(
view
.
$el
.
find
(
'
.toggle-chatbox-button
'
).
hasClass
(
'
icon-minus
'
)).
toBeFalsy
();
expect
(
view
.
$el
.
find
(
'
.toggle-chatbox-button
'
).
hasClass
(
'
icon-plus
'
)).
toBeTruthy
();
expect
(
view
.
$el
.
is
(
'
:visible
'
)).
toBeFalsy
();
expect
(
view
.
model
.
get
(
'
minimized
'
)).
toBeTruthy
();
view
.
$el
.
find
(
'
.toggle-chatbox-button
'
).
click
();
expect
(
view
.
minimize
).
toHaveBeenCalled
();
trimmedview
=
trimmed_chatboxes
.
get
(
view
.
model
.
get
(
'
id
'
));
trimmedview
.
$
(
"
a.restore-chat
"
).
click
();
});
waits
(
2
50
);
waits
(
50
);
runs
(
function
()
{
expect
(
view
.
toggle
).
toHaveBeenCalled
();
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
onChatBoxToggled
'
,
jasmine
.
any
(
Object
));
expect
(
view
.
$el
.
find
(
'
.chat-body
'
).
is
(
'
:visible
'
)).
toBeTruthy
();
expect
(
view
.
$el
.
find
(
'
.toggle-chatbox-button
'
).
hasClass
(
'
icon-minus
'
)).
toBeTruthy
();
expect
(
view
.
$el
.
find
(
'
.toggle-chatbox-button
'
).
hasClass
(
'
icon-plus
'
)).
toBeFalsy
();
expect
(
view
.
maximize
).
toHaveBeenCalled
();
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
onChatBoxMaximized
'
,
jasmine
.
any
(
Object
));
expect
(
view
.
$el
.
is
(
'
:visible
'
)).
toBeTruthy
();
expect
(
view
.
model
.
get
(
'
minimized
'
)).
toBeFalsy
();
expect
(
converse
.
emit
.
callCount
,
3
);
});
...
...
@@ -181,7 +182,7 @@
runs
(
function
()
{
view
.
$el
.
find
(
'
.close-chatbox-button
'
).
click
();
});
waits
(
2
50
);
waits
(
50
);
runs
(
function
()
{
expect
(
view
.
close
).
toHaveBeenCalled
();
expect
(
this
.
connection
.
muc
.
leave
).
toHaveBeenCalled
();
...
...
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