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
79a51212
Commit
79a51212
authored
Mar 01, 2015
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also test for users leaving a room. updates #307
parent
6c31f764
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
5 deletions
+26
-5
spec/chatroom.js
spec/chatroom.js
+26
-5
No files found.
spec/chatroom.js
View file @
79a51212
...
@@ -27,19 +27,18 @@
...
@@ -27,19 +27,18 @@
var
view
=
this
.
chatboxviews
.
get
(
'
lounge@localhost
'
),
var
view
=
this
.
chatboxviews
.
get
(
'
lounge@localhost
'
),
$participants
=
view
.
$
(
'
.participant-list
'
);
$participants
=
view
.
$
(
'
.participant-list
'
);
spyOn
(
view
,
'
onChatRoomPresence
'
).
andCallThrough
();
spyOn
(
view
,
'
onChatRoomPresence
'
).
andCallThrough
();
var
room
=
{},
i
,
role
;
var
presence
,
room
=
{},
i
,
role
;
for
(
i
=
0
;
i
<
mock
.
chatroom_names
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
mock
.
chatroom_names
.
length
;
i
++
)
{
name
=
mock
.
chatroom_names
[
i
];
name
=
mock
.
chatroom_names
[
i
];
console
.
log
(
name
);
role
=
mock
.
chatroom_roles
[
name
].
role
;
role
=
mock
.
chatroom_roles
[
name
].
role
;
// See example 21 http://xmpp.org/extensions/xep-0045.html#enter-pres
// See example 21 http://xmpp.org/extensions/xep-0045.html#enter-pres
var
presence
=
$pres
({
presence
=
$pres
({
to
:
'
dummy@localhost/pda
'
,
to
:
'
dummy@localhost/pda
'
,
from
:
'
lounge@localhost/
'
+
name
from
:
'
lounge@localhost/
'
+
name
}).
c
(
'
x
'
).
attrs
({
xmlns
:
'
http://jabber.org/protocol/muc#user
'
})
}).
c
(
'
x
'
).
attrs
({
xmlns
:
'
http://jabber.org/protocol/muc#user
'
})
.
c
(
'
item
'
).
attrs
({
.
c
(
'
item
'
).
attrs
({
affiliation
:
mock
.
chatroom_roles
[
name
].
affiliation
,
affiliation
:
mock
.
chatroom_roles
[
name
].
affiliation
,
jid
:
'
dummy@localhost/pda
'
,
jid
:
name
.
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
,
role
:
role
role
:
role
}).
up
()
}).
up
()
.
c
(
'
status
'
).
attrs
({
code
:
'
110
'
}).
nodeTree
;
.
c
(
'
status
'
).
attrs
({
code
:
'
110
'
}).
nodeTree
;
...
@@ -50,6 +49,28 @@
...
@@ -50,6 +49,28 @@
expect
(
$
(
$participants
.
find
(
'
li
'
)[
i
]).
text
()).
toBe
(
mock
.
chatroom_names
[
i
]);
expect
(
$
(
$participants
.
find
(
'
li
'
)[
i
]).
text
()).
toBe
(
mock
.
chatroom_names
[
i
]);
expect
(
$
(
$participants
.
find
(
'
li
'
)[
i
]).
hasClass
(
'
moderator
'
)).
toBe
(
role
===
"
moderator
"
);
expect
(
$
(
$participants
.
find
(
'
li
'
)[
i
]).
hasClass
(
'
moderator
'
)).
toBe
(
role
===
"
moderator
"
);
}
}
// Test users leaving the room
// http://xmpp.org/extensions/xep-0045.html#exit
for
(
i
=
mock
.
chatroom_names
.
length
-
1
;
i
>-
1
;
i
--
)
{
name
=
mock
.
chatroom_names
[
i
];
console
.
log
(
name
);
role
=
mock
.
chatroom_roles
[
name
].
role
;
// See example 21 http://xmpp.org/extensions/xep-0045.html#enter-pres
presence
=
$pres
({
to
:
'
dummy@localhost/pda
'
,
from
:
'
lounge@localhost/
'
+
name
,
type
:
'
unavailable
'
}).
c
(
'
x
'
).
attrs
({
xmlns
:
'
http://jabber.org/protocol/muc#user
'
})
.
c
(
'
item
'
).
attrs
({
affiliation
:
mock
.
chatroom_roles
[
name
].
affiliation
,
jid
:
name
.
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
,
role
:
'
none
'
}).
nodeTree
;
this
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
expect
(
view
.
onChatRoomPresence
).
toHaveBeenCalled
();
expect
(
$participants
.
find
(
'
li
'
).
length
).
toBe
(
i
);
}
},
converse
));
},
converse
));
it
(
"
indicates moderators by means of a special css class and tooltip
"
,
$
.
proxy
(
function
()
{
it
(
"
indicates moderators by means of a special css class and tooltip
"
,
$
.
proxy
(
function
()
{
...
@@ -62,7 +83,7 @@
...
@@ -62,7 +83,7 @@
}).
c
(
'
x
'
).
attrs
({
xmlns
:
'
http://jabber.org/protocol/muc#user
'
})
}).
c
(
'
x
'
).
attrs
({
xmlns
:
'
http://jabber.org/protocol/muc#user
'
})
.
c
(
'
item
'
).
attrs
({
.
c
(
'
item
'
).
attrs
({
affiliation
:
'
admin
'
,
affiliation
:
'
admin
'
,
jid
:
'
dummy@localhost/pda
'
,
jid
:
name
.
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
,
role
:
'
moderator
'
,
role
:
'
moderator
'
,
}).
up
()
}).
up
()
.
c
(
'
status
'
).
attrs
({
code
:
'
110
'
}).
nodeTree
;
.
c
(
'
status
'
).
attrs
({
code
:
'
110
'
}).
nodeTree
;
...
...
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