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
4cefc7cd
Commit
4cefc7cd
authored
Jul 25, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix failing tests due to renames
parent
d7a3e505
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
29 deletions
+29
-29
spec/chatroom.js
spec/chatroom.js
+20
-20
spec/roomslist.js
spec/roomslist.js
+8
-8
src/converse-muc-views.js
src/converse-muc-views.js
+1
-1
No files found.
spec/chatroom.js
View file @
4cefc7cd
...
@@ -54,7 +54,7 @@
...
@@ -54,7 +54,7 @@
}).
catch
(
_
.
partial
(
console
.
error
,
_
));
}).
catch
(
_
.
partial
(
console
.
error
,
_
));
}));
}));
it
(
"
has a method 'get' which returns a wrapped
chat room
(if it exists)
"
,
it
(
"
has a method 'get' which returns a wrapped
groupchat
(if it exists)
"
,
mock
.
initConverseWithPromises
(
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
function
(
done
,
_converse
)
{
...
@@ -126,7 +126,7 @@
...
@@ -126,7 +126,7 @@
},
300
).
then
(
function
()
{
},
300
).
then
(
function
()
{
var
jid
=
'
lounge@localhost
'
;
var
jid
=
'
lounge@localhost
'
;
var
room
=
_converse
.
api
.
rooms
.
open
(
jid
);
var
room
=
_converse
.
api
.
rooms
.
open
(
jid
);
// Test on
chat room
that's not yet open
// Test on
groupchat
that's not yet open
expect
(
room
instanceof
Object
).
toBeTruthy
();
expect
(
room
instanceof
Object
).
toBeTruthy
();
var
chatroomview
=
_converse
.
chatboxviews
.
get
(
jid
);
var
chatroomview
=
_converse
.
chatboxviews
.
get
(
jid
);
expect
(
chatroomview
.
is_chatroom
).
toBeTruthy
();
expect
(
chatroomview
.
is_chatroom
).
toBeTruthy
();
...
@@ -275,7 +275,7 @@
...
@@ -275,7 +275,7 @@
}));
}));
});
});
describe
(
"
An instant
chat room
"
,
function
()
{
describe
(
"
An instant
groupchat
"
,
function
()
{
it
(
"
will be created when muc_instant_rooms is set to true
"
,
it
(
"
will be created when muc_instant_rooms is set to true
"
,
mock
.
initConverseWithPromises
(
mock
.
initConverseWithPromises
(
...
@@ -407,9 +407,9 @@
...
@@ -407,9 +407,9 @@
}));
}));
});
});
describe
(
"
A
Chat Room
"
,
function
()
{
describe
(
"
A
Groupchat
"
,
function
()
{
it
(
"
shows join/leave messages when users enter or exit a
room
"
,
it
(
"
shows join/leave messages when users enter or exit a
groupchat
"
,
mock
.
initConverseWithPromises
(
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
function
(
done
,
_converse
)
{
...
@@ -664,7 +664,7 @@
...
@@ -664,7 +664,7 @@
jasmine
.
clock
().
tick
(
ONE_DAY_LATER
);
jasmine
.
clock
().
tick
(
ONE_DAY_LATER
);
// Test a user leaving a
chat room
// Test a user leaving a
groupchat
presence
=
$pres
({
presence
=
$pres
({
to
:
'
dummy@localhost/_converse.js-29092160
'
,
to
:
'
dummy@localhost/_converse.js-29092160
'
,
type
:
'
unavailable
'
,
type
:
'
unavailable
'
,
...
@@ -738,7 +738,7 @@
...
@@ -738,7 +738,7 @@
jasmine
.
clock
().
tick
(
ONE_DAY_LATER
);
jasmine
.
clock
().
tick
(
ONE_DAY_LATER
);
// Test a user leaving a
chat room
// Test a user leaving a
groupchat
presence
=
$pres
({
presence
=
$pres
({
to
:
'
dummy@localhost/_converse.js-29092160
'
,
to
:
'
dummy@localhost/_converse.js-29092160
'
,
type
:
'
unavailable
'
,
type
:
'
unavailable
'
,
...
@@ -1419,7 +1419,7 @@
...
@@ -1419,7 +1419,7 @@
});
});
}));
}));
it
(
"
allows the user to invite their roster contacts to enter the
chat room
"
,
it
(
"
allows the user to invite their roster contacts to enter the
groupchat
"
,
mock
.
initConverseWithPromises
(
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
function
(
done
,
_converse
)
{
...
@@ -1497,7 +1497,7 @@
...
@@ -1497,7 +1497,7 @@
var
name
=
mock
.
cur_names
[
0
];
var
name
=
mock
.
cur_names
[
0
];
var
from_jid
=
name
.
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
from_jid
=
name
.
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
room_jid
=
'
lounge@localhost
'
;
var
room_jid
=
'
lounge@localhost
'
;
var
reason
=
"
Please join this
chat room
"
;
var
reason
=
"
Please join this
groupchat
"
;
expect
(
_converse
.
chatboxes
.
models
.
length
).
toBe
(
1
);
expect
(
_converse
.
chatboxes
.
models
.
length
).
toBe
(
1
);
expect
(
_converse
.
chatboxes
.
models
[
0
].
id
).
toBe
(
"
controlbox
"
);
expect
(
_converse
.
chatboxes
.
models
[
0
].
id
).
toBe
(
"
controlbox
"
);
...
@@ -1508,7 +1508,7 @@
...
@@ -1508,7 +1508,7 @@
'
</message>
'
).
firstChild
;
'
</message>
'
).
firstChild
;
_converse
.
onDirectMUCInvitation
(
stanza
);
_converse
.
onDirectMUCInvitation
(
stanza
);
expect
(
window
.
confirm
).
toHaveBeenCalledWith
(
expect
(
window
.
confirm
).
toHaveBeenCalledWith
(
name
+
'
has invited you to join a
chat room
:
'
+
room_jid
+
name
+
'
has invited you to join a
groupchat
:
'
+
room_jid
+
'
, and left the following reason: "
'
+
reason
+
'
"
'
);
'
, and left the following reason: "
'
+
reason
+
'
"
'
);
expect
(
_converse
.
chatboxes
.
models
.
length
).
toBe
(
2
);
expect
(
_converse
.
chatboxes
.
models
.
length
).
toBe
(
2
);
expect
(
_converse
.
chatboxes
.
models
[
0
].
id
).
toBe
(
'
controlbox
'
);
expect
(
_converse
.
chatboxes
.
models
[
0
].
id
).
toBe
(
'
controlbox
'
);
...
@@ -1959,7 +1959,7 @@
...
@@ -1959,7 +1959,7 @@
});
});
}));
}));
it
(
"
informs users if they have been kicked out of the
chat room
"
,
it
(
"
informs users if they have been kicked out of the
groupchat
"
,
mock
.
initConverseWithPromises
(
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
function
(
done
,
_converse
)
{
...
@@ -2871,7 +2871,7 @@
...
@@ -2871,7 +2871,7 @@
spyOn
(
view
,
'
showErrorMessage
'
).
and
.
callThrough
();
spyOn
(
view
,
'
showErrorMessage
'
).
and
.
callThrough
();
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
presence
));
expect
(
view
.
el
.
querySelector
(
'
.chatroom-body .disconnect-container .disconnect-msg:last-child
'
).
textContent
)
expect
(
view
.
el
.
querySelector
(
'
.chatroom-body .disconnect-container .disconnect-msg:last-child
'
).
textContent
)
.
toBe
(
'
You are not allowed to create new
room
s.
'
);
.
toBe
(
'
You are not allowed to create new
groupchat
s.
'
);
done
();
done
();
}).
catch
(
_
.
partial
(
console
.
error
,
_
));
}).
catch
(
_
.
partial
(
console
.
error
,
_
));
}));
}));
...
@@ -2949,9 +2949,9 @@
...
@@ -2949,9 +2949,9 @@
}));
}));
});
});
describe
(
"
Someone being invited to a
chat room
"
,
function
()
{
describe
(
"
Someone being invited to a
groupchat
"
,
function
()
{
it
(
"
will first be added to the member list if the
chat room
is members only
"
,
it
(
"
will first be added to the member list if the
groupchat
is members only
"
,
mock
.
initConverseWithPromises
(
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
function
(
done
,
_converse
)
{
...
@@ -3002,7 +3002,7 @@
...
@@ -3002,7 +3002,7 @@
});
});
var
name
=
mock
.
cur_names
[
0
];
var
name
=
mock
.
cur_names
[
0
];
invitee_jid
=
name
.
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
invitee_jid
=
name
.
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
reason
=
"
Please join this
chat room
"
;
var
reason
=
"
Please join this
groupchat
"
;
view
.
model
.
directInvite
(
invitee_jid
,
reason
);
view
.
model
.
directInvite
(
invitee_jid
,
reason
);
// Check in reverse order that we requested all three lists
// Check in reverse order that we requested all three lists
...
@@ -3088,7 +3088,7 @@
...
@@ -3088,7 +3088,7 @@
var
iq
=
"
<iq to='coven@chat.shakespeare.lit' type='set' xmlns='jabber:client' id='
"
+
IQ_ids
.
pop
()
+
"
'>
"
+
var
iq
=
"
<iq to='coven@chat.shakespeare.lit' type='set' xmlns='jabber:client' id='
"
+
IQ_ids
.
pop
()
+
"
'>
"
+
"
<query xmlns='http://jabber.org/protocol/muc#admin'>
"
+
"
<query xmlns='http://jabber.org/protocol/muc#admin'>
"
+
"
<item affiliation='member' jid='
"
+
invitee_jid
+
"
'>
"
+
"
<item affiliation='member' jid='
"
+
invitee_jid
+
"
'>
"
+
"
<reason>Please join this
chat room
</reason>
"
+
"
<reason>Please join this
groupchat
</reason>
"
+
"
</item>
"
+
"
</item>
"
+
"
</query>
"
+
"
</query>
"
+
"
</iq>
"
;
"
</iq>
"
;
...
@@ -3097,7 +3097,7 @@
...
@@ -3097,7 +3097,7 @@
// Finally check that the user gets invited.
// Finally check that the user gets invited.
expect
(
sent_stanza
.
toLocaleString
()).
toBe
(
// Strophe adds the xmlns attr (although not in spec)
expect
(
sent_stanza
.
toLocaleString
()).
toBe
(
// Strophe adds the xmlns attr (although not in spec)
"
<message from='dummy@localhost/resource' to='
"
+
invitee_jid
+
"
' id='
"
+
sent_id
+
"
' xmlns='jabber:client'>
"
+
"
<message from='dummy@localhost/resource' to='
"
+
invitee_jid
+
"
' id='
"
+
sent_id
+
"
' xmlns='jabber:client'>
"
+
"
<x xmlns='jabber:x:conference' jid='coven@chat.shakespeare.lit' reason='Please join this
chat room
'/>
"
+
"
<x xmlns='jabber:x:conference' jid='coven@chat.shakespeare.lit' reason='Please join this
groupchat
'/>
"
+
"
</message>
"
"
</message>
"
);
);
done
();
done
();
...
@@ -3170,7 +3170,7 @@
...
@@ -3170,7 +3170,7 @@
}));
}));
});
});
describe
(
"
The
\"
Chatroom
s
\"
section
"
,
function
()
{
describe
(
"
The
\"
Groupchat
s
\"
section
"
,
function
()
{
it
(
"
contains a link to a modal through which a new chatroom can be created
"
,
it
(
"
contains a link to a modal through which a new chatroom can be created
"
,
mock
.
initConverseWithPromises
(
mock
.
initConverseWithPromises
(
...
@@ -3198,7 +3198,7 @@
...
@@ -3198,7 +3198,7 @@
}).
catch
(
_
.
partial
(
console
.
error
,
_
));
}).
catch
(
_
.
partial
(
console
.
error
,
_
));
}));
}));
it
(
"
contains a link to a modal which can list
room
s publically available on the server
"
,
it
(
"
contains a link to a modal which can list
groupchat
s publically available on the server
"
,
mock
.
initConverseWithPromises
(
mock
.
initConverseWithPromises
(
null
,
[
'
rosterGroupsFetched
'
],
{},
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
function
(
done
,
_converse
)
{
...
@@ -3253,7 +3253,7 @@
...
@@ -3253,7 +3253,7 @@
expect
(
modal
.
el
.
querySelectorAll
(
'
.available-chatrooms li
'
).
length
).
toBe
(
5
);
expect
(
modal
.
el
.
querySelectorAll
(
'
.available-chatrooms li
'
).
length
).
toBe
(
5
);
const
rooms
=
modal
.
el
.
querySelectorAll
(
'
.available-chatrooms li
'
);
const
rooms
=
modal
.
el
.
querySelectorAll
(
'
.available-chatrooms li
'
);
expect
(
rooms
[
0
].
textContent
.
trim
()).
toBe
(
"
Room
s found:
"
);
expect
(
rooms
[
0
].
textContent
.
trim
()).
toBe
(
"
Groupchat
s found:
"
);
expect
(
rooms
[
1
].
textContent
.
trim
()).
toBe
(
"
A Lonely Heath
"
);
expect
(
rooms
[
1
].
textContent
.
trim
()).
toBe
(
"
A Lonely Heath
"
);
expect
(
rooms
[
2
].
textContent
.
trim
()).
toBe
(
"
A Dark Cave
"
);
expect
(
rooms
[
2
].
textContent
.
trim
()).
toBe
(
"
A Dark Cave
"
);
expect
(
rooms
[
3
].
textContent
.
trim
()).
toBe
(
"
The Palace
"
);
expect
(
rooms
[
3
].
textContent
.
trim
()).
toBe
(
"
The Palace
"
);
...
...
spec/roomslist.js
View file @
4cefc7cd
...
@@ -154,17 +154,17 @@
...
@@ -154,17 +154,17 @@
const
modal
=
view
.
model
.
room_details_modal
;
const
modal
=
view
.
model
.
room_details_modal
;
let
els
=
modal
.
el
.
querySelectorAll
(
'
p.room-info
'
);
let
els
=
modal
.
el
.
querySelectorAll
(
'
p.room-info
'
);
expect
(
els
[
0
].
textContent
).
toBe
(
"
Name: A Dark Cave
"
)
expect
(
els
[
0
].
textContent
).
toBe
(
"
Name: A Dark Cave
"
)
expect
(
els
[
1
].
textContent
).
toBe
(
"
Room
address (JID): coven@chat.shakespeare.lit
"
)
expect
(
els
[
1
].
textContent
).
toBe
(
"
Groupchat
address (JID): coven@chat.shakespeare.lit
"
)
expect
(
els
[
2
].
textContent
).
toBe
(
"
Description: This is the description
"
)
expect
(
els
[
2
].
textContent
).
toBe
(
"
Description: This is the description
"
)
expect
(
els
[
3
].
textContent
).
toBe
(
"
Online users: 1
"
)
expect
(
els
[
3
].
textContent
).
toBe
(
"
Online users: 1
"
)
const
features_list
=
modal
.
el
.
querySelector
(
'
.features-list
'
);
const
features_list
=
modal
.
el
.
querySelector
(
'
.features-list
'
);
expect
(
features_list
.
textContent
.
replace
(
/
(\n
|
\s{2,})
/g
,
''
)).
toBe
(
expect
(
features_list
.
textContent
.
replace
(
/
(\n
|
\s{2,})
/g
,
''
)).
toBe
(
'
Password protected - This
room
requires a password before entry
'
+
'
Password protected - This
groupchat
requires a password before entry
'
+
'
Hidden - This
room
is not publicly searchable
'
+
'
Hidden - This
groupchat
is not publicly searchable
'
+
'
Open - Anyone can join this
room
'
+
'
Open - Anyone can join this
groupchat
'
+
'
Temporary - This
room
will disappear once the last person leaves
'
+
'
Temporary - This
groupchat
will disappear once the last person leaves
'
+
'
Not anonymous - All other
room occu
pants can see your XMPP username
'
+
'
Not anonymous - All other
groupchat partici
pants can see your XMPP username
'
+
'
Not moderated - This
room
is not being moderated
'
'
Not moderated - This
groupchat
is not being moderated
'
);
);
const
presence
=
$pres
({
const
presence
=
$pres
({
to
:
'
dummy@localhost/_converse.js-29092160
'
,
to
:
'
dummy@localhost/_converse.js-29092160
'
,
...
@@ -184,7 +184,7 @@
...
@@ -184,7 +184,7 @@
view
.
model
.
set
({
'
subject
'
:
{
'
author
'
:
'
someone
'
,
'
text
'
:
'
Hatching dark plots
'
}});
view
.
model
.
set
({
'
subject
'
:
{
'
author
'
:
'
someone
'
,
'
text
'
:
'
Hatching dark plots
'
}});
els
=
modal
.
el
.
querySelectorAll
(
'
p.room-info
'
);
els
=
modal
.
el
.
querySelectorAll
(
'
p.room-info
'
);
expect
(
els
[
0
].
textContent
).
toBe
(
"
Name: A Dark Cave
"
)
expect
(
els
[
0
].
textContent
).
toBe
(
"
Name: A Dark Cave
"
)
expect
(
els
[
1
].
textContent
).
toBe
(
"
Room
address (JID): coven@chat.shakespeare.lit
"
)
expect
(
els
[
1
].
textContent
).
toBe
(
"
Groupchat
address (JID): coven@chat.shakespeare.lit
"
)
expect
(
els
[
2
].
textContent
).
toBe
(
"
Description: This is the description
"
)
expect
(
els
[
2
].
textContent
).
toBe
(
"
Description: This is the description
"
)
expect
(
els
[
3
].
textContent
).
toBe
(
"
Topic: Hatching dark plots
"
)
expect
(
els
[
3
].
textContent
).
toBe
(
"
Topic: Hatching dark plots
"
)
expect
(
els
[
4
].
textContent
).
toBe
(
"
Topic author: someone
"
)
expect
(
els
[
4
].
textContent
).
toBe
(
"
Topic author: someone
"
)
...
...
src/converse-muc-views.js
View file @
4cefc7cd
...
@@ -396,7 +396,7 @@
...
@@ -396,7 +396,7 @@
// For translators: %1$s is a variable and will be
// For translators: %1$s is a variable and will be
// replaced with the XMPP server name
// replaced with the XMPP server name
available_chatrooms
.
innerHTML
=
tpl_rooms_results
({
available_chatrooms
.
innerHTML
=
tpl_rooms_results
({
'
feedback_text
'
:
__
(
'
g
roupchats found:
'
)
'
feedback_text
'
:
__
(
'
G
roupchats found:
'
)
});
});
const
fragment
=
document
.
createDocumentFragment
();
const
fragment
=
document
.
createDocumentFragment
();
const
children
=
_
.
reject
(
_
.
map
(
this
.
rooms
,
this
.
roomStanzaItemToHTMLElement
),
_
.
isNil
)
const
children
=
_
.
reject
(
_
.
map
(
this
.
rooms
,
this
.
roomStanzaItemToHTMLElement
),
_
.
isNil
)
...
...
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