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
9cb91512
Commit
9cb91512
authored
May 21, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test to check that #1577 is resolved
parent
1269d53e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
9 deletions
+40
-9
spec/bookmarks.js
spec/bookmarks.js
+27
-2
spec/muc.js
spec/muc.js
+1
-1
tests/utils.js
tests/utils.js
+12
-6
No files found.
spec/bookmarks.js
View file @
9cb91512
...
...
@@ -21,7 +21,7 @@
it
(
"
can be bookmarked
"
,
mock
.
initConverse
(
null
,
[
'
rosterGroupsFetched
'
],
{},
async
function
(
done
,
_converse
)
{
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
_converse
.
bare_jid
,
[{
'
category
'
:
'
pubsub
'
,
'
type
'
:
'
pep
'
}],
...
...
@@ -188,6 +188,31 @@
describe
(
"
when bookmarked
"
,
function
()
{
it
(
"
will use the nickname from the bookmark
"
,
mock
.
initConverse
(
null
,
[
'
rosterGroupsFetched
'
],
{},
async
function
(
done
,
_converse
)
{
await
test_utils
.
waitUntilDiscoConfirmed
(
_converse
,
_converse
.
bare_jid
,
[{
'
category
'
:
'
pubsub
'
,
'
type
'
:
'
pep
'
}],
[
'
http://jabber.org/protocol/pubsub#publish-options
'
]
);
const
room_jid
=
'
coven@chat.shakespeare.lit
'
;
await
test_utils
.
waitUntil
(()
=>
_converse
.
bookmarks
);
_converse
.
bookmarks
.
create
({
'
jid
'
:
room_jid
,
'
autojoin
'
:
false
,
'
name
'
:
'
The Play
'
,
'
nick
'
:
'
Othello
'
});
const
model
=
await
_converse
.
api
.
rooms
.
open
(
room_jid
);
spyOn
(
model
,
'
join
'
).
and
.
callThrough
();
await
test_utils
.
getRoomFeatures
(
_converse
,
'
coven
'
,
'
chat.shakespeare.lit
'
);
await
test_utils
.
waitUntil
(()
=>
model
.
join
.
calls
.
count
());
expect
(
model
.
get
(
'
nick
'
)).
toBe
(
'
Othello
'
);
done
();
}));
it
(
"
displays that it's bookmarked through its bookmark icon
"
,
mock
.
initConverse
(
null
,
[
'
rosterGroupsFetched
'
],
{},
async
function
(
done
,
_converse
)
{
...
...
@@ -197,7 +222,7 @@
[{
'
category
'
:
'
pubsub
'
,
'
type
'
:
'
pep
'
}],
[
'
http://jabber.org/protocol/pubsub#publish-options
'
]
);
await
test_utils
.
openChatRoom
(
_converse
,
'
lounge
'
,
'
localhost
'
,
'
dummy
'
);
await
_converse
.
api
.
rooms
.
open
(
`lounge@localhost`
);
const
view
=
_converse
.
chatboxviews
.
get
(
'
lounge@localhost
'
);
await
test_utils
.
waitUntil
(()
=>
!
_
.
isNull
(
view
.
el
.
querySelector
(
'
.toggle-bookmark
'
)));
var
bookmark_icon
=
view
.
el
.
querySelector
(
'
.toggle-bookmark
'
);
...
...
spec/muc.js
View file @
9cb91512
...
...
@@ -453,7 +453,7 @@
null
,
[
'
rosterGroupsFetched
'
,
'
chatBoxesFetched
'
],
{},
async
function
(
done
,
_converse
)
{
await
test_utils
.
openChatRoom
(
_converse
,
"
coven
"
,
'
chat.shakespeare.lit
'
,
'
some1
'
);
await
test_utils
.
openChatRoom
(
_converse
,
"
coven
"
,
'
chat.shakespeare.lit
'
);
const
view
=
_converse
.
chatboxviews
.
get
(
'
coven@chat.shakespeare.lit
'
);
const
chat_content
=
view
.
el
.
querySelector
(
'
.chat-content
'
);
/* <presence to="dummy@localhost/_converse.js-29092160"
...
...
tests/utils.js
View file @
9cb91512
...
...
@@ -114,16 +114,14 @@
return
_converse
.
chatboxviews
.
get
(
jid
);
};
utils
.
openChatRoom
=
function
(
_converse
,
room
,
server
,
nick
)
{
utils
.
openChatRoom
=
function
(
_converse
,
room
,
server
)
{
return
_converse
.
api
.
rooms
.
open
(
`
${
room
}
@
${
server
}
`
);
};
utils
.
openAndEnterChatRoom
=
async
function
(
_converse
,
room
,
server
,
nick
,
features
=
[])
{
utils
.
getRoomFeatures
=
async
function
(
_converse
,
room
,
server
,
features
=
[])
{
const
room_jid
=
`
${
room
}
@
${
server
}
`
.
toLowerCase
();
const
stanzas
=
_converse
.
connection
.
IQ_stanzas
;
await
_converse
.
api
.
rooms
.
open
(
room_jid
);
const
view
=
_converse
.
chatboxviews
.
get
(
room_jid
);
let
stanza
=
await
utils
.
waitUntil
(()
=>
_
.
filter
(
const
stanza
=
await
utils
.
waitUntil
(()
=>
_
.
filter
(
stanzas
,
iq
=>
iq
.
querySelector
(
`iq[to="
${
room_jid
}
"] query[xmlns="http://jabber.org/protocol/disco#info"]`
...
...
@@ -161,6 +159,13 @@
.
c
(
'
field
'
,
{
'
type
'
:
'
text-single
'
,
'
var
'
:
'
muc#roominfo_occupants
'
,
'
label
'
:
'
Number of occupants
'
})
.
c
(
'
value
'
).
t
(
0
);
_converse
.
connection
.
_dataRecv
(
utils
.
createRequest
(
features_stanza
));
};
utils
.
openAndEnterChatRoom
=
async
function
(
_converse
,
room
,
server
,
nick
,
features
=
[])
{
const
room_jid
=
`
${
room
}
@
${
server
}
`
.
toLowerCase
();
const
stanzas
=
_converse
.
connection
.
IQ_stanzas
;
await
_converse
.
api
.
rooms
.
open
(
room_jid
);
await
utils
.
getRoomFeatures
(
_converse
,
room
,
server
,
features
);
const
iq
=
await
utils
.
waitUntil
(()
=>
_
.
filter
(
stanzas
,
...
...
@@ -171,8 +176,9 @@
stanzas
.
splice
(
stanzas
.
indexOf
(
iq
),
1
)
// The XMPP server returns the reserved nick for this user.
const
view
=
_converse
.
chatboxviews
.
get
(
room_jid
);
const
IQ_id
=
iq
.
getAttribute
(
'
id
'
);
stanza
=
$iq
({
const
stanza
=
$iq
({
'
type
'
:
'
result
'
,
'
id
'
:
IQ_id
,
'
from
'
:
view
.
model
.
get
(
'
jid
'
),
...
...
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