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
b14538b4
Commit
b14538b4
authored
Mar 04, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename ChatBoxesView to ChatBoxViews
parent
1567b212
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
51 deletions
+51
-51
converse.js
converse.js
+10
-10
spec/chatbox.js
spec/chatbox.js
+11
-11
spec/chatroom.js
spec/chatroom.js
+17
-17
spec/controlbox.js
spec/controlbox.js
+4
-4
tests/utils.js
tests/utils.js
+9
-9
No files found.
converse.js
View file @
b14538b4
...
...
@@ -348,7 +348,7 @@
};
this
.
showLoginButton
=
function
()
{
var
view
=
converse
.
chatbox
esview
.
get
(
'
controlbox
'
);
var
view
=
converse
.
chatbox
views
.
get
(
'
controlbox
'
);
if
(
typeof
view
.
loginpanel
!==
'
undefined
'
)
{
view
.
loginpanel
.
showLoginButton
();
}
...
...
@@ -893,7 +893,7 @@
},
this
);
this
.
updateVCard
();
this
.
$el
.
appendTo
(
converse
.
chatbox
esview
.
$el
);
this
.
$el
.
appendTo
(
converse
.
chatbox
views
.
$el
);
this
.
render
().
show
().
focus
().
model
.
messages
.
fetch
({
add
:
true
});
if
(
this
.
model
.
get
(
'
status
'
))
{
this
.
showStatusMessage
(
this
.
model
.
get
(
'
status
'
));
...
...
@@ -1750,7 +1750,7 @@
}
}
if
(
!
nick
)
{
return
;
}
chatroom
=
converse
.
chatbox
esview
.
showChatBox
({
chatroom
=
converse
.
chatbox
views
.
showChatBox
({
'
id
'
:
jid
,
'
jid
'
:
jid
,
'
name
'
:
Strophe
.
unescapeNode
(
Strophe
.
getNodeFromJid
(
jid
)),
...
...
@@ -1759,7 +1759,7 @@
'
box_id
'
:
hex_sha1
(
jid
)
});
if
(
!
chatroom
.
get
(
'
connected
'
))
{
converse
.
chatbox
esview
.
get
(
jid
).
connect
(
null
);
converse
.
chatbox
views
.
get
(
jid
).
connect
(
null
);
}
}
});
...
...
@@ -1775,7 +1775,7 @@
},
initialize
:
function
()
{
this
.
$el
.
appendTo
(
converse
.
chatbox
esview
.
$el
);
this
.
$el
.
appendTo
(
converse
.
chatbox
views
.
$el
);
this
.
model
.
on
(
'
change
'
,
$
.
proxy
(
function
(
item
,
changed
)
{
var
i
;
if
(
_
.
has
(
item
.
changed
,
'
connected
'
))
{
...
...
@@ -1898,7 +1898,7 @@
undefined
);
},
this
);
this
.
$el
.
appendTo
(
converse
.
chatbox
esview
.
$el
);
this
.
$el
.
appendTo
(
converse
.
chatbox
views
.
$el
);
this
.
render
().
show
().
model
.
messages
.
fetch
({
add
:
true
});
this
.
initDragResize
();
},
...
...
@@ -2351,7 +2351,7 @@
onChatRoomRoster
:
function
(
roster
,
room
)
{
this
.
renderChatArea
();
var
controlboxview
=
converse
.
chatbox
esview
.
get
(
'
controlbox
'
),
var
controlboxview
=
converse
.
chatbox
views
.
get
(
'
controlbox
'
),
roster_size
=
_
.
size
(
roster
),
$participant_list
=
this
.
$el
.
find
(
'
.participant-list
'
),
participants
=
[],
keys
=
_
.
keys
(
roster
),
i
;
...
...
@@ -2462,7 +2462,7 @@
}
});
this
.
ChatBox
esView
=
Backbone
.
View
.
extend
({
this
.
ChatBox
Views
=
Backbone
.
View
.
extend
({
el
:
'
#conversejs
'
,
initialize
:
function
()
{
...
...
@@ -2539,7 +2539,7 @@
openChat
:
function
(
ev
)
{
ev
.
preventDefault
();
return
converse
.
chatbox
esview
.
showChatBox
({
return
converse
.
chatbox
views
.
showChatBox
({
'
id
'
:
this
.
model
.
get
(
'
jid
'
),
'
jid
'
:
this
.
model
.
get
(
'
jid
'
),
'
fullname
'
:
this
.
model
.
get
(
'
fullname
'
),
...
...
@@ -3467,7 +3467,7 @@
// --------------
// This is the end of the initialize method.
this
.
chatboxes
=
new
this
.
ChatBoxes
();
this
.
chatbox
esview
=
new
this
.
ChatBoxesView
({
model
:
this
.
chatboxes
});
this
.
chatbox
views
=
new
this
.
ChatBoxViews
({
model
:
this
.
chatboxes
});
this
.
controlboxtoggle
=
new
this
.
ControlBoxToggle
();
this
.
otr
=
new
this
.
OTR
();
...
...
spec/chatbox.js
View file @
b14538b4
...
...
@@ -79,8 +79,8 @@
it
(
"
can be closed by clicking a DOM element with class 'close-chatbox-button'
"
,
$
.
proxy
(
function
()
{
var
chatbox
=
utils
.
openChatBoxes
(
1
)[
0
],
controlview
=
this
.
chatbox
esview
.
get
(
'
controlbox
'
),
// The controlbox is currently open
chatview
=
this
.
chatbox
esview
.
get
(
chatbox
.
get
(
'
jid
'
));
controlview
=
this
.
chatbox
views
.
get
(
'
controlbox
'
),
// The controlbox is currently open
chatview
=
this
.
chatbox
views
.
get
(
chatbox
.
get
(
'
jid
'
));
spyOn
(
chatview
,
'
closeChat
'
).
andCallThrough
();
spyOn
(
controlview
,
'
closeChat
'
).
andCallThrough
();
spyOn
(
converse
,
'
emit
'
);
...
...
@@ -141,7 +141,7 @@
var
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
utils
.
openChatBoxFor
(
contact_jid
);
var
chatbox
=
this
.
chatboxes
.
get
(
contact_jid
);
var
view
=
this
.
chatbox
esview
.
get
(
contact_jid
);
var
view
=
this
.
chatbox
views
.
get
(
contact_jid
);
expect
(
chatbox
).
toBeDefined
();
expect
(
view
).
toBeDefined
();
var
$toolbar
=
view
.
$el
.
find
(
'
ul.chat-toolbar
'
);
...
...
@@ -153,7 +153,7 @@
var
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
utils
.
openChatBoxFor
(
contact_jid
);
var
chatbox
=
this
.
chatboxes
.
get
(
contact_jid
);
var
view
=
this
.
chatbox
esview
.
get
(
contact_jid
);
var
view
=
this
.
chatbox
views
.
get
(
contact_jid
);
var
$toolbar
=
view
.
$el
.
find
(
'
ul.chat-toolbar
'
);
var
$textarea
=
view
.
$el
.
find
(
'
textarea.chat-textarea
'
);
expect
(
$toolbar
.
children
(
'
li.toggle-smiley
'
).
length
).
toBe
(
1
);
...
...
@@ -213,7 +213,7 @@
var
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
utils
.
openChatBoxFor
(
contact_jid
);
var
chatbox
=
this
.
chatboxes
.
get
(
contact_jid
);
var
view
=
this
.
chatbox
esview
.
get
(
contact_jid
);
var
view
=
this
.
chatbox
views
.
get
(
contact_jid
);
var
$toolbar
=
view
.
$el
.
find
(
'
ul.chat-toolbar
'
);
expect
(
$toolbar
.
children
(
'
li.toggle-otr
'
).
length
).
toBe
(
1
);
// Register spies
...
...
@@ -239,7 +239,7 @@
var
contact_jid
=
mock
.
cur_names
[
2
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
utils
.
openChatBoxFor
(
contact_jid
);
var
chatbox
=
this
.
chatboxes
.
get
(
contact_jid
);
var
view
=
this
.
chatbox
esview
.
get
(
contact_jid
);
var
view
=
this
.
chatbox
views
.
get
(
contact_jid
);
var
$toolbar
=
view
.
$el
.
find
(
'
ul.chat-toolbar
'
);
var
callButton
=
$toolbar
.
find
(
'
.toggle-call
'
);
...
...
@@ -278,7 +278,7 @@
runs
(
$
.
proxy
(
function
()
{
// Check that the chatbox and its view now exist
var
chatbox
=
this
.
chatboxes
.
get
(
sender_jid
);
var
chatboxview
=
this
.
chatbox
esview
.
get
(
sender_jid
);
var
chatboxview
=
this
.
chatbox
views
.
get
(
sender_jid
);
expect
(
chatbox
).
toBeDefined
();
expect
(
chatboxview
).
toBeDefined
();
// Check that the message was received and check the
...
...
@@ -311,7 +311,7 @@
var
one_day_ago
=
new
Date
(
new
Date
().
setDate
(
new
Date
().
getDate
()
-
1
));
var
message
=
'
This is a day old message
'
;
var
chatbox
=
this
.
chatboxes
.
get
(
contact_jid
);
var
chatboxview
=
this
.
chatbox
esview
.
get
(
contact_jid
);
var
chatboxview
=
this
.
chatbox
views
.
get
(
contact_jid
);
var
$chat_content
=
chatboxview
.
$el
.
find
(
'
.chat-content
'
);
var
msg_obj
;
var
msg_txt
;
...
...
@@ -380,7 +380,7 @@
waits
(
250
);
runs
(
function
()
{
expect
(
converse
.
emit
).
toHaveBeenCalledWith
(
'
onChatBoxFocused
'
,
jasmine
.
any
(
Object
));
var
view
=
this
.
chatbox
esview
.
get
(
contact_jid
);
var
view
=
this
.
chatbox
views
.
get
(
contact_jid
);
var
message
=
'
This message is sent from this chatbox
'
;
spyOn
(
view
,
'
sendMessage
'
).
andCallThrough
();
view
.
$el
.
find
(
'
.chat-textarea
'
).
text
(
message
);
...
...
@@ -396,7 +396,7 @@
it
(
"
are sanitized to prevent Javascript injection attacks
"
,
$
.
proxy
(
function
()
{
var
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
'
'
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
utils
.
openChatBoxFor
(
contact_jid
);
var
view
=
this
.
chatbox
esview
.
get
(
contact_jid
);
var
view
=
this
.
chatbox
views
.
get
(
contact_jid
);
var
message
=
'
This message contains <b>markup</b>
'
;
spyOn
(
view
,
'
sendMessage
'
).
andCallThrough
();
view
.
$el
.
find
(
'
.chat-textarea
'
).
text
(
message
);
...
...
@@ -413,7 +413,7 @@
it
(
"
'/clear' can be used to clear messages in a conversation
"
,
$
.
proxy
(
function
()
{
spyOn
(
converse
,
'
emit
'
);
var
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
view
=
this
.
chatbox
esview
.
get
(
contact_jid
);
var
view
=
this
.
chatbox
views
.
get
(
contact_jid
);
var
message
=
'
This message is another sent from this chatbox
'
;
// Lets make sure there is at least one message already
// (e.g for when this test is run on its own).
...
...
spec/chatroom.js
View file @
b14538b4
...
...
@@ -24,7 +24,7 @@
waits
(
300
);
runs
(
function
()
{
// Open a new chatroom
var
roomspanel
=
converse
.
chatbox
esview
.
get
(
'
controlbox
'
).
roomspanel
;
var
roomspanel
=
converse
.
chatbox
views
.
get
(
'
controlbox
'
).
roomspanel
;
var
$input
=
roomspanel
.
$el
.
find
(
'
input.new-chatroom-name
'
);
var
$nick
=
roomspanel
.
$el
.
find
(
'
input.new-chatroom-nick
'
);
var
$server
=
roomspanel
.
$el
.
find
(
'
input.new-chatroom-server
'
);
...
...
@@ -42,7 +42,7 @@
});
it
(
"
shows users currently present in the room
"
,
$
.
proxy
(
function
()
{
var
chatroomview
=
this
.
chatbox
esview
.
get
(
'
lounge@muc.localhost
'
),
var
chatroomview
=
this
.
chatbox
views
.
get
(
'
lounge@muc.localhost
'
),
$participant_list
;
var
roster
=
{},
room
=
{},
i
;
for
(
i
=
0
;
i
<
mock
.
chatroom_names
.
length
-
1
;
i
++
)
{
...
...
@@ -57,7 +57,7 @@
},
converse
));
it
(
"
indicates moderators by means of a special css class and tooltip
"
,
$
.
proxy
(
function
()
{
var
chatroomview
=
this
.
chatbox
esview
.
get
(
'
lounge@muc.localhost
'
);
var
chatroomview
=
this
.
chatbox
views
.
get
(
'
lounge@muc.localhost
'
);
var
roster
=
{},
idx
=
mock
.
chatroom_names
.
length
-
1
;
roster
[
mock
.
chatroom_names
[
idx
]]
=
{};
roster
[
mock
.
chatroom_names
[
idx
]].
role
=
'
moderator
'
;
...
...
@@ -71,7 +71,7 @@
it
(
"
shows received groupchat messages
"
,
$
.
proxy
(
function
()
{
spyOn
(
converse
,
'
emit
'
);
var
view
=
this
.
chatbox
esview
.
get
(
'
lounge@muc.localhost
'
);
var
view
=
this
.
chatbox
views
.
get
(
'
lounge@muc.localhost
'
);
if
(
!
view
.
$el
.
find
(
'
.chat-area
'
).
length
)
{
view
.
renderChatArea
();
}
var
nick
=
mock
.
chatroom_names
[
0
];
var
text
=
'
This is a received message
'
;
...
...
@@ -90,7 +90,7 @@
it
(
"
shows sent groupchat messages
"
,
$
.
proxy
(
function
()
{
spyOn
(
converse
,
'
emit
'
);
var
view
=
this
.
chatbox
esview
.
get
(
'
lounge@muc.localhost
'
);
var
view
=
this
.
chatbox
views
.
get
(
'
lounge@muc.localhost
'
);
if
(
!
view
.
$el
.
find
(
'
.chat-area
'
).
length
)
{
view
.
renderChatArea
();
}
var
nick
=
mock
.
chatroom_names
[
0
];
var
text
=
'
This is a sent message
'
;
...
...
@@ -133,7 +133,7 @@
},
converse
));
it
(
"
can be closed again by clicking a DOM element with class 'close-chatbox-button'
"
,
$
.
proxy
(
function
()
{
var
view
=
this
.
chatbox
esview
.
get
(
'
lounge@muc.localhost
'
),
chatroom
=
view
.
model
,
$el
;
var
view
=
this
.
chatbox
views
.
get
(
'
lounge@muc.localhost
'
),
chatroom
=
view
.
model
,
$el
;
spyOn
(
view
,
'
closeChat
'
).
andCallThrough
();
spyOn
(
converse
,
'
emit
'
);
spyOn
(
converse
.
connection
.
muc
,
'
leave
'
);
...
...
@@ -152,7 +152,7 @@
describe
(
"
When attempting to enter a chatroom
"
,
$
.
proxy
(
function
()
{
beforeEach
(
$
.
proxy
(
function
()
{
var
roomspanel
=
this
.
chatbox
esview
.
get
(
'
controlbox
'
).
roomspanel
;
var
roomspanel
=
this
.
chatbox
views
.
get
(
'
controlbox
'
).
roomspanel
;
var
$input
=
roomspanel
.
$el
.
find
(
'
input.new-chatroom-name
'
);
var
$nick
=
roomspanel
.
$el
.
find
(
'
input.new-chatroom-nick
'
);
var
$server
=
roomspanel
.
$el
.
find
(
'
input.new-chatroom-server
'
);
...
...
@@ -163,7 +163,7 @@
},
converse
));
afterEach
(
$
.
proxy
(
function
()
{
var
view
=
this
.
chatbox
esview
.
get
(
'
problematic@muc.localhost
'
);
var
view
=
this
.
chatbox
views
.
get
(
'
problematic@muc.localhost
'
);
view
.
closeChat
();
},
converse
));
...
...
@@ -177,7 +177,7 @@
.
c
(
'
error
'
).
attrs
({
by
:
'
coven@chat.shakespeare.lit
'
,
type
:
'
auth
'
})
.
c
(
'
not-authorized
'
).
attrs
({
xmlns
:
'
urn:ietf:params:xml:ns:xmpp-stanzas
'
}).
nodeTree
;
var
view
=
this
.
chatbox
esview
.
get
(
'
problematic@muc.localhost
'
);
var
view
=
this
.
chatbox
views
.
get
(
'
problematic@muc.localhost
'
);
spyOn
(
view
,
'
renderPasswordForm
'
).
andCallThrough
();
runs
(
function
()
{
view
.
onChatRoomPresence
(
presence
,
{
'
nick
'
:
'
dummy
'
});
...
...
@@ -200,7 +200,7 @@
.
c
(
'
x
'
).
attrs
({
xmlns
:
'
http://jabber.org/protocol/muc
'
}).
up
()
.
c
(
'
error
'
).
attrs
({
by
:
'
coven@chat.shakespeare.lit
'
,
type
:
'
auth
'
})
.
c
(
'
registration-required
'
).
attrs
({
xmlns
:
'
urn:ietf:params:xml:ns:xmpp-stanzas
'
}).
nodeTree
;
var
view
=
this
.
chatbox
esview
.
get
(
'
problematic@muc.localhost
'
);
var
view
=
this
.
chatbox
views
.
get
(
'
problematic@muc.localhost
'
);
spyOn
(
view
,
'
showErrorMessage
'
).
andCallThrough
();
view
.
onChatRoomPresence
(
presence
,
{
'
nick
'
:
'
dummy
'
});
expect
(
view
.
$el
.
find
(
'
.chat-body p
'
).
text
()).
toBe
(
'
You are not on the member list of this room
'
);
...
...
@@ -215,7 +215,7 @@
.
c
(
'
x
'
).
attrs
({
xmlns
:
'
http://jabber.org/protocol/muc
'
}).
up
()
.
c
(
'
error
'
).
attrs
({
by
:
'
coven@chat.shakespeare.lit
'
,
type
:
'
auth
'
})
.
c
(
'
forbidden
'
).
attrs
({
xmlns
:
'
urn:ietf:params:xml:ns:xmpp-stanzas
'
}).
nodeTree
;
var
view
=
this
.
chatbox
esview
.
get
(
'
problematic@muc.localhost
'
);
var
view
=
this
.
chatbox
views
.
get
(
'
problematic@muc.localhost
'
);
spyOn
(
view
,
'
showErrorMessage
'
).
andCallThrough
();
view
.
onChatRoomPresence
(
presence
,
{
'
nick
'
:
'
dummy
'
});
expect
(
view
.
$el
.
find
(
'
.chat-body p
'
).
text
()).
toBe
(
'
You have been banned from this room
'
);
...
...
@@ -230,7 +230,7 @@
.
c
(
'
x
'
).
attrs
({
xmlns
:
'
http://jabber.org/protocol/muc
'
}).
up
()
.
c
(
'
error
'
).
attrs
({
by
:
'
coven@chat.shakespeare.lit
'
,
type
:
'
modify
'
})
.
c
(
'
jid-malformed
'
).
attrs
({
xmlns
:
'
urn:ietf:params:xml:ns:xmpp-stanzas
'
}).
nodeTree
;
var
view
=
this
.
chatbox
esview
.
get
(
'
problematic@muc.localhost
'
);
var
view
=
this
.
chatbox
views
.
get
(
'
problematic@muc.localhost
'
);
spyOn
(
view
,
'
showErrorMessage
'
).
andCallThrough
();
view
.
onChatRoomPresence
(
presence
,
{
'
nick
'
:
'
dummy
'
});
expect
(
view
.
$el
.
find
(
'
.chat-body p
'
).
text
()).
toBe
(
'
No nickname was specified
'
);
...
...
@@ -245,7 +245,7 @@
.
c
(
'
x
'
).
attrs
({
xmlns
:
'
http://jabber.org/protocol/muc
'
}).
up
()
.
c
(
'
error
'
).
attrs
({
by
:
'
coven@chat.shakespeare.lit
'
,
type
:
'
cancel
'
})
.
c
(
'
not-allowed
'
).
attrs
({
xmlns
:
'
urn:ietf:params:xml:ns:xmpp-stanzas
'
}).
nodeTree
;
var
view
=
this
.
chatbox
esview
.
get
(
'
problematic@muc.localhost
'
);
var
view
=
this
.
chatbox
views
.
get
(
'
problematic@muc.localhost
'
);
spyOn
(
view
,
'
showErrorMessage
'
).
andCallThrough
();
view
.
onChatRoomPresence
(
presence
,
{
'
nick
'
:
'
dummy
'
});
expect
(
view
.
$el
.
find
(
'
.chat-body p
'
).
text
()).
toBe
(
'
You are not allowed to create new rooms
'
);
...
...
@@ -260,7 +260,7 @@
.
c
(
'
x
'
).
attrs
({
xmlns
:
'
http://jabber.org/protocol/muc
'
}).
up
()
.
c
(
'
error
'
).
attrs
({
by
:
'
coven@chat.shakespeare.lit
'
,
type
:
'
cancel
'
})
.
c
(
'
not-acceptable
'
).
attrs
({
xmlns
:
'
urn:ietf:params:xml:ns:xmpp-stanzas
'
}).
nodeTree
;
var
view
=
this
.
chatbox
esview
.
get
(
'
problematic@muc.localhost
'
);
var
view
=
this
.
chatbox
views
.
get
(
'
problematic@muc.localhost
'
);
spyOn
(
view
,
'
showErrorMessage
'
).
andCallThrough
();
view
.
onChatRoomPresence
(
presence
,
{
'
nick
'
:
'
dummy
'
});
expect
(
view
.
$el
.
find
(
'
.chat-body p
'
).
text
()).
toBe
(
"
Your nickname doesn't conform to this room's policies
"
);
...
...
@@ -275,7 +275,7 @@
.
c
(
'
x
'
).
attrs
({
xmlns
:
'
http://jabber.org/protocol/muc
'
}).
up
()
.
c
(
'
error
'
).
attrs
({
by
:
'
coven@chat.shakespeare.lit
'
,
type
:
'
cancel
'
})
.
c
(
'
conflict
'
).
attrs
({
xmlns
:
'
urn:ietf:params:xml:ns:xmpp-stanzas
'
}).
nodeTree
;
var
view
=
this
.
chatbox
esview
.
get
(
'
problematic@muc.localhost
'
);
var
view
=
this
.
chatbox
views
.
get
(
'
problematic@muc.localhost
'
);
spyOn
(
view
,
'
showErrorMessage
'
).
andCallThrough
();
view
.
onChatRoomPresence
(
presence
,
{
'
nick
'
:
'
dummy
'
});
expect
(
view
.
$el
.
find
(
'
.chat-body p
'
).
text
()).
toBe
(
"
Your nickname is already taken
"
);
...
...
@@ -290,7 +290,7 @@
.
c
(
'
x
'
).
attrs
({
xmlns
:
'
http://jabber.org/protocol/muc
'
}).
up
()
.
c
(
'
error
'
).
attrs
({
by
:
'
coven@chat.shakespeare.lit
'
,
type
:
'
cancel
'
})
.
c
(
'
item-not-found
'
).
attrs
({
xmlns
:
'
urn:ietf:params:xml:ns:xmpp-stanzas
'
}).
nodeTree
;
var
view
=
this
.
chatbox
esview
.
get
(
'
problematic@muc.localhost
'
);
var
view
=
this
.
chatbox
views
.
get
(
'
problematic@muc.localhost
'
);
spyOn
(
view
,
'
showErrorMessage
'
).
andCallThrough
();
view
.
onChatRoomPresence
(
presence
,
{
'
nick
'
:
'
dummy
'
});
expect
(
view
.
$el
.
find
(
'
.chat-body p
'
).
text
()).
toBe
(
"
This room does not (yet) exist
"
);
...
...
@@ -305,7 +305,7 @@
.
c
(
'
x
'
).
attrs
({
xmlns
:
'
http://jabber.org/protocol/muc
'
}).
up
()
.
c
(
'
error
'
).
attrs
({
by
:
'
coven@chat.shakespeare.lit
'
,
type
:
'
cancel
'
})
.
c
(
'
service-unavailable
'
).
attrs
({
xmlns
:
'
urn:ietf:params:xml:ns:xmpp-stanzas
'
}).
nodeTree
;
var
view
=
this
.
chatbox
esview
.
get
(
'
problematic@muc.localhost
'
);
var
view
=
this
.
chatbox
views
.
get
(
'
problematic@muc.localhost
'
);
spyOn
(
view
,
'
showErrorMessage
'
).
andCallThrough
();
view
.
onChatRoomPresence
(
presence
,
{
'
nick
'
:
'
dummy
'
});
expect
(
view
.
$el
.
find
(
'
.chat-body p
'
).
text
()).
toBe
(
"
This room has reached it's maximum number of occupants
"
);
...
...
spec/controlbox.js
View file @
b14538b4
...
...
@@ -481,7 +481,7 @@
describe
(
"
The 'Add Contact' widget
"
,
$
.
proxy
(
function
(
mock
,
utils
)
{
it
(
"
opens up an add form when you click on it
"
,
$
.
proxy
(
function
()
{
var
panel
=
this
.
chatbox
esview
.
get
(
'
controlbox
'
).
contactspanel
;
var
panel
=
this
.
chatbox
views
.
get
(
'
controlbox
'
).
contactspanel
;
spyOn
(
panel
,
'
toggleContactForm
'
).
andCallThrough
();
panel
.
delegateEvents
();
// We need to rebind all events otherwise our spy won't be called
panel
.
$el
.
find
(
'
a.toggle-xmpp-contact-form
'
).
click
();
...
...
@@ -506,7 +506,7 @@
},
converse
));
it
(
"
contains two tabs, 'Contacts' and 'ChatRooms'
"
,
$
.
proxy
(
function
()
{
var
cbview
=
this
.
chatbox
esview
.
get
(
'
controlbox
'
);
var
cbview
=
this
.
chatbox
views
.
get
(
'
controlbox
'
);
var
$panels
=
cbview
.
$el
.
find
(
'
.controlbox-panes
'
);
expect
(
$panels
.
children
().
length
).
toBe
(
2
);
expect
(
$panels
.
children
().
first
().
attr
(
'
id
'
)).
toBe
(
'
users
'
);
...
...
@@ -529,7 +529,7 @@
},
converse
));
it
(
"
is opened by clicking the 'Chatrooms' tab
"
,
$
.
proxy
(
function
()
{
var
cbview
=
this
.
chatbox
esview
.
get
(
'
controlbox
'
);
var
cbview
=
this
.
chatbox
views
.
get
(
'
controlbox
'
);
var
$tabs
=
cbview
.
$el
.
find
(
'
#controlbox-tabs
'
);
var
$panels
=
cbview
.
$el
.
find
(
'
.controlbox-panes
'
);
var
$contacts
=
$panels
.
children
().
first
();
...
...
@@ -548,7 +548,7 @@
},
converse
));
it
(
"
contains a form through which a new chatroom can be created
"
,
$
.
proxy
(
function
()
{
var
roomspanel
=
this
.
chatbox
esview
.
get
(
'
controlbox
'
).
roomspanel
;
var
roomspanel
=
this
.
chatbox
views
.
get
(
'
controlbox
'
).
roomspanel
;
var
$input
=
roomspanel
.
$el
.
find
(
'
input.new-chatroom-name
'
);
var
$nick
=
roomspanel
.
$el
.
find
(
'
input.new-chatroom-nick
'
);
var
$server
=
roomspanel
.
$el
.
find
(
'
input.new-chatroom-server
'
);
...
...
tests/utils.js
View file @
b14538b4
...
...
@@ -13,7 +13,7 @@
var
i
,
chatbox
;
for
(
i
=
converse
.
chatboxes
.
models
.
length
-
1
;
i
>-
1
;
i
--
)
{
chatbox
=
converse
.
chatboxes
.
models
[
i
];
converse
.
chatbox
esview
.
get
(
chatbox
.
get
(
'
id
'
)).
closeChat
();
converse
.
chatbox
views
.
get
(
chatbox
.
get
(
'
id
'
)).
closeChat
();
}
return
this
;
};
...
...
@@ -22,17 +22,17 @@
var
i
,
chatbox
,
num_chatboxes
=
converse
.
chatboxes
.
models
.
length
;
for
(
i
=
num_chatboxes
-
1
;
i
>-
1
;
i
--
)
{
chatbox
=
converse
.
chatboxes
.
models
[
i
];
converse
.
chatbox
esview
.
get
(
chatbox
.
get
(
'
id
'
)).
closeChat
();
converse
.
chatbox
esview
.
get
(
chatbox
.
get
(
'
id
'
)).
$el
.
remove
();
converse
.
chatbox
views
.
get
(
chatbox
.
get
(
'
id
'
)).
closeChat
();
converse
.
chatbox
views
.
get
(
chatbox
.
get
(
'
id
'
)).
$el
.
remove
();
}
converse
.
chatbox
esview
.
get
(
'
controlbox
'
).
closeChat
();
converse
.
chatbox
esview
.
get
(
'
controlbox
'
).
$el
.
remove
();
converse
.
chatbox
views
.
get
(
'
controlbox
'
).
closeChat
();
converse
.
chatbox
views
.
get
(
'
controlbox
'
).
$el
.
remove
();
return
this
;
};
utils
.
initConverse
=
function
()
{
converse
.
chatboxes
=
new
converse
.
ChatBoxes
();
converse
.
chatbox
esview
=
new
converse
.
ChatBoxesView
({
model
:
converse
.
chatboxes
});
converse
.
chatbox
views
=
new
converse
.
ChatBoxViews
({
model
:
converse
.
chatboxes
});
converse
.
onConnected
();
};
...
...
@@ -66,13 +66,13 @@
};
utils
.
openContactsPanel
=
function
()
{
var
cbview
=
converse
.
chatbox
esview
.
get
(
'
controlbox
'
);
var
cbview
=
converse
.
chatbox
views
.
get
(
'
controlbox
'
);
var
$tabs
=
cbview
.
$el
.
find
(
'
#controlbox-tabs
'
);
$tabs
.
find
(
'
li
'
).
first
().
find
(
'
a
'
).
click
();
};
utils
.
openRoomsPanel
=
function
()
{
var
cbview
=
converse
.
chatbox
esview
.
get
(
'
controlbox
'
);
var
cbview
=
converse
.
chatbox
views
.
get
(
'
controlbox
'
);
var
$tabs
=
cbview
.
$el
.
find
(
'
#controlbox-tabs
'
);
$tabs
.
find
(
'
li
'
).
last
().
find
(
'
a
'
).
click
();
};
...
...
@@ -91,7 +91,7 @@
};
utils
.
clearChatBoxMessages
=
function
(
jid
)
{
var
view
=
converse
.
chatbox
esview
.
get
(
jid
);
var
view
=
converse
.
chatbox
views
.
get
(
jid
);
view
.
$el
.
find
(
'
.chat-content
'
).
empty
();
view
.
model
.
messages
.
reset
().
localStorage
.
_clear
();
};
...
...
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