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
6ef0536e
Commit
6ef0536e
authored
Jul 10, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some work on using es6 promises
parent
9a9eae3f
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
267 additions
and
230 deletions
+267
-230
spec/roomslist.js
spec/roomslist.js
+61
-52
src/config.js
src/config.js
+1
-1
src/converse-bookmarks.js
src/converse-bookmarks.js
+9
-5
src/converse-chatview.js
src/converse-chatview.js
+3
-2
src/converse-controlbox.js
src/converse-controlbox.js
+4
-8
src/converse-core.js
src/converse-core.js
+128
-116
src/converse-dragresize.js
src/converse-dragresize.js
+3
-4
src/converse-inverse.js
src/converse-inverse.js
+1
-2
src/converse-mam.js
src/converse-mam.js
+3
-4
src/converse-minimize.js
src/converse-minimize.js
+4
-3
src/converse-muc.js
src/converse-muc.js
+2
-1
src/converse-otr.js
src/converse-otr.js
+3
-3
src/converse-register.js
src/converse-register.js
+3
-2
src/converse-roomslist.js
src/converse-roomslist.js
+16
-13
src/converse-rosterview.js
src/converse-rosterview.js
+4
-3
src/converse-vcard.js
src/converse-vcard.js
+3
-4
src/utils.js
src/utils.js
+14
-2
tests/mock.js
tests/mock.js
+3
-2
tests/utils.js
tests/utils.js
+2
-3
No files found.
spec/roomslist.js
View file @
6ef0536e
...
...
@@ -3,6 +3,7 @@
}
(
this
,
function
(
jasmine
,
mock
,
converse
,
roomslist
,
test_utils
)
{
var
_
=
converse
.
env
.
_
;
var
$msg
=
converse
.
env
.
$msg
;
var
Promise
=
converse
.
env
.
Promise
;
describe
(
"
The converse-roomslist plugin
"
,
function
()
{
...
...
@@ -77,61 +78,69 @@
expect
(
_converse
.
chatboxes
.
length
).
toBe
(
1
);
}));
it
(
"
shows unread messages directed at the user
"
,
mock
.
initConverse
(
it
(
"
shows unread messages directed at the user
"
,
mock
.
initConverse
WithAsync
(
{
whitelisted_plugins
:
[
'
converse-roomslist
'
],
allow_bookmarks
:
false
// Makes testing easier, otherwise we
// have to mock stanza traffic.
},
function
(
_converse
)
{
var
room_jid
=
'
kitchen@conference.shakespeare.lit
'
;
test_utils
.
openAndEnterChatRoom
(
_converse
,
'
kitchen
'
,
'
conference.shakespeare.lit
'
,
'
romeo
'
);
var
view
=
_converse
.
chatboxviews
.
get
(
room_jid
);
view
.
model
.
set
({
'
minimized
'
:
true
});
var
contact_jid
=
mock
.
cur_names
[
5
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
nick
=
mock
.
chatroom_names
[
0
];
view
.
handleMUCMessage
(
$msg
({
from
:
room_jid
+
'
/
'
+
nick
,
id
:
(
new
Date
()).
getTime
(),
to
:
'
dummy@localhost
'
,
type
:
'
groupchat
'
}).
c
(
'
body
'
).
t
(
'
foo
'
).
tree
());
// If the user isn't mentioned, the counter doesn't get incremented, but the text of the room is bold
var
room_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.available-chatroom
"
);
expect
(
_
.
includes
(
room_el
.
classList
,
'
unread-msgs
'
));
// If the user is mentioned, the counter also gets updated
view
.
handleMUCMessage
(
$msg
({
from
:
room_jid
+
'
/
'
+
nick
,
id
:
(
new
Date
()).
getTime
(),
to
:
'
dummy@localhost
'
,
type
:
'
groupchat
'
}).
c
(
'
body
'
).
t
(
'
romeo: Your attention is required
'
).
tree
()
);
var
indicator_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.msgs-indicator
"
);
expect
(
indicator_el
.
textContent
).
toBe
(
'
1
'
);
view
.
handleMUCMessage
(
$msg
({
from
:
room_jid
+
'
/
'
+
nick
,
id
:
(
new
Date
()).
getTime
(),
to
:
'
dummy@localhost
'
,
type
:
'
groupchat
'
}).
c
(
'
body
'
).
t
(
'
romeo: and another thing...
'
).
tree
()
);
indicator_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.msgs-indicator
"
);
expect
(
indicator_el
.
textContent
).
toBe
(
'
2
'
);
// When the chat gets maximized again, the unread indicators are removed
view
.
model
.
set
({
'
minimized
'
:
false
});
indicator_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.msgs-indicator
"
);
expect
(
_
.
isNull
(
indicator_el
));
room_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.available-chatroom
"
);
expect
(
_
.
includes
(
room_el
.
classList
,
'
unread-msgs
'
)).
toBeFalsy
();
},
function
(
done
,
_converse
)
{
test_utils
.
waitUntil
(
function
()
{
return
!
_
.
isUndefined
(
_converse
.
rooms_list_view
)
},
500
)
.
then
(
function
()
{
var
room_jid
=
'
kitchen@conference.shakespeare.lit
'
;
test_utils
.
openAndEnterChatRoom
(
_converse
,
'
kitchen
'
,
'
conference.shakespeare.lit
'
,
'
romeo
'
);
var
view
=
_converse
.
chatboxviews
.
get
(
room_jid
);
view
.
model
.
set
({
'
minimized
'
:
true
});
var
contact_jid
=
mock
.
cur_names
[
5
].
replace
(
/ /g
,
'
.
'
).
toLowerCase
()
+
'
@localhost
'
;
var
nick
=
mock
.
chatroom_names
[
0
];
view
.
handleMUCMessage
(
$msg
({
from
:
room_jid
+
'
/
'
+
nick
,
id
:
(
new
Date
()).
getTime
(),
to
:
'
dummy@localhost
'
,
type
:
'
groupchat
'
}).
c
(
'
body
'
).
t
(
'
foo
'
).
tree
());
// If the user isn't mentioned, the counter doesn't get incremented, but the text of the room is bold
var
room_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.available-chatroom
"
);
expect
(
_
.
includes
(
room_el
.
classList
,
'
unread-msgs
'
));
// If the user is mentioned, the counter also gets updated
view
.
handleMUCMessage
(
$msg
({
from
:
room_jid
+
'
/
'
+
nick
,
id
:
(
new
Date
()).
getTime
(),
to
:
'
dummy@localhost
'
,
type
:
'
groupchat
'
}).
c
(
'
body
'
).
t
(
'
romeo: Your attention is required
'
).
tree
()
);
var
indicator_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.msgs-indicator
"
);
expect
(
indicator_el
.
textContent
).
toBe
(
'
1
'
);
view
.
handleMUCMessage
(
$msg
({
from
:
room_jid
+
'
/
'
+
nick
,
id
:
(
new
Date
()).
getTime
(),
to
:
'
dummy@localhost
'
,
type
:
'
groupchat
'
}).
c
(
'
body
'
).
t
(
'
romeo: and another thing...
'
).
tree
()
);
indicator_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.msgs-indicator
"
);
expect
(
indicator_el
.
textContent
).
toBe
(
'
2
'
);
// When the chat gets maximized again, the unread indicators are removed
view
.
model
.
set
({
'
minimized
'
:
false
});
indicator_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.msgs-indicator
"
);
expect
(
_
.
isNull
(
indicator_el
));
room_el
=
_converse
.
rooms_list_view
.
el
.
querySelector
(
"
.available-chatroom
"
);
expect
(
_
.
includes
(
room_el
.
classList
,
'
unread-msgs
'
)).
toBeFalsy
();
done
();
});
}));
});
}));
src/config.js
View file @
6ef0536e
...
...
@@ -23,7 +23,7 @@ require.config({
"
backbone.browserStorage
"
:
"
node_modules/backbone.browserStorage/backbone.browserStorage
"
,
"
backbone.overview
"
:
"
node_modules/backbone.overview/backbone.overview
"
,
"
eventemitter
"
:
"
node_modules/otr/build/dep/eventemitter
"
,
"
es6-promise
"
:
"
node_modules/es6-promise/dist/es6-promise
"
,
"
es6-promise
"
:
"
node_modules/es6-promise/dist/es6-promise
.auto
"
,
"
jquery
"
:
"
node_modules/jquery/dist/jquery
"
,
"
jquery.noconflict
"
:
"
src/jquery.noconflict
"
,
"
jquery.browser
"
:
"
node_modules/jquery.browser/dist/jquery.browser
"
,
...
...
src/converse-bookmarks.js
View file @
6ef0536e
...
...
@@ -10,7 +10,8 @@
* in XEP-0048.
*/
(
function
(
root
,
factory
)
{
define
([
"
utils
"
,
define
([
"
jquery.noconflict
"
,
"
utils
"
,
"
converse-core
"
,
"
converse-muc
"
,
"
tpl!chatroom_bookmark_form
"
,
...
...
@@ -20,6 +21,7 @@
],
factory
);
}(
this
,
function
(
$
,
utils
,
converse
,
muc
,
...
...
@@ -29,8 +31,7 @@
tpl_bookmarks_list
)
{
const
$
=
converse
.
env
.
jQuery
,
{
Backbone
,
Strophe
,
$iq
,
b64_sha1
,
sizzle
,
_
}
=
converse
.
env
;
const
{
Backbone
,
Promise
,
Strophe
,
$iq
,
b64_sha1
,
sizzle
,
_
}
=
converse
.
env
;
converse
.
plugins
.
add
(
'
converse-bookmarks
'
,
{
overrides
:
{
...
...
@@ -488,8 +489,11 @@
_converse
.
emit
(
'
bookmarksInitialized
'
);
});
};
$
.
when
(
_converse
.
api
.
waitUntil
(
'
chatBoxesFetched
'
),
_converse
.
api
.
waitUntil
(
'
roomsPanelRendered
'
)).
then
(
initBookmarks
);
Promise
.
all
([
_converse
.
api
.
waitUntil
(
'
chatBoxesFetched
'
),
_converse
.
api
.
waitUntil
(
'
roomsPanelRendered
'
)
]).
then
(
initBookmarks
);
const
afterReconnection
=
function
()
{
if
(
!
_converse
.
allow_bookmarks
)
{
...
...
src/converse-chatview.js
View file @
6ef0536e
...
...
@@ -8,6 +8,7 @@
(
function
(
root
,
factory
)
{
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
tpl!chatbox
"
,
"
tpl!new_day
"
,
...
...
@@ -19,6 +20,7 @@
"
tpl!spinner
"
],
factory
);
}(
this
,
function
(
$
,
converse
,
tpl_chatbox
,
tpl_new_day
,
...
...
@@ -30,8 +32,7 @@
tpl_spinner
)
{
"
use strict
"
;
const
$
=
converse
.
env
.
jQuery
,
{
$msg
,
Backbone
,
Strophe
,
_
,
moment
,
utils
}
=
converse
.
env
;
const
{
$msg
,
Backbone
,
Strophe
,
_
,
moment
,
utils
}
=
converse
.
env
;
const
KEY
=
{
ENTER
:
13
,
...
...
src/converse-controlbox.js
View file @
6ef0536e
...
...
@@ -7,7 +7,8 @@
/*global define */
(
function
(
root
,
factory
)
{
define
([
"
converse-core
"
,
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
tpl!add_contact_dropdown
"
,
"
tpl!add_contact_form
"
,
"
tpl!change_status_message
"
,
...
...
@@ -25,6 +26,7 @@
"
converse-rosterview
"
],
factory
);
}(
this
,
function
(
$
,
converse
,
tpl_add_contact_dropdown
,
tpl_add_contact_form
,
...
...
@@ -44,13 +46,7 @@
const
USERS_PANEL_ID
=
'
users
'
;
const
CHATBOX_TYPE
=
'
chatbox
'
;
// Strophe methods for building stanzas
const
{
Strophe
}
=
converse
.
env
,
{
Backbone
}
=
converse
.
env
,
{
utils
}
=
converse
.
env
;
// Other necessary globals
const
$
=
converse
.
env
.
jQuery
,
{
_
,
fp
,
moment
}
=
converse
.
env
;
const
{
Strophe
,
Backbone
,
utils
,
_
,
fp
,
moment
}
=
converse
.
env
;
converse
.
plugins
.
add
(
'
converse-controlbox
'
,
{
...
...
src/converse-core.js
View file @
6ef0536e
This diff is collapsed.
Click to expand it.
src/converse-dragresize.js
View file @
6ef0536e
...
...
@@ -7,17 +7,16 @@
/*global define, window */
(
function
(
root
,
factory
)
{
define
([
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
tpl!dragresize
"
,
"
converse-chatview
"
,
"
converse-muc
"
,
// XXX: would like to remove this
"
converse-controlbox
"
],
factory
);
}(
this
,
function
(
converse
,
tpl_dragresize
)
{
}(
this
,
function
(
$
,
converse
,
tpl_dragresize
)
{
"
use strict
"
;
const
$
=
converse
.
env
.
jQuery
,
{
_
}
=
converse
.
env
;
const
{
_
}
=
converse
.
env
;
function
renderDragResizeHandles
(
_converse
,
view
)
{
const
flyout
=
view
.
el
.
querySelector
(
'
.box-flyout
'
);
...
...
src/converse-inverse.js
View file @
6ef0536e
...
...
@@ -16,8 +16,7 @@
],
factory
);
}(
this
,
function
(
converse
,
tpl_brand_heading
)
{
"
use strict
"
;
const
$
=
converse
.
env
.
jQuery
,
{
Strophe
,
_
}
=
converse
.
env
;
const
{
Strophe
,
_
}
=
converse
.
env
;
function
createBrandHeadingElement
()
{
const
div
=
document
.
createElement
(
'
div
'
);
...
...
src/converse-mam.js
View file @
6ef0536e
...
...
@@ -9,16 +9,15 @@
// XEP-0059 Result Set Management
(
function
(
root
,
factory
)
{
define
([
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
converse-chatview
"
,
// Could be made a soft dependency
"
converse-muc
"
,
// Could be made a soft dependency
"
strophe.rsm
"
],
factory
);
}(
this
,
function
(
converse
)
{
}(
this
,
function
(
$
,
converse
)
{
"
use strict
"
;
const
$
=
converse
.
env
.
jQuery
,
{
Strophe
,
$iq
,
_
,
moment
}
=
converse
.
env
;
const
{
Strophe
,
$iq
,
_
,
moment
}
=
converse
.
env
;
const
RSM_ATTRIBUTES
=
[
'
max
'
,
'
first
'
,
'
last
'
,
'
after
'
,
'
before
'
,
'
index
'
,
'
count
'
];
// XEP-0313 Message Archive Management
...
...
src/converse-minimize.js
View file @
6ef0536e
...
...
@@ -7,7 +7,8 @@
/*global define, window */
(
function
(
root
,
factory
)
{
define
([
"
converse-core
"
,
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
tpl!chatbox_minimize
"
,
"
tpl!toggle_chats
"
,
"
tpl!trimmed_chat
"
,
...
...
@@ -17,6 +18,7 @@
"
converse-muc
"
],
factory
);
}(
this
,
function
(
$
,
converse
,
tpl_chatbox_minimize
,
tpl_toggle_chats
,
...
...
@@ -25,8 +27,7 @@
)
{
"
use strict
"
;
const
$
=
converse
.
env
.
jQuery
,
{
_
,
utils
,
Backbone
,
b64_sha1
,
moment
}
=
converse
.
env
;
const
{
_
,
utils
,
Backbone
,
b64_sha1
,
moment
}
=
converse
.
env
;
converse
.
plugins
.
add
(
'
converse-minimize
'
,
{
overrides
:
{
...
...
src/converse-muc.js
View file @
6ef0536e
...
...
@@ -11,6 +11,7 @@
*/
(
function
(
root
,
factory
)
{
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
tpl!chatarea
"
,
"
tpl!chatroom
"
,
...
...
@@ -34,6 +35,7 @@
"
converse-chatview
"
],
factory
);
}(
this
,
function
(
$
,
converse
,
tpl_chatarea
,
tpl_chatroom
,
...
...
@@ -61,7 +63,6 @@
const
CHATROOMS_TYPE
=
'
chatroom
'
;
const
{
Strophe
,
Backbone
,
$iq
,
$build
,
$msg
,
$pres
,
b64_sha1
,
sizzle
,
utils
,
_
,
fp
,
moment
}
=
converse
.
env
;
const
$
=
converse
.
env
.
jQuery
;
// Add Strophe Namespaces
Strophe
.
addNamespace
(
'
MUC_ADMIN
'
,
Strophe
.
NS
.
MUC
+
"
#admin
"
);
...
...
src/converse-otr.js
View file @
6ef0536e
...
...
@@ -11,15 +11,15 @@
*/
(
function
(
root
,
factory
)
{
define
([
"
converse-chatview
"
,
define
([
"
jquery.noconflict
"
,
"
converse-chatview
"
,
"
tpl!toolbar_otr
"
,
'
otr
'
],
factory
);
}(
this
,
function
(
converse
,
tpl_toolbar_otr
,
otr
)
{
}(
this
,
function
(
$
,
converse
,
tpl_toolbar_otr
,
otr
)
{
"
use strict
"
;
const
{
Strophe
,
utils
,
b64_sha1
,
_
}
=
converse
.
env
;
const
$
=
converse
.
env
.
jQuery
;
const
HAS_CSPRNG
=
((
!
_
.
isUndefined
(
crypto
))
&&
((
_
.
isFunction
(
crypto
.
randomBytes
))
||
(
_
.
isFunction
(
crypto
.
getRandomValues
))
...
...
src/converse-register.js
View file @
6ef0536e
...
...
@@ -10,7 +10,8 @@
* as specified in XEP-0077.
*/
(
function
(
root
,
factory
)
{
define
([
"
converse-core
"
,
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
tpl!form_username
"
,
"
tpl!register_panel
"
,
"
tpl!register_tab
"
,
...
...
@@ -20,6 +21,7 @@
"
converse-controlbox
"
],
factory
);
}(
this
,
function
(
$
,
converse
,
tpl_form_username
,
tpl_register_panel
,
...
...
@@ -33,7 +35,6 @@
// Strophe methods for building stanzas
const
{
Strophe
,
Backbone
,
utils
,
$iq
,
_
}
=
converse
.
env
;
const
$
=
converse
.
env
.
jQuery
;
// Add Strophe Namespaces
Strophe
.
addNamespace
(
'
REGISTER
'
,
'
jabber:iq:register
'
);
...
...
src/converse-roomslist.js
View file @
6ef0536e
...
...
@@ -10,15 +10,15 @@
* rooms in the "Rooms Panel" of the ControlBox.
*/
(
function
(
root
,
factory
)
{
define
([
"
utils
"
,
define
([
"
jquery.noconflict
"
,
"
utils
"
,
"
converse-core
"
,
"
converse-muc
"
,
"
tpl!rooms_list
"
,
"
tpl!rooms_list_item
"
],
factory
);
}(
this
,
function
(
utils
,
converse
,
muc
,
tpl_rooms_list
,
tpl_rooms_list_item
)
{
const
$
=
converse
.
env
.
jQuery
,
{
Backbone
,
b64_sha1
,
sizzle
,
_
}
=
converse
.
env
;
}(
this
,
function
(
$
,
utils
,
converse
,
muc
,
tpl_rooms_list
,
tpl_rooms_list_item
)
{
const
{
Backbone
,
Promise
,
b64_sha1
,
sizzle
,
_
}
=
converse
.
env
;
converse
.
plugins
.
add
(
'
converse-roomslist
'
,
{
initialize
()
{
...
...
@@ -161,15 +161,18 @@
);
};
$
.
when
(
_converse
.
api
.
waitUntil
(
'
chatBoxesFetched
'
),
_converse
.
api
.
waitUntil
(
'
roomsPanelRendered
'
)).
then
(
function
()
{
if
(
_converse
.
allow_bookmarks
)
{
_converse
.
api
.
waitUntil
(
'
bookmarksInitialized
'
).
then
(
initRoomsListView
);
}
else
{
initRoomsListView
();
}
});
Promise
.
all
([
_converse
.
api
.
waitUntil
(
'
chatBoxesFetched
'
),
_converse
.
api
.
waitUntil
(
'
roomsPanelRendered
'
)
]).
then
(()
=>
{
if
(
_converse
.
allow_bookmarks
)
{
_converse
.
api
.
waitUntil
(
'
bookmarksInitialized
'
).
then
(
initRoomsListView
);
}
else
{
initRoomsListView
();
}
});
const
afterReconnection
=
function
()
{
if
(
_
.
isUndefined
(
_converse
.
rooms_list_view
))
{
...
...
src/converse-rosterview.js
View file @
6ef0536e
...
...
@@ -7,7 +7,8 @@
/*global define */
(
function
(
root
,
factory
)
{
define
([
"
converse-core
"
,
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
tpl!group_header
"
,
"
tpl!pending_contact
"
,
"
tpl!requesting_contact
"
,
...
...
@@ -16,6 +17,7 @@
"
tpl!roster_item
"
],
factory
);
}(
this
,
function
(
$
,
converse
,
tpl_group_header
,
tpl_pending_contact
,
...
...
@@ -24,8 +26,7 @@
tpl_roster_filter
,
tpl_roster_item
)
{
"
use strict
"
;
const
$
=
converse
.
env
.
jQuery
,
{
Backbone
,
utils
,
Strophe
,
$iq
,
b64_sha1
,
sizzle
,
_
}
=
converse
.
env
;
const
{
Backbone
,
utils
,
Strophe
,
$iq
,
b64_sha1
,
sizzle
,
_
}
=
converse
.
env
;
converse
.
plugins
.
add
(
'
converse-rosterview
'
,
{
...
...
src/converse-vcard.js
View file @
6ef0536e
...
...
@@ -7,11 +7,10 @@
/*global define */
(
function
(
root
,
factory
)
{
define
([
"
converse-core
"
,
"
strophe.vcard
"
],
factory
);
}(
this
,
function
(
converse
)
{
define
([
"
jquery.noconflict
"
,
"
converse-core
"
,
"
strophe.vcard
"
],
factory
);
}(
this
,
function
(
$
,
converse
)
{
"
use strict
"
;
const
{
Strophe
,
_
,
moment
}
=
converse
.
env
,
$
=
converse
.
env
.
jQuery
;
const
{
Strophe
,
_
,
moment
}
=
converse
.
env
;
converse
.
plugins
.
add
(
'
converse-vcard
'
,
{
...
...
src/utils.js
View file @
6ef0536e
...
...
@@ -3,6 +3,7 @@
define
([
"
jquery.noconflict
"
,
"
sizzle
"
,
"
es6-promise
"
,
"
jquery.browser
"
,
"
lodash.noconflict
"
,
"
locales
"
,
...
...
@@ -18,7 +19,9 @@
"
tpl!form_captcha
"
],
factory
);
}(
this
,
function
(
$
,
sizzle
,
dummy
,
_
,
$
,
sizzle
,
Promise
,
dummy
,
_
,
locales
,
moment
,
Strophe
,
...
...
@@ -524,7 +527,16 @@
utils
.
isPersistableModel
=
function
(
model
)
{
return
model
.
collection
&&
model
.
collection
.
browserStorage
;
}
};
utils
.
getWrappedPromise
=
function
()
{
const
wrapper
=
{};
wrapper
.
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
wrapper
.
resolve
=
resolve
;
wrapper
.
reject
=
reject
;
})
return
wrapper
;
};
utils
.
safeSave
=
function
(
model
,
attributes
)
{
if
(
utils
.
isPersistableModel
(
model
))
{
...
...
tests/mock.js
View file @
6ef0536e
(
function
(
root
,
factory
)
{
define
(
"
mock
"
,
[
'
converse
'
],
factory
);
}(
this
,
function
(
converse_api
)
{
define
(
"
mock
"
,
[
'
jquery.noconflict
'
,
'
converse
'
],
factory
);
}(
this
,
function
(
$
,
converse_api
)
{
var
_
=
converse_api
.
env
.
_
;
var
Strophe
=
converse_api
.
env
.
Strophe
;
var
$iq
=
converse_api
.
env
.
$iq
;
...
...
@@ -101,6 +101,7 @@
'
debug
'
:
false
},
settings
||
{}));
converse
.
ChatBoxViews
.
prototype
.
trimChat
=
function
()
{};
$
.
fx
.
off
=
true
;
return
converse
;
}
...
...
tests/utils.js
View file @
6ef0536e
(
function
(
root
,
factory
)
{
define
([
'
converse
'
,
'
es6-promise
'
,
'
mock
'
,
'
wait-until-promise
'
],
factory
);
}(
this
,
function
(
converse_api
,
Promise
,
mock
,
waitUntilPromise
)
{
define
([
'
jquery.noconflict
'
,
'
converse
'
,
'
es6-promise
'
,
'
mock
'
,
'
wait-until-promise
'
],
factory
);
}(
this
,
function
(
$
,
converse_api
,
Promise
,
mock
,
waitUntilPromise
)
{
var
_
=
converse_api
.
env
.
_
;
var
$
=
converse_api
.
env
.
jQuery
;
var
$msg
=
converse_api
.
env
.
$msg
;
var
$pres
=
converse_api
.
env
.
$pres
;
var
$iq
=
converse_api
.
env
.
$iq
;
...
...
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