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
f8fcdc7e
Commit
f8fcdc7e
authored
Apr 22, 2019
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explicitly log out after each test.
parent
cf32119c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
79 deletions
+77
-79
dist/converse.js
dist/converse.js
+24
-28
src/converse-bookmarks.js
src/converse-bookmarks.js
+1
-0
src/headless/converse-core.js
src/headless/converse-core.js
+19
-22
src/headless/dist/converse-headless.js
src/headless/dist/converse-headless.js
+22
-28
tests/mock.js
tests/mock.js
+11
-1
No files found.
dist/converse.js
View file @
f8fcdc7e
...
...
@@ -32809,6 +32809,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
//# sourceMappingURL=pluggable.js.map
/***/ }),
/***/ "./node_modules/process/browser.js":
...
...
@@ -49211,6 +49212,8 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
_converse.api.listen.on('clearSession', () => {
if (!_.isUndefined(_converse.bookmarks)) {
_converse.bookmarks.reset();
_converse.bookmarks.browserStorage._clear();
window.sessionStorage.removeItem(_converse.bookmarks.fetched_flag);
...
...
@@ -64103,6 +64106,10 @@ function addPromise(promise) {
_converse.promises[promise] = _converse_headless_utils_core__WEBPACK_IMPORTED_MODULE_11__["default"].getResolveablePromise();
}
function isTestEnv() {
return _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.get(_converse.connection, 'service') === 'jasmine tests';
}
_converse.isUniView = function () {
/* We distinguish between UniView and MultiView instances.
*
...
...
@@ -64264,35 +64271,16 @@ function cleanup() {
// out or disconnecting in the previous session.
// This happens in tests. We therefore first clean up.
Backbone.history.stop();
if (_converse.chatboxviews) {
_converse.chatboxviews.closeAllChatBoxes();
}
unregisterGlobalEventHandlers();
window.localStorage.clear();
window.sessionStorage.clear();
if (_converse.bookmarks) {
_converse.bookmarks.reset();
}
delete _converse.controlboxtoggle;
if (_converse.chatboxviews) {
delete _converse.chatboxviews;
}
_converse.connection.reset();
_converse.tearDown();
_converse.stopListening();
_converse.off();
delete _converse.config;
initClientConfig();
}
_converse.initialize = async function (settings, callback) {
...
...
@@ -64514,7 +64502,7 @@ _converse.initialize = async function (settings, callback) {
'leading': true
});
this.
disconnect
= function () {
this.
finishDisconnection
= function () {
_converse.log('DISCONNECTED');
delete _converse.connection.reconnecting;
...
...
@@ -64551,10 +64539,10 @@ _converse.initialize = async function (settings, callback) {
return _converse.reconnect();
} else {
return _converse.
disconnect
();
return _converse.
finishDisconnection
();
}
} else if (_converse.disconnection_cause === _converse.LOGOUT || !_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(reason) && reason === _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.get(strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"], 'ErrorCondition.NO_AUTH_MECH') || reason === "host-unknown" || reason === "remote-connection-failed" || !_converse.auto_reconnect) {
return _converse.
disconnect
();
return _converse.
finishDisconnection
();
}
/**
* Triggered when the connection has dropped, but Converse will attempt
...
...
@@ -64719,11 +64707,13 @@ _converse.initialize = async function (settings, callback) {
};
this.clearSession = function () {
if (!_converse.config.get('trusted')) {
if (!_converse.config.get('trusted')
|| isTestEnv()
) {
window.localStorage.clear();
window.sessionStorage.clear();
} else if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(this.session) && this.session.browserStorage) {
this.session.browserStorage._clear();
} else {
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.get(_converse, 'session.browserStorage', {
'_clear': _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.noop
})._clear();
}
/**
* Triggered once the session information has been cleared,
...
...
@@ -65161,7 +65151,7 @@ _converse.initialize = async function (settings, callback) {
if (!password) {
if (this.auto_login) {
throw new Error("
initConnectio
n: If you use auto_login and " + "authentication='login' then you also need to provide a password.");
throw new Error("
autoLogi
n: If you use auto_login and " + "authentication='login' then you also need to provide a password.");
}
_converse.setDisconnectionCause(strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].Status.AUTHFAIL, undefined, true);
...
...
@@ -65223,7 +65213,7 @@ _converse.initialize = async function (settings, callback) {
this.connection = settings.connection;
}
if (
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.get(_converse.connection, 'service') === 'jasmine tests'
) {
if (
isTestEnv()
) {
finishInitialization();
return _converse;
} else if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(_i18n__WEBPACK_IMPORTED_MODULE_6__["default"])) {
...
...
@@ -65280,7 +65270,13 @@ _converse.api = {
* @memberOf _converse.api.connection
*/
'disconnect'() {
_converse.connection.disconnect();
if (_converse.connection) {
_converse.connection.disconnect();
} else {
_converse.tearDown();
_converse.clearSession();
}
}
},
src/converse-bookmarks.js
View file @
f8fcdc7e
...
...
@@ -564,6 +564,7 @@ converse.plugins.add('converse-bookmarks', {
_converse
.
api
.
listen
.
on
(
'
clearSession
'
,
()
=>
{
if
(
!
_
.
isUndefined
(
_converse
.
bookmarks
))
{
_converse
.
bookmarks
.
reset
();
_converse
.
bookmarks
.
browserStorage
.
_clear
();
window
.
sessionStorage
.
removeItem
(
_converse
.
bookmarks
.
fetched_flag
);
}
...
...
src/headless/converse-core.js
View file @
f8fcdc7e
...
...
@@ -307,6 +307,11 @@ function addPromise (promise) {
_converse
.
promises
[
promise
]
=
u
.
getResolveablePromise
();
}
function
isTestEnv
()
{
return
_
.
get
(
_converse
.
connection
,
'
service
'
)
===
'
jasmine tests
'
;
}
_converse
.
isUniView
=
function
()
{
/* We distinguish between UniView and MultiView instances.
*
...
...
@@ -463,26 +468,13 @@ function cleanup () {
// out or disconnecting in the previous session.
// This happens in tests. We therefore first clean up.
Backbone
.
history
.
stop
();
if
(
_converse
.
chatboxviews
)
{
_converse
.
chatboxviews
.
closeAllChatBoxes
();
}
unregisterGlobalEventHandlers
();
window
.
localStorage
.
clear
();
window
.
sessionStorage
.
clear
();
if
(
_converse
.
bookmarks
)
{
_converse
.
bookmarks
.
reset
();
}
delete
_converse
.
controlboxtoggle
;
if
(
_converse
.
chatboxviews
)
{
delete
_converse
.
chatboxviews
;
}
_converse
.
connection
.
reset
();
_converse
.
tearDown
();
_converse
.
stopListening
();
_converse
.
off
();
delete
_converse
.
config
;
initClientConfig
();
}
...
...
@@ -677,7 +669,7 @@ _converse.initialize = async function (settings, callback) {
_converse
.
logIn
(
null
,
true
);
},
2000
,
{
'
leading
'
:
true
});
this
.
disconnect
=
function
()
{
this
.
finishDisconnection
=
function
()
{
_converse
.
log
(
'
DISCONNECTED
'
);
delete
_converse
.
connection
.
reconnecting
;
_converse
.
connection
.
reset
();
...
...
@@ -707,14 +699,14 @@ _converse.initialize = async function (settings, callback) {
_converse
.
api
.
trigger
(
'
will-reconnect
'
);
return
_converse
.
reconnect
();
}
else
{
return
_converse
.
disconnect
();
return
_converse
.
finishDisconnection
();
}
}
else
if
(
_converse
.
disconnection_cause
===
_converse
.
LOGOUT
||
(
!
_
.
isUndefined
(
reason
)
&&
reason
===
_
.
get
(
Strophe
,
'
ErrorCondition.NO_AUTH_MECH
'
))
||
reason
===
"
host-unknown
"
||
reason
===
"
remote-connection-failed
"
||
!
_converse
.
auto_reconnect
)
{
return
_converse
.
disconnect
();
return
_converse
.
finishDisconnection
();
}
/**
* Triggered when the connection has dropped, but Converse will attempt
...
...
@@ -854,11 +846,11 @@ _converse.initialize = async function (settings, callback) {
};
this
.
clearSession
=
function
()
{
if
(
!
_converse
.
config
.
get
(
'
trusted
'
))
{
if
(
!
_converse
.
config
.
get
(
'
trusted
'
)
||
isTestEnv
()
)
{
window
.
localStorage
.
clear
();
window
.
sessionStorage
.
clear
();
}
else
if
(
!
_
.
isUndefined
(
this
.
session
)
&&
this
.
session
.
browserStorage
)
{
this
.
session
.
browserStorage
.
_clear
();
}
else
{
_
.
get
(
_converse
,
'
session.browserStorage
'
,
{
'
_clear
'
:
_
.
noop
})
.
_clear
();
}
/**
* Triggered once the session information has been cleared,
...
...
@@ -1267,7 +1259,7 @@ _converse.initialize = async function (settings, callback) {
const
password
=
_
.
isNil
(
credentials
)
?
(
_converse
.
connection
.
pass
||
this
.
password
)
:
credentials
.
password
;
if
(
!
password
)
{
if
(
this
.
auto_login
)
{
throw
new
Error
(
"
initConnectio
n: If you use auto_login and
"
+
throw
new
Error
(
"
autoLogi
n: If you use auto_login and
"
+
"
authentication='login' then you also need to provide a password.
"
);
}
_converse
.
setDisconnectionCause
(
Strophe
.
Status
.
AUTHFAIL
,
undefined
,
true
);
...
...
@@ -1320,7 +1312,7 @@ _converse.initialize = async function (settings, callback) {
this
.
connection
=
settings
.
connection
;
}
if
(
_
.
get
(
_converse
.
connection
,
'
service
'
)
===
'
jasmine tests
'
)
{
if
(
isTestEnv
()
)
{
finishInitialization
();
return
_converse
;
}
else
if
(
!
_
.
isUndefined
(
i18n
))
{
...
...
@@ -1371,7 +1363,12 @@ _converse.api = {
* @memberOf _converse.api.connection
*/
'
disconnect
'
()
{
_converse
.
connection
.
disconnect
();
if
(
_converse
.
connection
)
{
_converse
.
connection
.
disconnect
();
}
else
{
_converse
.
tearDown
();
_converse
.
clearSession
();
}
},
},
...
...
src/headless/dist/converse-headless.js
View file @
f8fcdc7e
...
...
@@ -30205,6 +30205,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
//# sourceMappingURL=pluggable.js.map
/***/ }),
/***/ "./node_modules/process/browser.js":
...
...
@@ -41946,6 +41947,10 @@ function addPromise(promise) {
_converse.promises[promise] = _converse_headless_utils_core__WEBPACK_IMPORTED_MODULE_11__["default"].getResolveablePromise();
}
function isTestEnv() {
return _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.get(_converse.connection, 'service') === 'jasmine tests';
}
_converse.isUniView = function () {
/* We distinguish between UniView and MultiView instances.
*
...
...
@@ -42107,35 +42112,16 @@ function cleanup() {
// out or disconnecting in the previous session.
// This happens in tests. We therefore first clean up.
Backbone.history.stop();
if (_converse.chatboxviews) {
_converse.chatboxviews.closeAllChatBoxes();
}
unregisterGlobalEventHandlers();
window.localStorage.clear();
window.sessionStorage.clear();
if (_converse.bookmarks) {
_converse.bookmarks.reset();
}
delete _converse.controlboxtoggle;
if (_converse.chatboxviews) {
delete _converse.chatboxviews;
}
_converse.connection.reset();
_converse.tearDown();
_converse.stopListening();
_converse.off();
delete _converse.config;
initClientConfig();
}
_converse.initialize = async function (settings, callback) {
...
...
@@ -42357,7 +42343,7 @@ _converse.initialize = async function (settings, callback) {
'leading': true
});
this.
disconnect
= function () {
this.
finishDisconnection
= function () {
_converse.log('DISCONNECTED');
delete _converse.connection.reconnecting;
...
...
@@ -42394,10 +42380,10 @@ _converse.initialize = async function (settings, callback) {
return _converse.reconnect();
} else {
return _converse.
disconnect
();
return _converse.
finishDisconnection
();
}
} else if (_converse.disconnection_cause === _converse.LOGOUT || !_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(reason) && reason === _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.get(strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"], 'ErrorCondition.NO_AUTH_MECH') || reason === "host-unknown" || reason === "remote-connection-failed" || !_converse.auto_reconnect) {
return _converse.
disconnect
();
return _converse.
finishDisconnection
();
}
/**
* Triggered when the connection has dropped, but Converse will attempt
...
...
@@ -42562,11 +42548,13 @@ _converse.initialize = async function (settings, callback) {
};
this.clearSession = function () {
if (!_converse.config.get('trusted')) {
if (!_converse.config.get('trusted')
|| isTestEnv()
) {
window.localStorage.clear();
window.sessionStorage.clear();
} else if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(this.session) && this.session.browserStorage) {
this.session.browserStorage._clear();
} else {
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.get(_converse, 'session.browserStorage', {
'_clear': _lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.noop
})._clear();
}
/**
* Triggered once the session information has been cleared,
...
...
@@ -43004,7 +42992,7 @@ _converse.initialize = async function (settings, callback) {
if (!password) {
if (this.auto_login) {
throw new Error("
initConnectio
n: If you use auto_login and " + "authentication='login' then you also need to provide a password.");
throw new Error("
autoLogi
n: If you use auto_login and " + "authentication='login' then you also need to provide a password.");
}
_converse.setDisconnectionCause(strophe_js__WEBPACK_IMPORTED_MODULE_0__["Strophe"].Status.AUTHFAIL, undefined, true);
...
...
@@ -43066,7 +43054,7 @@ _converse.initialize = async function (settings, callback) {
this.connection = settings.connection;
}
if (
_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.get(_converse.connection, 'service') === 'jasmine tests'
) {
if (
isTestEnv()
) {
finishInitialization();
return _converse;
} else if (!_lodash_noconflict__WEBPACK_IMPORTED_MODULE_4___default.a.isUndefined(_i18n__WEBPACK_IMPORTED_MODULE_6__["default"])) {
...
...
@@ -43123,7 +43111,13 @@ _converse.api = {
* @memberOf _converse.api.connection
*/
'disconnect'() {
_converse.connection.disconnect();
if (_converse.connection) {
_converse.connection.disconnect();
} else {
_converse.tearDown();
_converse.clearSession();
}
}
},
tests/mock.js
View file @
f8fcdc7e
...
...
@@ -154,6 +154,12 @@
c
.
jid
=
'
dummy@localhost/resource
'
;
c
.
_changeConnectStatus
(
Strophe
.
Status
.
CONNECTED
);
};
c
.
_proto
.
_disconnect
=
function
()
{
c
.
_onDisconnectTimeout
();
}
c
.
_proto
.
_onDisconnectTimeout
=
_
.
noop
;
return
c
;
};
}();
...
...
@@ -241,9 +247,13 @@
}
return
async
done
=>
{
const
_converse
=
await
initConverse
(
settings
,
spies
);
function
_done
()
{
_converse
.
api
.
user
.
logout
();
done
();
}
const
promises
=
_
.
map
(
promise_names
,
_converse
.
api
.
waitUntil
);
await
Promise
.
all
(
promises
);
func
(
done
,
_converse
);
func
(
_
done
,
_converse
);
}
};
return
mock
;
...
...
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