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
be9cd599
Commit
be9cd599
authored
May 08, 2013
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add chatroom test concerning localstorage
parent
743eb1da
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
1 deletion
+32
-1
spec/MainSpec.js
spec/MainSpec.js
+32
-1
No files found.
spec/MainSpec.js
View file @
be9cd599
...
@@ -453,7 +453,7 @@
...
@@ -453,7 +453,7 @@
// onConnected method
// onConnected method
newchatboxes
.
onConnected
();
newchatboxes
.
onConnected
();
expect
(
newchatboxes
.
length
).
toEqual
(
6
);
expect
(
newchatboxes
.
length
).
toEqual
(
6
);
// Check that the
roster
items retrieved from localStorage
// Check that the
chatboxes
items retrieved from localStorage
// have the same attributes values as the original ones.
// have the same attributes values as the original ones.
attrs
=
[
'
id
'
,
'
box_id
'
,
'
visible
'
];
attrs
=
[
'
id
'
,
'
box_id
'
,
'
visible
'
];
for
(
i
=
0
;
i
<
attrs
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
attrs
.
length
;
i
++
)
{
...
@@ -556,6 +556,17 @@
...
@@ -556,6 +556,17 @@
},
converse
));
},
converse
));
describe
(
"
The Controlbox Tabs
"
,
$
.
proxy
(
function
()
{
describe
(
"
The Controlbox Tabs
"
,
$
.
proxy
(
function
()
{
beforeEach
(
$
.
proxy
(
function
()
{
// Close any remaining open chatboxes
var
i
,
chatbox
,
num_chatboxes
=
this
.
chatboxes
.
models
.
length
;
for
(
i
=
0
;
i
<
num_chatboxes
;
i
++
)
{
chatbox
=
this
.
chatboxes
.
models
[
i
];
if
(
chatbox
.
get
(
'
id
'
)
!=
'
controlbox
'
)
{
this
.
chatboxesview
.
views
[
chatbox
.
get
(
'
id
'
)].
closeChat
();
}
}
},
converse
));
it
(
"
contains two tabs, 'Contacts' and 'ChatRooms'
"
,
$
.
proxy
(
function
()
{
it
(
"
contains two tabs, 'Contacts' and 'ChatRooms'
"
,
$
.
proxy
(
function
()
{
var
cbview
=
this
.
chatboxesview
.
views
.
controlbox
;
var
cbview
=
this
.
chatboxesview
.
views
.
controlbox
;
var
$panels
=
cbview
.
$el
.
find
(
'
#controlbox-panes
'
);
var
$panels
=
cbview
.
$el
.
find
(
'
#controlbox-panes
'
);
...
@@ -627,6 +638,26 @@
...
@@ -627,6 +638,26 @@
chatroomview
.
onChatRoomRoster
(
roster
,
room
);
chatroomview
.
onChatRoomRoster
(
roster
,
room
);
},
converse
));
},
converse
));
it
(
"
can be saved to, and retrieved from, localStorage
"
,
$
.
proxy
(
function
()
{
// We instantiate a new ChatBoxes collection, which by default
// will be empty.
var
newchatboxes
=
new
this
.
ChatBoxes
();
expect
(
newchatboxes
.
length
).
toEqual
(
0
);
// The chatboxes will then be fetched from localStorage inside the
// onConnected method
newchatboxes
.
onConnected
();
expect
(
newchatboxes
.
length
).
toEqual
(
2
);
// controlbox is also included
// Check that the chatrooms retrieved from localStorage
// have the same attributes values as the original ones.
attrs
=
[
'
id
'
,
'
box_id
'
,
'
visible
'
];
for
(
i
=
0
;
i
<
attrs
.
length
;
i
++
)
{
new_attrs
=
_
.
pluck
(
_
.
pluck
(
newchatboxes
.
models
,
'
attributes
'
),
attrs
[
i
]);
old_attrs
=
_
.
pluck
(
_
.
pluck
(
this
.
chatboxes
.
models
,
'
attributes
'
),
attrs
[
i
]);
expect
(
_
.
isEqual
(
new_attrs
,
old_attrs
)).
toEqual
(
true
);
}
this
.
rosterview
.
render
();
},
converse
));
it
(
"
can be closed again by clicking a DOM element with class 'close-chatbox-button'
"
,
$
.
proxy
(
function
()
{
it
(
"
can be closed again by clicking a DOM element with class 'close-chatbox-button'
"
,
$
.
proxy
(
function
()
{
var
view
=
this
.
chatboxesview
.
views
[
'
lounge@muc.localhost
'
],
chatroom
=
view
.
model
,
$el
;
var
view
=
this
.
chatboxesview
.
views
[
'
lounge@muc.localhost
'
],
chatroom
=
view
.
model
,
$el
;
spyOn
(
view
,
'
closeChat
'
).
andCallThrough
();
spyOn
(
view
,
'
closeChat
'
).
andCallThrough
();
...
...
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