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
9d886a9f
Commit
9d886a9f
authored
Sep 02, 2014
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for the onInvite method. refs #215
parent
cebf8c24
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
2 deletions
+29
-2
converse.js
converse.js
+1
-1
spec/chatroom.js
spec/chatroom.js
+28
-1
No files found.
converse.js
View file @
9d886a9f
...
...
@@ -2572,7 +2572,7 @@
'
password
'
:
$x
.
attr
(
'
password
'
)
});
if
(
!
chatroom
.
get
(
'
connected
'
))
{
converse
.
chatboxviews
.
get
(
jid
).
connect
(
null
);
converse
.
chatboxviews
.
get
(
room_
jid
).
connect
(
null
);
}
}
},
...
...
spec/chatroom.js
View file @
9d886a9f
...
...
@@ -79,7 +79,7 @@
$hint
=
view
.
$el
.
find
(
'
input.invited-contact.tt-hint
'
);
runs
(
function
()
{
expect
(
$input
.
length
).
toBe
(
1
);
expect
(
$input
.
attr
(
'
placeholder
'
)).
toBe
(
'
Type to invite
'
);
expect
(
$input
.
attr
(
'
placeholder
'
)).
toBe
(
'
Invite...
'
);
$input
.
val
(
"
Felix
"
);
$input
.
trigger
(
'
input
'
);
});
...
...
@@ -94,6 +94,33 @@
});
},
converse
));
it
(
"
can be joined automatically, based upon a received invite
"
,
$
.
proxy
(
function
()
{
spyOn
(
window
,
'
confirm
'
).
andCallFake
(
function
()
{
return
true
;
});
test_utils
.
createContacts
(
'
current
'
);
// We need roster contacts, who can invite us
var
view
=
this
.
chatboxviews
.
get
(
'
lounge@muc.localhost
'
);
view
.
close
();
var
name
=
mock
.
cur_names
[
0
];
var
from_jid
=
name
.
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
room_jid
=
'
lounge@localhost
'
;
var
reason
=
"
Please join this chat room
"
;
var
message
=
$
(
"
<message from='
"
+
from_jid
+
"
' to='
"
+
converse
.
bare_jid
+
"
'>
"
+
"
<x xmlns='jabber:x:conference'
"
+
"
jid='
"
+
room_jid
+
"
'
"
+
"
reason='
"
+
reason
+
"
'/>
"
+
"
</message>
"
)[
0
];
expect
(
converse
.
chatboxes
.
models
.
length
).
toBe
(
0
);
converse
.
chatboxes
.
onInvite
(
message
);
expect
(
window
.
confirm
).
toHaveBeenCalledWith
(
name
+
'
has invited you to join a chat room:
'
+
room_jid
+
'
, and left the following reason: "
'
+
reason
+
'
"
'
);
expect
(
converse
.
chatboxes
.
models
.
length
).
toBe
(
1
);
expect
(
converse
.
chatboxes
.
models
[
0
].
id
).
toBe
(
room_jid
);
},
converse
));
it
(
"
shows received groupchat messages
"
,
$
.
proxy
(
function
()
{
spyOn
(
converse
,
'
emit
'
);
var
view
=
this
.
chatboxviews
.
get
(
'
lounge@muc.localhost
'
);
...
...
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