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
5532a9ec
Commit
5532a9ec
authored
Apr 06, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove jquery from tests
parent
1a22a944
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
503 additions
and
582 deletions
+503
-582
dist/converse.js
dist/converse.js
+33
-13
package-lock.json
package-lock.json
+0
-6
package.json
package.json
+0
-1
spec/bookmarks.js
spec/bookmarks.js
+11
-10
spec/disco.js
spec/disco.js
+6
-7
spec/headline.js
spec/headline.js
+1
-2
spec/minchats.js
spec/minchats.js
+35
-42
spec/muc.js
spec/muc.js
+2
-2
spec/notification.js
spec/notification.js
+2
-2
spec/protocol.js
spec/protocol.js
+31
-33
spec/register.js
spec/register.js
+1
-1
spec/roster.js
spec/roster.js
+372
-460
spec/transcripts.js
spec/transcripts.js
+1
-2
src/headless/dist/converse-headless.js
src/headless/dist/converse-headless.js
+8
-1
No files found.
dist/converse.js
View file @
5532a9ec
...
...
@@ -47993,8 +47993,14 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
'info_toggle_bookmark': this.model.get('bookmarked') ? __('Unbookmark this groupchat') : __('Bookmark this groupchat'),
'bookmarked': this.model.get('bookmarked')
}));
const close_button = this.el.querySelector('.close-chatbox-button');
close_button.insertAdjacentHTML('afterend', bookmark_button);
const buttons_row = this.el.querySelector('.chatbox-buttons');
const close_button = buttons_row.querySelector('.close-chatbox-button');
if (close_button) {
close_button.insertAdjacentHTML('afterend', bookmark_button);
} else {
buttons_row.insertAdjacentHTML('beforeEnd', bookmark_button);
}
},
async renderHeading() {
...
...
@@ -52743,10 +52749,18 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_1__["default"].plugins
const div = document.createElement('div');
div.innerHTML = html;
const button = div.querySelector('.close-chatbox-button');
button.insertAdjacentHTML('afterend', templates_chatbox_minimize_html__WEBPACK_IMPORTED_MODULE_2___default()({
const buttons_row = div.querySelector('.chatbox-buttons');
const button = buttons_row.querySelector('.close-chatbox-button');
const minimize_el = templates_chatbox_minimize_html__WEBPACK_IMPORTED_MODULE_2___default()({
'info_minimize': __('Minimize this chat box')
}));
});
if (button) {
button.insertAdjacentHTML('afterend', minimize_el);
} else {
buttons_row.insertAdjacentHTML('beforeEnd', minimize_el);
}
return div.innerHTML;
}
...
...
@@ -53601,7 +53615,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
'submit form': 'showRooms',
'click a.room-info': 'toggleRoomInfo',
'change input[name=nick]': 'setNick',
'change input[name=server]': 'setDomain',
'change input[name=server]': 'setDomain
FromEvent
',
'click .open-room': 'openRoom'
},
...
...
@@ -53726,12 +53740,12 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
showRooms(ev) {
ev.preventDefault();
const data = new FormData(ev.target);
this.model.s
ave('muc_domain', Strophe.getDomainFromJid(data.get('server')
));
this.model.s
etDomain(data.get('server'
));
this.updateRoomsList();
},
setDomain(ev) {
this.model.s
ave('muc_domain', Strophe.getDomainFromJid(ev.target.value)
);
setDomain
FromEvent
(ev) {
this.model.s
etDomain(ev.target.value
);
},
setNick(ev) {
...
...
@@ -53778,7 +53792,6 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
parseRoomDataFromEvent(form) {
const data = new FormData(form);
const jid = data.get('chatroom');
this.model.save('muc_domain', Strophe.getDomainFromJid(jid));
let nick;
if (_converse.locked_muc_nickname) {
...
...
@@ -53812,6 +53825,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
jid = `${Strophe.escapeNode(data.jid)}@${_converse.muc_domain}`;
} else {
jid = data.jid;
this.model.setDomain(jid);
}
_converse.api.rooms.open(jid, _.extend(data, {
...
...
@@ -55504,7 +55518,6 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_5__["default"].plugins
});
function setMUCDomain(domain, controlboxview) {
_converse.muc_domain = domain;
controlboxview.roomspanel.model.save('muc_domain', Strophe.getDomainFromJid(domain));
}
...
...
@@ -60557,7 +60570,7 @@ __webpack_require__.r(__webpack_exports__);
/* END: Removable components */
const WHITELISTED_PLUGINS = ['converse-autocomplete', 'converse-bookmarks', 'converse-caps', 'converse-chatboxviews', 'converse-chatview', 'converse-controlbox', 'converse-dragresize', 'converse-embedded', 'converse-fullscreen', 'converse-headline', 'converse-mam-views', 'converse-message-view', 'converse-minimize', 'converse-modal', 'converse-muc-views', 'converse-notification', 'converse-o
auth', 'converse-o
memo', 'converse-profile', 'converse-push', 'converse-register', 'converse-roomslist', 'converse-rosterview', 'converse-singleton'];
const WHITELISTED_PLUGINS = ['converse-autocomplete', 'converse-bookmarks', 'converse-caps', 'converse-chatboxviews', 'converse-chatview', 'converse-controlbox', 'converse-dragresize', 'converse-embedded', 'converse-fullscreen', 'converse-headline', 'converse-mam-views', 'converse-message-view', 'converse-minimize', 'converse-modal', 'converse-muc-views', 'converse-notification', 'converse-omemo', 'converse-profile', 'converse-push', 'converse-register', 'converse-roomslist', 'converse-rosterview', 'converse-singleton'];
const initialize = _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_22__["default"].initialize;
_converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_22__["default"].initialize = function (settings, callback) {
...
...
@@ -67921,10 +67934,17 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
_converse.RoomsPanelModel = Backbone.Model.extend({
defaults: function defaults() {
return {
'muc_domain':
''
,
'muc_domain':
_converse.muc_domain
,
'nick': _converse.getDefaultMUCNickname()
};
},
setDomain(jid) {
if (!_converse.locked_muc_domain) {
this.save('muc_domain', Strophe.getDomainFromJid(jid));
}
}
});
/**
* A direct MUC invitation to join a groupchat has been received
package-lock.json
View file @
5532a9ec
...
...
@@ -8091,12 +8091,6 @@
"integrity"
:
"sha1-elSbvZ/+FYWwzQoZHiAwVb7ldLQ="
,
"dev"
:
true
},
"jquery"
:
{
"version"
:
"3.2.1"
,
"resolved"
:
"https://registry.npmjs.org/jquery/-/jquery-3.2.1.tgz"
,
"integrity"
:
"sha1-XE2d5lKvbNCncBVKYxu6ErAVx4c="
,
"dev"
:
true
},
"js-base64"
:
{
"version"
:
"2.4.9"
,
"resolved"
:
"https://registry.npmjs.org/js-base64/-/js-base64-2.4.9.tgz"
,
...
...
package.json
View file @
5532a9ec
...
...
@@ -60,7 +60,6 @@
"
install
"
:
"
^0.9.5
"
,
"
jasmine-core
"
:
"
2.99.1
"
,
"
jed
"
:
"
1.1.1
"
,
"
jquery
"
:
"
3.2.1
"
,
"
jsdoc
"
:
"
^3.5.5
"
,
"
lerna
"
:
"
^3.13.1
"
,
"
lodash-template-loader
"
:
"
^2.0.0
"
,
...
...
spec/bookmarks.js
View file @
5532a9ec
...
...
@@ -3,11 +3,10 @@
(
function
(
root
,
factory
)
{
define
([
"
jasmine
"
,
"
jquery
"
,
"
mock
"
,
"
test-utils
"
],
factory
);
}
(
this
,
function
(
jasmine
,
$
,
mock
,
test_utils
)
{
}
(
this
,
function
(
jasmine
,
mock
,
test_utils
)
{
"
use strict
"
;
const
$iq
=
converse
.
env
.
$iq
,
$msg
=
converse
.
env
.
$msg
,
...
...
@@ -604,16 +603,18 @@
'
name
'
:
'
The Play
'
,
'
nick
'
:
''
});
await
test_utils
.
waitUntil
(()
=>
$
(
'
#chatrooms .bookmarks.rooms-list .room-item:visible
'
).
length
);
expect
(
$
(
'
#chatrooms .bookmarks.rooms-list
'
).
hasClass
(
'
collapsed
'
)).
toBeFalsy
();
expect
(
$
(
'
#chatrooms .bookmarks.rooms-list .room-item:visible
'
).
length
).
toBe
(
1
);
const
el
=
_converse
.
chatboxviews
.
el
const
selector
=
'
#chatrooms .bookmarks.rooms-list .room-item
'
;
await
test_utils
.
waitUntil
(()
=>
sizzle
(
selector
,
el
).
filter
(
u
.
isVisible
).
length
);
expect
(
u
.
hasClass
(
'
collapsed
'
,
sizzle
(
'
#chatrooms .bookmarks.rooms-list
'
,
el
).
pop
())).
toBeFalsy
();
expect
(
sizzle
(
selector
,
el
).
filter
(
u
.
isVisible
).
length
).
toBe
(
1
);
expect
(
_converse
.
bookmarksview
.
list_model
.
get
(
'
toggle-state
'
)).
toBe
(
_converse
.
OPENED
);
$
(
'
#chatrooms .bookmarks-toggle
'
)[
0
]
.
click
();
expect
(
$
(
'
#chatrooms .bookmarks.rooms-list
'
).
hasClass
(
'
collapsed
'
)).
toBeTruthy
();
sizzle
(
'
#chatrooms .bookmarks-toggle
'
,
el
).
pop
()
.
click
();
expect
(
u
.
hasClass
(
'
collapsed
'
,
sizzle
(
'
#chatrooms .bookmarks.rooms-list
'
,
el
).
pop
()
)).
toBeTruthy
();
expect
(
_converse
.
bookmarksview
.
list_model
.
get
(
'
toggle-state
'
)).
toBe
(
_converse
.
CLOSED
);
$
(
'
#chatrooms .bookmarks-toggle
'
)[
0
]
.
click
();
expect
(
$
(
'
#chatrooms .bookmarks.rooms-list
'
).
hasClass
(
'
collapsed
'
)).
toBeFalsy
();
expect
(
$
(
'
#chatrooms .bookmarks.rooms-list .room-item:visible
'
).
length
).
toBe
(
1
);
sizzle
(
'
#chatrooms .bookmarks-toggle
'
,
el
).
pop
()
.
click
();
expect
(
u
.
hasClass
(
'
collapsed
'
,
sizzle
(
'
#chatrooms .bookmarks.rooms-list
'
,
el
).
pop
()
)).
toBeFalsy
();
expect
(
sizzle
(
selector
,
el
).
filter
(
u
.
isVisible
).
length
).
toBe
(
1
);
expect
(
_converse
.
bookmarksview
.
list_model
.
get
(
'
toggle-state
'
)).
toBe
(
_converse
.
OPENED
);
done
();
}));
...
...
spec/disco.js
View file @
5532a9ec
(
function
(
root
,
factory
)
{
define
([
"
jasmine
"
,
"
jquery
"
,
"
mock
"
,
"
test-utils
"
],
factory
);
}
(
this
,
function
(
jasmine
,
$
,
mock
,
test_utils
)
{
}
(
this
,
function
(
jasmine
,
mock
,
test_utils
)
{
"
use strict
"
;
var
Strophe
=
converse
.
env
.
Strophe
;
var
$iq
=
converse
.
env
.
$iq
;
var
_
=
converse
.
env
.
_
;
const
Strophe
=
converse
.
env
.
Strophe
;
const
$iq
=
converse
.
env
.
$iq
;
const
_
=
converse
.
env
.
_
;
describe
(
"
Service Discovery
"
,
function
()
{
...
...
@@ -19,8 +18,8 @@
null
,
[
'
discoInitialized
'
],
{},
function
(
done
,
_converse
)
{
var
IQ_stanzas
=
_converse
.
connection
.
IQ_stanzas
;
var
IQ_ids
=
_converse
.
connection
.
IQ_ids
;
const
IQ_stanzas
=
_converse
.
connection
.
IQ_stanzas
;
const
IQ_ids
=
_converse
.
connection
.
IQ_ids
;
test_utils
.
waitUntil
(
function
()
{
return
_
.
filter
(
IQ_stanzas
,
function
(
iq
)
{
return
iq
.
nodeTree
.
querySelector
(
'
iq[to="localhost"] query[xmlns="http://jabber.org/protocol/disco#info"]
'
);
...
...
spec/headline.js
View file @
5532a9ec
(
function
(
root
,
factory
)
{
define
([
"
jasmine
"
,
"
jquery
"
,
"
mock
"
,
"
test-utils
"
],
factory
);
}
(
this
,
function
(
jasmine
,
$
,
mock
,
test_utils
)
{
}
(
this
,
function
(
jasmine
,
mock
,
test_utils
)
{
"
use strict
"
;
var
$msg
=
converse
.
env
.
$msg
,
_
=
converse
.
env
.
_
,
...
...
spec/minchats.js
View file @
5532a9ec
...
...
@@ -11,7 +11,7 @@
it
(
"
shows chats that have been minimized
"
,
mock
.
initConverse
(
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
async
function
(
done
,
_converse
)
{
test_utils
.
createContacts
(
_converse
,
'
current
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
...
...
@@ -21,36 +21,32 @@
_converse
.
minimized_chats
.
initToggle
();
let
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
let
chatview
;
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
)
.
then
(()
=>
{
chatview
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
expect
(
chatview
.
model
.
get
(
'
minimized
'
)).
toBeFalsy
();
expect
(
$
(
_converse
.
minimized_chats
.
el
).
is
(
'
:visible
'
)).
toBeFalsy
();
chatview
.
el
.
querySelector
(
'
.toggle-chatbox-button
'
).
click
();
expect
(
chatview
.
model
.
get
(
'
minimized
'
)).
toBeTruthy
();
expect
(
$
(
_converse
.
minimized_chats
.
el
).
is
(
'
:visible
'
)).
toBeTruthy
();
expect
(
_converse
.
minimized_chats
.
keys
().
length
).
toBe
(
1
);
expect
(
_converse
.
minimized_chats
.
keys
()[
0
]).
toBe
(
contact_jid
);
contact_jid
=
mock
.
cur_names
[
1
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
return
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
}).
then
(()
=>
{
chatview
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
expect
(
chatview
.
model
.
get
(
'
minimized
'
)).
toBeFalsy
();
chatview
.
el
.
querySelector
(
'
.toggle-chatbox-button
'
).
click
();
expect
(
chatview
.
model
.
get
(
'
minimized
'
)).
toBeTruthy
();
expect
(
$
(
_converse
.
minimized_chats
.
el
).
is
(
'
:visible
'
)).
toBeTruthy
();
expect
(
_converse
.
minimized_chats
.
keys
().
length
).
toBe
(
2
);
expect
(
_
.
includes
(
_converse
.
minimized_chats
.
keys
(),
contact_jid
)).
toBeTruthy
();
done
();
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
))
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
)
let
chatview
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
expect
(
chatview
.
model
.
get
(
'
minimized
'
)).
toBeFalsy
();
expect
(
u
.
isVisible
(
_converse
.
minimized_chats
.
el
)).
toBe
(
false
);
chatview
.
el
.
querySelector
(
'
.toggle-chatbox-button
'
).
click
();
expect
(
chatview
.
model
.
get
(
'
minimized
'
)).
toBeTruthy
();
expect
(
u
.
isVisible
(
_converse
.
minimized_chats
.
el
)).
toBe
(
true
);
expect
(
_converse
.
minimized_chats
.
keys
().
length
).
toBe
(
1
);
expect
(
_converse
.
minimized_chats
.
keys
()[
0
]).
toBe
(
contact_jid
);
contact_jid
=
mock
.
cur_names
[
1
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
chatview
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
expect
(
chatview
.
model
.
get
(
'
minimized
'
)).
toBeFalsy
();
chatview
.
el
.
querySelector
(
'
.toggle-chatbox-button
'
).
click
();
expect
(
chatview
.
model
.
get
(
'
minimized
'
)).
toBeTruthy
();
expect
(
u
.
isVisible
(
_converse
.
minimized_chats
.
el
)).
toBe
(
true
);
expect
(
_converse
.
minimized_chats
.
keys
().
length
).
toBe
(
2
);
expect
(
_
.
includes
(
_converse
.
minimized_chats
.
keys
(),
contact_jid
)).
toBeTruthy
();
done
();
}));
it
(
"
can be toggled to hide or show minimized chats
"
,
mock
.
initConverse
(
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
async
function
(
done
,
_converse
)
{
test_utils
.
createContacts
(
_converse
,
'
current
'
);
_converse
.
api
.
trigger
(
'
rosterContactsFetched
'
);
...
...
@@ -60,22 +56,19 @@
_converse
.
minimized_chats
.
initToggle
();
const
contact_jid
=
mock
.
cur_names
[
0
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
)
.
then
(()
=>
{
const
chatview
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
expect
(
u
.
isVisible
(
_converse
.
minimized_chats
.
el
)).
toBeFalsy
();
chatview
.
model
.
set
({
'
minimized
'
:
true
});
expect
(
u
.
isVisible
(
_converse
.
minimized_chats
.
el
)).
toBeTruthy
();
expect
(
_converse
.
minimized_chats
.
keys
().
length
).
toBe
(
1
);
expect
(
_converse
.
minimized_chats
.
keys
()[
0
]).
toBe
(
contact_jid
);
expect
(
u
.
isVisible
(
_converse
.
minimized_chats
.
el
.
querySelector
(
'
.minimized-chats-flyout
'
))).
toBeTruthy
();
expect
(
_converse
.
minimized_chats
.
toggleview
.
model
.
get
(
'
collapsed
'
)).
toBeFalsy
();
_converse
.
minimized_chats
.
el
.
querySelector
(
'
#toggle-minimized-chats
'
).
click
();
return
test_utils
.
waitUntil
(()
=>
u
.
isVisible
(
_converse
.
minimized_chats
.
el
.
querySelector
(
'
.minimized-chats-flyout
'
)));
}).
then
(()
=>
{
expect
(
_converse
.
minimized_chats
.
toggleview
.
model
.
get
(
'
collapsed
'
)).
toBeTruthy
();
done
();
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
))
await
test_utils
.
openChatBoxFor
(
_converse
,
contact_jid
);
const
chatview
=
_converse
.
chatboxviews
.
get
(
contact_jid
);
expect
(
u
.
isVisible
(
_converse
.
minimized_chats
.
el
)).
toBeFalsy
();
chatview
.
model
.
set
({
'
minimized
'
:
true
});
expect
(
u
.
isVisible
(
_converse
.
minimized_chats
.
el
)).
toBeTruthy
();
expect
(
_converse
.
minimized_chats
.
keys
().
length
).
toBe
(
1
);
expect
(
_converse
.
minimized_chats
.
keys
()[
0
]).
toBe
(
contact_jid
);
expect
(
u
.
isVisible
(
_converse
.
minimized_chats
.
el
.
querySelector
(
'
.minimized-chats-flyout
'
))).
toBeTruthy
();
expect
(
_converse
.
minimized_chats
.
toggleview
.
model
.
get
(
'
collapsed
'
)).
toBeFalsy
();
_converse
.
minimized_chats
.
el
.
querySelector
(
'
#toggle-minimized-chats
'
).
click
();
await
test_utils
.
waitUntil
(()
=>
u
.
isVisible
(
_converse
.
minimized_chats
.
el
.
querySelector
(
'
.minimized-chats-flyout
'
)));
expect
(
_converse
.
minimized_chats
.
toggleview
.
model
.
get
(
'
collapsed
'
)).
toBeTruthy
();
done
();
}));
it
(
"
shows the number messages received to minimized chats
"
,
...
...
spec/muc.js
View file @
5532a9ec
...
...
@@ -1231,7 +1231,7 @@
/* Server responds with the configuration form.
* See: // https://xmpp.org/extensions/xep-0045.html#example-165
*/
var
config_stanza
=
$iq
({
from
:
'
coven@chat.shakespeare.lit
'
,
const
config_stanza
=
$iq
({
from
:
'
coven@chat.shakespeare.lit
'
,
'
id
'
:
IQ_id
,
'
to
'
:
'
dummy@localhost/desktop
'
,
'
type
'
:
'
result
'
})
...
...
@@ -1712,7 +1712,7 @@
it
(
"
allows the user to invite their roster contacts to enter the groupchat
"
,
mock
.
initConverse
(
null
,
[
'
rosterGroupsFetched
'
,
'
chatBoxesFetched
'
],
{},
null
,
[
'
rosterGroupsFetched
'
,
'
chatBoxesFetched
'
],
{
'
view_mode
'
:
'
fullscreen
'
},
async
function
(
done
,
_converse
)
{
test_utils
.
createContacts
(
_converse
,
'
current
'
);
// We need roster contacts, so that we have someone to invite
...
...
spec/notification.js
View file @
5532a9ec
(
function
(
root
,
factory
)
{
define
([
"
j
query
"
,
"
j
asmine
"
,
"
mock
"
,
"
test-utils
"
],
factory
);
}
(
this
,
function
(
$
,
jasmine
,
mock
,
test_utils
)
{
define
([
"
jasmine
"
,
"
mock
"
,
"
test-utils
"
],
factory
);
}
(
this
,
function
(
jasmine
,
mock
,
test_utils
)
{
"
use strict
"
;
const
Strophe
=
converse
.
env
.
Strophe
,
_
=
converse
.
env
.
_
,
...
...
spec/protocol.js
View file @
5532a9ec
(
function
(
root
,
factory
)
{
define
([
"
jasmine
"
,
"
jquery
"
,
"
mock
"
,
"
test-utils
"
],
factory
);
}
(
this
,
function
(
jasmine
,
$
,
mock
,
test_utils
)
{
}
(
this
,
function
(
jasmine
,
mock
,
test_utils
)
{
"
use strict
"
;
const
Strophe
=
converse
.
env
.
Strophe
;
const
$iq
=
converse
.
env
.
$iq
;
...
...
@@ -212,16 +211,16 @@
expect
(
_converse
.
roster
.
updateContact
).
toHaveBeenCalled
();
// Check that the user is now properly shown as a pending
// contact in the roster.
await
test_utils
.
waitUntil
(
function
()
{
var
$header
=
$
(
'
a:contains("Pending contacts")
'
);
var
$contacts
=
$header
.
parent
().
find
(
'
li:visible
'
);
return
$
contacts
.
length
;
await
test_utils
.
waitUntil
(
()
=>
{
const
header
=
sizzle
(
'
a:contains("Pending contacts")
'
,
_converse
.
rosterview
.
el
).
pop
(
);
const
contacts
=
_
.
filter
(
header
.
parentElement
.
querySelectorAll
(
'
li
'
),
u
.
isVisible
);
return
contacts
.
length
;
},
600
);
var
$header
=
$
(
'
a:contains("Pending contacts")
'
);
var
$contacts
=
$header
.
parent
().
find
(
'
li
'
);
expect
(
$
contacts
.
length
).
toBe
(
1
);
expect
(
$contacts
.
is
(
'
:visible
'
)).
toBeTruthy
(
);
let
header
=
sizzle
(
'
a:contains("Pending contacts")
'
,
_converse
.
rosterview
.
el
).
pop
(
);
let
contacts
=
header
.
parentElement
.
querySelectorAll
(
'
li
'
);
expect
(
contacts
.
length
).
toBe
(
1
);
expect
(
u
.
isVisible
(
contacts
[
0
])).
toBe
(
true
);
spyOn
(
contact
,
"
ackSubscribe
"
).
and
.
callThrough
();
/* Here we assume the "happy path" that the contact
...
...
@@ -285,10 +284,10 @@
const
header
=
sizzle
(
'
a:contains("My contacts")
'
,
_converse
.
rosterview
.
el
);
return
sizzle
(
'
li
'
,
header
[
0
].
parentNode
).
filter
(
l
=>
u
.
isVisible
(
l
)).
length
;
},
600
);
const
header
=
sizzle
(
'
a:contains("My contacts")
'
,
_converse
.
rosterview
.
el
);
header
=
sizzle
(
'
a:contains("My contacts")
'
,
_converse
.
rosterview
.
el
);
expect
(
header
.
length
).
toBe
(
1
);
expect
(
u
.
isVisible
(
header
[
0
])).
toBeTruthy
();
con
st
con
tacts
=
header
[
0
].
parentNode
.
querySelectorAll
(
'
li
'
);
contacts
=
header
[
0
].
parentNode
.
querySelectorAll
(
'
li
'
);
expect
(
contacts
.
length
).
toBe
(
1
);
// Check that it has the right classes and text
expect
(
u
.
hasClass
(
'
to
'
,
contacts
[
0
])).
toBeTruthy
();
...
...
@@ -360,8 +359,8 @@
expect
(
_converse
.
roster
.
updateContact
).
toHaveBeenCalled
();
// The class on the contact will now have switched.
expect
(
$contacts
.
hasClass
(
'
to
'
)).
toBeFalsy
(
);
expect
(
$contacts
.
hasClass
(
'
both
'
)).
toBeTruthy
(
);
expect
(
u
.
hasClass
(
'
to
'
,
contacts
[
0
])).
toBe
(
false
);
expect
(
u
.
hasClass
(
'
both
'
,
contacts
[
0
])).
toBe
(
true
);
done
();
}));
...
...
@@ -471,11 +470,11 @@
sent_IQ
=
iq
;
IQ_id
=
sendIQ
.
bind
(
this
)(
iq
,
callback
,
errback
);
});
const
$header
=
$
(
'
a:contains("My contacts")
'
);
await
test_utils
.
waitUntil
(()
=>
$header
.
parent
().
find
(
'
li
'
).
length
);
const
header
=
sizzle
(
'
a:contains("My contacts")
'
,
_converse
.
rosterview
.
el
).
pop
(
);
await
test_utils
.
waitUntil
(()
=>
header
.
parentElement
.
querySelectorAll
(
'
li
'
).
length
);
// remove the first user
$header
.
parent
().
find
(
'
li .remove-xmpp-contact
'
).
get
(
0
).
click
();
header
.
parentElement
.
querySelector
(
'
li .remove-xmpp-contact
'
).
click
();
expect
(
window
.
confirm
).
toHaveBeenCalled
();
/* Section 8.6 Removing a Roster Item and Cancelling All
...
...
@@ -515,17 +514,18 @@
it
(
"
Receiving a subscription request
"
,
mock
.
initConverse
(
null
,
[
'
rosterGroupsFetched
'
],
{},
function
(
done
,
_converse
)
{
async
function
(
done
,
_converse
)
{
spyOn
(
_converse
.
api
,
"
trigger
"
);
test_utils
.
openControlBox
(
_converse
);
test_utils
.
createContacts
(
_converse
,
'
current
'
);
// Create some contacts so that we can test positioning
// Create some contacts so that we can test positioning
test_utils
.
createContacts
(
_converse
,
'
current
'
);
/* <presence
* from='user@example.com'
* to='contact@example.org'
* type='subscribe'/>
*/
var
stanza
=
$pres
({
const
stanza
=
$pres
({
'
to
'
:
_converse
.
bare_jid
,
'
from
'
:
'
contact@example.org
'
,
'
type
'
:
'
subscribe
'
...
...
@@ -533,19 +533,17 @@
'
xmlns
'
:
Strophe
.
NS
.
NICK
,
}).
t
(
'
Clint Contact
'
);
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
return
test_utils
.
waitUntil
(
function
()
{
var
$header
=
$
(
'
a:contains("Contact requests")
'
);
var
$contacts
=
$header
.
parent
().
find
(
'
li:visible
'
);
return
$contacts
.
length
;
},
600
).
then
(
function
()
{
expect
(
_converse
.
api
.
trigger
).
toHaveBeenCalledWith
(
'
contactRequest
'
,
jasmine
.
any
(
Object
));
var
$header
=
$
(
'
a:contains("Contact requests")
'
);
expect
(
$header
.
length
).
toBe
(
1
);
expect
(
$header
.
is
(
"
:visible
"
)).
toBeTruthy
();
var
$contacts
=
$header
.
parent
().
find
(
'
li
'
);
expect
(
$contacts
.
length
).
toBe
(
1
);
done
();
});
await
test_utils
.
waitUntil
(()
=>
{
const
header
=
sizzle
(
'
a:contains("Contact requests")
'
,
_converse
.
rosterview
.
el
).
pop
();
const
contacts
=
_
.
filter
(
header
.
parentElement
.
querySelectorAll
(
'
li
'
),
u
.
isVisible
);
return
contacts
.
length
;
},
300
);
expect
(
_converse
.
api
.
trigger
).
toHaveBeenCalledWith
(
'
contactRequest
'
,
jasmine
.
any
(
Object
));
const
header
=
sizzle
(
'
a:contains("Contact requests")
'
,
_converse
.
rosterview
.
el
).
pop
();
expect
(
u
.
isVisible
(
header
)).
toBe
(
true
);
const
contacts
=
header
.
parentElement
.
querySelectorAll
(
'
li
'
);
expect
(
contacts
.
length
).
toBe
(
1
);
done
();
}));
});
});
...
...
spec/register.js
View file @
5532a9ec
...
...
@@ -319,7 +319,7 @@
max-age="0">iVBORw0KGgoAAAANSUhEUgAAALQAAAA8BAMAAAA9AI20AAAAMFBMVEX///8AAADf39+fn59fX19/f3+/v78fHx8/Pz9PT08bGxsvLy9jY2NTU1MXFxcnJyc84bkWAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAERUlEQVRYhe1WTXMaRxDdDxY4JWpYvDinpVyxdATLin0MiRLlCHEi+7hYUcVHTSI7urhK6yr5//gn5N/4Z7inX89+CQkTcFUO6gOwS8/r7tdvesbzvoT5ROR5JJ9bB97xAK22XWAY1WznlnUr7QaAzSOsWufXQ6wH/FmO60b4D936LJr8TWRwW4SNgOsodZr8m4vZUoRt2xZ3xHXgna1FCE5+f5aWwPU//bXgg8eHjyqPp4aXJeOlwLUIt0O39zOvPWW3WfHmCCkli816FxlK0rnFGKZ484dN+eIXsw1R+G+JfjwgOpMnm+r5SxA63gS2Q8MchO1RLN8jSn4W4F5OPed2evhTthKLG3bsfjLL874XGBpWHLrU0953i/ev7JsfViHbhsWSQTunJDOppeAe0hVGokJUHBOphmjrbBlgabviJKXbIP0B//gKSBHZh2rvJnQp3wsapMFz+VsTPNhPr0Hn9N57YOjywaxFSU6S79fUF39KBDgnt6yjZOeSffk+4IXDZovbQl9E96m34EzQKMepQcbzijAGiBmDsO+LaqzqG3m3kEf+DQ2mY+vdk5c2n2Iaj5QGi6n59FHDmcuP4t8MGlRaF39P6ENyIaB2EXdpjLnQq9IgdVxfax3ilBc10u4gowX9K6BaKiZNmCC7CF/WpkJvWxN00OjuoqGYLqAnpILLE68Ymrt9M0S9hcznUJ8RykdlLalUfFaDjvA8pT2kxmsl5fuMaM6mSWUpUhDoudSucdhiZFDwphEHwsMwhEpH0jsm+/UBK2wCzFIiitalN7YjWkyIBgTNPgpDXX4rjk4UH+yPPgfK4HNZQCP/KZ0fGnrnKl8+pXl3X7FwZuwNUdwDGO+BjPUn6XaKtbkm+MJ6vtaXSnIz6wBT/m+VvZNIhz7ayabQLSeRQDmYkjt0KlmHDa555v9DzFxx+CCvCG4K3dbx6mTYtfPs1Dgdh0i3W+cl4lnnhblMKKBBA23X1Ezc3E5ZoPS5KHjPiU1rKTviYe1fTsa6e3UwXGWI4ykB8uiGqkmA6Cbf3K4JTH3LOBlbX+yPWll57LKVeH8CTEvyVPV2TXL8kPnPqtA51CaFYxOH2rJoZunSnvsSj48WiaDccl6KEgiMSarITsa+rWWBnqFloYlT1qWW2GKw9nPSbEvoVHFst967XgNQjxdA66Q6VFEUh488xfaSo7cHB52XYzA4eRlVteeT8ostWfuPea0oF6MwzlwgZE9gQI+uUV0gzK+WlpUrNI8juhhX/OyNwZnRrsDfxOqS1aDR+gC6NUPvJpvQeVZ9eiNr9aDUuddY3bLnA4tH4r/49UboznH1ia8PV/uP3WUB3dxtzj1uxfDZgbEbZx17Itwrf0Jyc8N4en+5dhivtKeYjGJ8yXgUzKvSU/uWJZmsuAYtseDku+K3zMHi4lC1h0suPmtZaEp2tm3hEV2lXwb6zu7szv6f9glF5rPGT5xR7AAAAABJRU5ErkJggg==</data>
<instructions>You need a client that supports x:data and CAPTCHA to register</instructions>
</query>
</iq`
);
</iq
>
`
);
_converse
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
expect
(
registerview
.
form_type
).
toBe
(
'
xform
'
);
expect
(
registerview
.
el
.
querySelectorAll
(
'
#converse-register input[required="required"]
'
).
length
).
toBe
(
3
);
...
...
spec/roster.js
View file @
5532a9ec
This diff is collapsed.
Click to expand it.
spec/transcripts.js
View file @
5532a9ec
(
function
(
root
,
factory
)
{
define
([
"
jquery
"
,
"
jasmine
"
,
"
converse-core
"
,
"
mock
"
,
...
...
@@ -9,7 +8,7 @@
"
transcripts
"
],
factory
);
}
(
this
,
function
(
$
,
jasmine
,
converse
,
mock
,
test_utils
,
utils
,
transcripts
)
{
}
(
this
,
function
(
jasmine
,
converse
,
mock
,
test_utils
,
utils
,
transcripts
)
{
var
Strophe
=
converse
.
env
.
Strophe
;
var
_
=
converse
.
env
.
_
;
var
IGNORED_TAGS
=
[
...
...
src/headless/dist/converse-headless.js
View file @
5532a9ec
...
...
@@ -46383,10 +46383,17 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
_converse.RoomsPanelModel = Backbone.Model.extend({
defaults: function defaults() {
return {
'muc_domain':
''
,
'muc_domain':
_converse.muc_domain
,
'nick': _converse.getDefaultMUCNickname()
};
},
setDomain(jid) {
if (!_converse.locked_muc_domain) {
this.save('muc_domain', Strophe.getDomainFromJid(jid));
}
}
});
/**
* A direct MUC invitation to join a groupchat has been received
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