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
9b445f84
Commit
9b445f84
authored
Apr 19, 2013
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small tweaks to tests to provide better visual feedback
parent
399d029b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
+23
-10
spec/MainSpec.js
spec/MainSpec.js
+23
-10
No files found.
spec/MainSpec.js
View file @
9b445f84
...
@@ -57,16 +57,24 @@
...
@@ -57,16 +57,24 @@
this
.
onConnected
(
mock_connection
);
this
.
onConnected
(
mock_connection
);
this
.
animate
=
false
;
// don't use animations
this
.
animate
=
false
;
// don't use animations
// Variable declarations for specs
var
open_controlbox
;
describe
(
"
The Control Box
"
,
$
.
proxy
(
function
()
{
describe
(
"
The Control Box
"
,
$
.
proxy
(
function
()
{
it
(
"
is not shown by default
"
,
$
.
proxy
(
function
()
{
it
(
"
is not shown by default
"
,
$
.
proxy
(
function
()
{
expect
(
this
.
rosterview
.
$el
.
is
(
'
:visible
'
)).
toEqual
(
false
);
expect
(
this
.
rosterview
.
$el
.
is
(
'
:visible
'
)).
toEqual
(
false
);
},
xmppchat
));
},
xmppchat
));
it
(
"
can be opened by clicking a DOM element with class 'toggle-online-users'
"
,
$
.
proxy
(
function
()
{
open_controlbox
=
$
.
proxy
(
function
()
{
// This spec will only pass if the controlbox is not currently
// open yet.
expect
(
$
(
"
div#controlbox
"
).
is
(
'
:visible
'
)).
toBe
(
false
);
spyOn
(
this
,
'
toggleControlBox
'
).
andCallThrough
();
spyOn
(
this
,
'
toggleControlBox
'
).
andCallThrough
();
$
(
'
.toggle-online-users
'
).
click
();
$
(
'
.toggle-online-users
'
).
click
();
expect
(
this
.
toggleControlBox
).
toHaveBeenCalled
();
expect
(
this
.
toggleControlBox
).
toHaveBeenCalled
();
},
xmppchat
));
expect
(
$
(
"
div#controlbox
"
).
is
(
'
:visible
'
)).
toBe
(
true
);
},
xmppchat
);
it
(
"
can be opened by clicking a DOM element with class 'toggle-online-users'
"
,
open_controlbox
);
describe
(
"
The Status Widget
"
,
$
.
proxy
(
function
()
{
describe
(
"
The Status Widget
"
,
$
.
proxy
(
function
()
{
it
(
"
can be used to set the current user's chat status
"
,
$
.
proxy
(
function
()
{
it
(
"
can be used to set the current user's chat status
"
,
$
.
proxy
(
function
()
{
...
@@ -98,14 +106,16 @@
...
@@ -98,14 +106,16 @@
spyOn
(
view
,
'
setStatusMessage
'
).
andCallThrough
();
spyOn
(
view
,
'
setStatusMessage
'
).
andCallThrough
();
spyOn
(
view
,
'
renderStatusChangeForm
'
).
andCallThrough
();
spyOn
(
view
,
'
renderStatusChangeForm
'
).
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
runs
(
function
()
{
view
.
$el
.
find
(
'
a.change-xmpp-status-message
'
).
click
();
view
.
$el
.
find
(
'
a.change-xmpp-status-message
'
).
click
();
expect
(
view
.
renderStatusChangeForm
).
toHaveBeenCalled
();
expect
(
view
.
renderStatusChangeForm
).
toHaveBeenCalled
();
});
// The async testing here is used only to provide time for
waits
(
250
);
// visual feedback
runs
(
function
()
{
var
msg
=
'
I am happy
'
;
var
msg
=
'
I am happy
'
;
runs
(
function
()
{
view
.
$el
.
find
(
'
form input.custom-xmpp-status
'
).
val
(
msg
);
view
.
$el
.
find
(
'
form input.custom-xmpp-status
'
).
val
(
msg
);
});
waits
(
500
);
runs
(
function
()
{
view
.
$el
.
find
(
'
form#set-custom-xmpp-status
'
).
submit
();
view
.
$el
.
find
(
'
form#set-custom-xmpp-status
'
).
submit
();
expect
(
view
.
setStatusMessage
).
toHaveBeenCalled
();
expect
(
view
.
setStatusMessage
).
toHaveBeenCalled
();
expect
(
view
.
$el
.
find
(
'
a.choose-xmpp-status
'
).
hasClass
(
'
online
'
)).
toBe
(
true
);
expect
(
view
.
$el
.
find
(
'
a.choose-xmpp-status
'
).
hasClass
(
'
online
'
)).
toBe
(
true
);
...
@@ -450,6 +460,9 @@
...
@@ -450,6 +460,9 @@
// in localStorage either.
// in localStorage either.
newchatboxes
.
onConnected
();
newchatboxes
.
onConnected
();
expect
(
newchatboxes
.
length
).
toEqual
(
0
);
expect
(
newchatboxes
.
length
).
toEqual
(
0
);
// Lets open the controlbox again, purely for visual feedback
open_controlbox
();
},
xmppchat
));
},
xmppchat
));
describe
(
"
A Chat Message
"
,
$
.
proxy
(
function
()
{
describe
(
"
A Chat Message
"
,
$
.
proxy
(
function
()
{
...
...
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