Finish the test which checks that contacts can appear in more than one group

This commit is contained in:
JC Brand 2014-08-01 21:36:20 +02:00
parent 2b927f21be
commit 76a18bae0d

View File

@ -193,16 +193,24 @@
spyOn(this.rosterview, 'updateCount').andCallThrough();
converse.roster_groups = true;
converse.rosterview.render();
var groups = ['colleagues', 'friends'];
for (i=0; i<mock.cur_names.length; i++) {
this.roster.create({
jid: mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@localhost',
subscription: 'both',
ask: null,
groups: ['colleagues', 'friends'],
groups: groups,
fullname: mock.cur_names[i],
is_last: i===(mock.cur_names.length-1)
});
}
// Check that usernames appear alphabetically per group
_.each(groups, $.proxy(function (name) {
var $contacts = this.rosterview.$('dt.roster-group[data-group="'+name+'"]').nextUntil('dt', 'dd');
var names = $.map($contacts, function (o) { return $(o).text().trim(); });
expect(names).toEqual(_.clone(names).sort());
expect(names.length).toEqual(mock.cur_names.length);
}, converse));
}, converse));
}, converse));