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
38e06683
Commit
38e06683
authored
May 27, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests.
parent
ad51e1c0
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
26 deletions
+27
-26
converse.js
converse.js
+13
-5
spec/chatbox.js
spec/chatbox.js
+6
-6
spec/chatroom.js
spec/chatroom.js
+2
-2
spec/controlbox.js
spec/controlbox.js
+0
-7
tests.html
tests.html
+4
-3
tests/main.js
tests/main.js
+1
-1
tests/utils.js
tests/utils.js
+1
-2
No files found.
converse.js
View file @
38e06683
...
...
@@ -158,6 +158,7 @@
this
.
forward_messages
=
false
;
this
.
hide_muc_server
=
false
;
this
.
i18n
=
locales
.
en
;
this
.
no_trimming
=
false
;
// Set to true for phantomjs tests (where browser apparently has no width)
this
.
prebind
=
false
;
this
.
show_controlbox_by_default
=
false
;
this
.
show_only_online_users
=
false
;
...
...
@@ -195,6 +196,7 @@
'
fullname
'
,
'
hide_muc_server
'
,
'
i18n
'
,
'
no_trimming
'
,
'
jid
'
,
'
prebind
'
,
'
rid
'
,
...
...
@@ -2556,6 +2558,9 @@
* Check whether there is enough space in the page to show
* another chat box. Otherwise, close the oldest chat box.
*/
if
(
converse
.
no_trimming
)
{
return
;
}
var
toggle_width
=
0
,
trimmed_chats_width
,
boxes_width
=
view
.
$el
.
outerWidth
(
true
),
...
...
@@ -3630,14 +3635,17 @@
}
});
this
.
_initialize
=
function
()
{
this
.
chatboxes
=
new
this
.
ChatBoxes
();
this
.
chatboxviews
=
new
this
.
ChatBoxViews
({
model
:
this
.
chatboxes
});
this
.
controlboxtoggle
=
new
this
.
ControlBoxToggle
();
this
.
otr
=
new
this
.
OTR
();
};
// Initialization
// --------------
// This is the end of the initialize method.
this
.
chatboxes
=
new
this
.
ChatBoxes
();
this
.
chatboxviews
=
new
this
.
ChatBoxViews
({
model
:
this
.
chatboxes
});
this
.
controlboxtoggle
=
new
this
.
ControlBoxToggle
();
this
.
otr
=
new
this
.
OTR
();
this
.
_initialize
();
if
((
this
.
prebind
)
&&
(
!
this
.
connection
))
{
if
((
!
this
.
jid
)
||
(
!
this
.
sid
)
||
(
!
this
.
rid
)
||
(
!
this
.
bosh_service_url
))
{
this
.
log
(
'
If you set prebind=true, you MUST supply JID, RID and SID values
'
);
...
...
spec/chatbox.js
View file @
38e06683
...
...
@@ -34,7 +34,7 @@
// openControlBox was called earlier, so the controlbox is
// visible, but no other chat boxes have been created.
expect
(
this
.
chatboxes
.
length
).
toEqual
(
1
);
spyOn
(
this
.
chatboxviews
,
'
trim
Open
Chats
'
);
spyOn
(
this
.
chatboxviews
,
'
trimChats
'
);
var
online_contacts
=
this
.
rosterview
.
$el
.
find
(
'
dt#xmpp-contacts
'
).
siblings
(
'
dd.current-xmpp-contact
'
).
find
(
'
a.open-chat
'
);
for
(
i
=
0
;
i
<
online_contacts
.
length
;
i
++
)
{
...
...
@@ -46,7 +46,7 @@
$el
.
click
();
expect
(
view
.
openChat
).
toHaveBeenCalled
();
expect
(
this
.
chatboxes
.
length
).
toEqual
(
i
+
2
);
expect
(
this
.
chatboxviews
.
trim
Open
Chats
).
toHaveBeenCalled
();
expect
(
this
.
chatboxviews
.
trimChats
).
toHaveBeenCalled
();
}
},
converse
));
...
...
@@ -72,14 +72,14 @@
it
(
"
can be saved to, and retrieved from, localStorage
"
,
$
.
proxy
(
function
()
{
spyOn
(
converse
,
'
emit
'
);
spyOn
(
this
.
chatboxviews
,
'
trim
Open
Chats
'
);
spyOn
(
this
.
chatboxviews
,
'
trimChats
'
);
runs
(
function
()
{
utils
.
openControlBox
();
});
waits
(
250
);
runs
(
function
()
{
utils
.
openChatBoxes
(
6
);
expect
(
this
.
chatboxviews
.
trim
Open
Chats
).
toHaveBeenCalled
();
expect
(
this
.
chatboxviews
.
trimChats
).
toHaveBeenCalled
();
// We instantiate a new ChatBoxes collection, which by default
// will be empty.
var
newchatboxes
=
new
this
.
ChatBoxes
();
...
...
@@ -166,7 +166,7 @@
it
(
"
will be removed from localStorage when closed
"
,
$
.
proxy
(
function
()
{
spyOn
(
converse
,
'
emit
'
);
spyOn
(
converse
.
chatboxviews
,
'
trim
Open
Chats
'
);
spyOn
(
converse
.
chatboxviews
,
'
trimChats
'
);
this
.
chatboxes
.
localStorage
.
_clear
();
runs
(
function
()
{
utils
.
closeControlBox
();
...
...
@@ -176,7 +176,7 @@
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
onChatBoxClosed
'
,
jasmine
.
any
(
Object
));
expect
(
converse
.
chatboxes
.
length
).
toEqual
(
0
);
utils
.
openChatBoxes
(
6
);
expect
(
converse
.
chatboxviews
.
trim
Open
Chats
).
toHaveBeenCalled
();
expect
(
converse
.
chatboxviews
.
trimChats
).
toHaveBeenCalled
();
expect
(
converse
.
chatboxes
.
length
).
toEqual
(
6
);
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
onChatBoxOpened
'
,
jasmine
.
any
(
Object
));
utils
.
closeAllChatBoxes
();
...
...
spec/chatroom.js
View file @
38e06683
...
...
@@ -115,14 +115,14 @@
it
(
"
can be saved to, and retrieved from, localStorage
"
,
$
.
proxy
(
function
()
{
// We instantiate a new ChatBoxes collection, which by default
// will be empty.
spyOn
(
this
.
chatboxviews
,
'
trim
Open
Chats
'
);
spyOn
(
this
.
chatboxviews
,
'
trimChats
'
);
utils
.
openControlBox
();
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
(
this
.
chatboxviews
.
trim
Open
Chats
).
toHaveBeenCalled
();
expect
(
this
.
chatboxviews
.
trimChats
).
toHaveBeenCalled
();
expect
(
newchatboxes
.
length
).
toEqual
(
2
);
// XXX: Includes controlbox, is this a bug?
// Check that the chatrooms retrieved from localStorage
// have the same attributes values as the original ones.
...
...
spec/controlbox.js
View file @
38e06683
...
...
@@ -8,13 +8,10 @@
);
}
(
this
,
function
(
mock
,
utils
)
{
describe
(
"
The Control Box
"
,
$
.
proxy
(
function
(
mock
,
utils
)
{
beforeEach
(
function
()
{
runs
(
function
()
{
utils
.
openControlBox
();
});
waits
(
250
);
runs
(
function
()
{});
});
it
(
"
can be opened by clicking a DOM element with class 'toggle-online-users'
"
,
$
.
proxy
(
function
()
{
...
...
@@ -501,8 +498,6 @@
runs
(
function
()
{
utils
.
openControlBox
();
});
waits
(
250
);
runs
(
function
()
{});
},
converse
));
it
(
"
contains two tabs, 'Contacts' and 'ChatRooms'
"
,
$
.
proxy
(
function
()
{
...
...
@@ -524,8 +519,6 @@
runs
(
function
()
{
utils
.
openControlBox
();
});
waits
(
250
);
runs
(
function
()
{});
},
converse
));
it
(
"
is opened by clicking the 'Chatrooms' tab
"
,
$
.
proxy
(
function
()
{
...
...
tests.html
View file @
38e06683
...
...
@@ -6,8 +6,10 @@
<meta
name=
"description"
content=
"Converse.js: A chat client for your website"
/>
<link
rel=
"shortcut icon"
type=
"image/png"
href=
"components/jasmine/images/jasmine_favicon.png"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"components/jasmine/src/html/jasmine.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
href=
"stylesheets/stylesheet.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
media=
"screen"
href=
"converse.css"
>
<link
type=
"text/css"
rel=
"stylesheet"
media=
"screen"
href=
"http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css"
/>
<link
type=
"text/css"
rel=
"stylesheet"
media=
"screen"
href=
"http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css"
/>
<link
type=
"text/css"
rel=
"stylesheet"
media=
"screen"
href=
"css/theme.css"
/>
<link
type=
"text/css"
rel=
"stylesheet"
media=
"screen"
href=
"css/converse.css"
/>
<script
src=
"main.js"
></script>
<script
data-main=
"tests/main"
src=
"components/requirejs/require.js"
></script>
</head>
...
...
@@ -19,6 +21,5 @@
<h2
id=
"project_tagline"
>
Tests
</h2>
</header>
</div>
<div
id=
"conversejs"
></div>
</body>
</html>
tests/main.js
View file @
38e06683
...
...
@@ -45,7 +45,7 @@ require([
auto_subscribe
:
false
,
animate
:
false
,
connection
:
mock
.
mock_connection
,
test
ing
:
true
no_trimm
ing
:
true
},
function
(
converse
)
{
window
.
converse
=
converse
;
window
.
crypto
=
{
...
...
tests/utils.js
View file @
38e06683
...
...
@@ -31,8 +31,7 @@
};
utils
.
initConverse
=
function
()
{
converse
.
chatboxes
=
new
converse
.
ChatBoxes
();
converse
.
chatboxviews
=
new
converse
.
ChatBoxViews
({
model
:
converse
.
chatboxes
});
converse
.
_initialize
();
converse
.
onConnected
();
};
...
...
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