瀏覽代碼

Fix tests but killing zombies.

JC Brand 10 年之前
父節點
當前提交
eefce8286e
共有 2 個文件被更改,包括 13 次插入4 次删除
  1. 12 3
      converse.js
  2. 1 1
      tests/utils.js

+ 12 - 3
converse.js

@@ -1455,9 +1455,7 @@
             },
 
             minimize: function (ev) {
-                if (ev && ev.preventDefault) {
-                    ev.preventDefault();
-                }
+                if (ev && ev.preventDefault) { ev.preventDefault(); }
                 // Minimizes a chat box
                 this.model.minimize();
                 this.$el.hide('fast', converse.refreshwebkit);
@@ -4509,6 +4507,17 @@
             }
         };
 
+        this._tearDown = function () {
+            this.features.off().remove();
+            this.otr.destroy();
+            this.chatboxes.off().remove();
+            this.chatboxviews.off().remove();
+            this.controlboxtoggle.off().remove();
+            this.minimized_chats.off().remove();
+            delete this.chatboxes;
+            delete this.features;
+        };
+
         this._initialize = function () {
             this.chatboxes = new this.ChatBoxes();
             this.chatboxviews = new this.ChatBoxViews({model: this.chatboxes});

+ 1 - 1
tests/utils.js

@@ -31,8 +31,8 @@
     };
 
     utils.initConverse = function () {
+        converse._tearDown();
         converse._initialize();
-        converse.onConnected();
     };
 
     utils.initRoster = function () {