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
0f6d1f9e
Commit
0f6d1f9e
authored
Jul 20, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for toggleable headings. updates #83
parent
3236d251
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
10 deletions
+31
-10
spec/controlbox.js
spec/controlbox.js
+31
-10
No files found.
spec/controlbox.js
View file @
0f6d1f9e
...
...
@@ -7,6 +7,27 @@
}
);
}
(
this
,
function
(
mock
,
utils
)
{
var
checkHeaderToggling
=
function
(
$header
)
{
var
$toggle
=
$header
.
find
(
'
a.group-toggle
'
);
expect
(
$header
.
css
(
'
display
'
)).
toEqual
(
'
block
'
);
spyOn
(
this
.
rosterview
,
'
toggleGroup
'
).
andCallThrough
();
expect
(
$header
.
nextUntil
(
'
dt
'
,
'
dd
'
).
length
===
$header
.
nextUntil
(
'
dt
'
,
'
dd:visible
'
).
length
).
toBeTruthy
();
this
.
rosterview
.
delegateEvents
();
// We need to rebind all events otherwise our spy won't be called
expect
(
$toggle
.
hasClass
(
'
icon-closed
'
)).
toBeFalsy
();
expect
(
$toggle
.
hasClass
(
'
icon-opened
'
)).
toBeTruthy
();
$toggle
.
click
();
expect
(
this
.
rosterview
.
toggleGroup
).
toHaveBeenCalled
();
expect
(
$toggle
.
hasClass
(
'
icon-closed
'
)).
toBeTruthy
();
expect
(
$toggle
.
hasClass
(
'
icon-opened
'
)).
toBeFalsy
();
expect
(
$header
.
nextUntil
(
'
dt
'
,
'
dd
'
).
length
===
$header
.
nextUntil
(
'
dt
'
,
'
dd:hidden
'
).
length
).
toBeTruthy
();
$toggle
.
click
();
expect
(
this
.
rosterview
.
toggleGroup
).
toHaveBeenCalled
();
expect
(
$toggle
.
hasClass
(
'
icon-closed
'
)).
toBeFalsy
();
expect
(
$toggle
.
hasClass
(
'
icon-opened
'
)).
toBeTruthy
();
expect
(
$header
.
nextUntil
(
'
dt
'
,
'
dd
'
).
length
===
$header
.
nextUntil
(
'
dt
'
,
'
dd:visible
'
).
length
).
toBeTruthy
();
};
describe
(
"
The Control Box
"
,
$
.
proxy
(
function
(
mock
,
utils
)
{
beforeEach
(
function
()
{
runs
(
function
()
{
...
...
@@ -119,13 +140,13 @@
});
},
converse
));
it
(
"
do not have a head
ing
if there aren't any
"
,
$
.
proxy
(
function
()
{
it
(
"
do not have a head
er
if there aren't any
"
,
$
.
proxy
(
function
()
{
converse
.
rosterview
.
model
.
reset
();
expect
(
this
.
rosterview
.
$el
.
find
(
'
dt#pending-xmpp-contacts
'
).
css
(
'
display
'
)).
toEqual
(
'
none
'
);
},
converse
));
it
(
"
will have their own heading once they have been added
"
,
$
.
proxy
(
function
()
{
expect
(
this
.
rosterview
.
$el
.
find
(
'
dt#pending-xmpp-contacts
'
).
css
(
'
display
'
)).
toEqual
(
'
block
'
);
it
(
"
can be collapsed under their own header
"
,
$
.
proxy
(
function
()
{
checkHeaderToggling
.
apply
(
this
,
[
this
.
rosterview
.
$el
.
find
(
'
dt#pending-xmpp-contacts
'
)]
);
},
converse
));
it
(
"
can be added to the roster
"
,
$
.
proxy
(
function
()
{
...
...
@@ -168,7 +189,7 @@
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
rosterViewUpdated
'
);
},
converse
));
it
(
"
will lose their own head
ing
once the last one has been removed
"
,
$
.
proxy
(
function
()
{
it
(
"
will lose their own head
er
once the last one has been removed
"
,
$
.
proxy
(
function
()
{
var
view
;
spyOn
(
window
,
'
confirm
'
).
andReturn
(
true
);
for
(
i
=
0
;
i
<
mock
.
pend_names
.
length
;
i
++
)
{
...
...
@@ -214,7 +235,7 @@
});
},
converse
));
it
(
"
do not have a head
ing
if there aren't any
"
,
$
.
proxy
(
function
()
{
it
(
"
do not have a head
er
if there aren't any
"
,
$
.
proxy
(
function
()
{
converse
.
rosterview
.
model
.
reset
();
expect
(
this
.
rosterview
.
$el
.
find
(
'
dt.roster-group
'
).
css
(
'
display
'
)).
toEqual
(
'
none
'
);
},
converse
));
...
...
@@ -240,8 +261,8 @@
expect
(
t
).
toEqual
(
mock
.
cur_names
.
slice
(
0
,
i
+
1
).
sort
().
join
(
''
));
},
converse
));
it
(
"
will have their own heading once they have been added
"
,
$
.
proxy
(
function
()
{
expect
(
this
.
rosterview
.
$el
.
find
(
'
dt.roster-group
'
).
css
(
'
display
'
)).
toEqual
(
'
block
'
);
it
(
"
can be collapsed under their own header
"
,
$
.
proxy
(
function
()
{
checkHeaderToggling
.
apply
(
this
,
[
this
.
rosterview
.
$el
.
find
(
'
dt.roster-group
'
)]
);
},
converse
));
it
(
"
can change their status to online and be sorted alphabetically
"
,
$
.
proxy
(
function
()
{
...
...
@@ -401,7 +422,7 @@
});
},
converse
));
it
(
"
do not have a head
ing
if there aren't any
"
,
$
.
proxy
(
function
()
{
it
(
"
do not have a head
er
if there aren't any
"
,
$
.
proxy
(
function
()
{
// by default the dts are hidden from css class and only later they will be hidden
// by jQuery therefore for the first check we will see if visible instead of none
converse
.
rosterview
.
model
.
reset
();
...
...
@@ -442,8 +463,8 @@
}
},
converse
));
it
(
"
will have their own heading once they have been added
"
,
$
.
proxy
(
function
()
{
expect
(
this
.
rosterview
.
$el
.
find
(
'
dt#xmpp-contact-requests
'
).
css
(
'
display
'
)).
toEqual
(
'
block
'
);
it
(
"
can be collapsed under their own header
"
,
$
.
proxy
(
function
()
{
checkHeaderToggling
.
apply
(
this
,
[
this
.
rosterview
.
$el
.
find
(
'
dt#xmpp-contact-requests
'
)]
);
},
converse
));
it
(
"
can have their requests accepted by the user
"
,
$
.
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