浏览代码

Make sure contacts added to a collapsed group header are hidden.

updates #83
JC Brand 11 年之前
父节点
当前提交
cdf0a0d279
共有 2 个文件被更改,包括 20 次插入1 次删除
  1. 4 1
      converse.js
  2. 16 0
      spec/controlbox.js

+ 4 - 1
converse.js

@@ -3291,7 +3291,10 @@
             addContact: function (contact) {
                 var view = new converse.RosterContactView({model: contact});
                 this.add(contact.get('id'), view);
-                this.positionContact(contact).render();
+                var view = this.positionContact(contact).render();
+                if (this.model.get('state') === CLOSED) {
+                    view.$el.hide();
+                }
                 this.$el.show();
             },
 

+ 16 - 0
spec/controlbox.js

@@ -364,6 +364,22 @@
                 checkHeaderToggling.apply(this, [this.rosterview.$el.find('dt.roster-group')]);
             }, converse));
 
+            it("will be hidden when appearing under a collapsed group", $.proxy(function () {
+                _addContacts();
+                this.rosterview.$el.find('dt.roster-group').find('a.group-toggle').click();
+                var name = "Max Mustermann";
+                var jid = name.replace(/ /g,'.').toLowerCase() + '@localhost';
+                converse.roster.create({
+                    ask: null,
+                    fullname: name,
+                    jid: jid,
+                    requesting: false,
+                    subscription: 'both'
+                });
+                var view = this.rosterview.get('My contacts').get(jid);
+                expect(view.$el.is(':visible')).toBe(false);
+            }, converse));
+
             it("can be added to the roster and they will be sorted alphabetically", $.proxy(function () {
                 _clearContacts();
                 var i, t;