Commit 6c262f72 authored by JC Brand's avatar JC Brand

Various small changes to reduce (non-critical) errors during testing

parent b0c20d54
......@@ -321,7 +321,10 @@
});
describe("The \"settings\" API", function() {
it("has methods 'get' and 'set' to set configuration settings", mock.initConverse(function (_converse) {
it("has methods 'get' and 'set' to set configuration settings", mock.initConverse(
{'play_sounds': true},
function (_converse) {
expect(_.keys(_converse.api.settings)).toEqual(["get", "set"]);
expect(_converse.api.settings.get("play_sounds")).toBe(true);
_converse.api.settings.set("play_sounds", false);
......
......@@ -150,7 +150,11 @@
var _converse = this.__super__._converse;
if (ev && ev.preventDefault) { ev.preventDefault(); }
// save the scroll position to restore it on maximize
this.model.save({'scroll': this.$content.scrollTop()});
if (this.model.collection && this.model.collection.browserStorage) {
this.model.save({'scroll': this.$content.scrollTop()});
} else {
this.model.set({'scroll': this.$content.scrollTop()});
}
this.setChatState(_converse.INACTIVE).model.minimize();
this.hide();
_converse.emit('chatBoxMinimized', this);
......
......@@ -548,7 +548,7 @@
*
* This is instead done in `afterConnected` below.
*/
if (this.model.collection.browserStorage) {
if (this.model.collection && this.model.collection.browserStorage) {
// Without a connection, we haven't yet initialized
// localstorage
this.model.save();
......
......@@ -90,6 +90,7 @@
var converse = converse_api.initialize(_.extend({
'i18n': 'en',
'auto_subscribe': false,
'play_sounds': false,
'bosh_service_url': 'localhost',
'connection': connection,
'animate': false,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment