2
0
Эх сурвалжийг харах

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

JC Brand 8 жил өмнө
parent
commit
6c262f7213

+ 4 - 1
spec/converse.js

@@ -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);

+ 5 - 1
src/converse-minimize.js

@@ -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);

+ 1 - 1
src/converse-muc.js

@@ -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();

+ 1 - 0
tests/mock.js

@@ -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,