Don't show left groups in list of all contacts

// FREEBIE
This commit is contained in:
lilia 2016-02-22 10:14:12 -08:00
parent ef9559d844
commit cc0b8e835a
2 changed files with 44 additions and 1 deletions

View file

@ -62,5 +62,44 @@ describe('ConversationSearchView', function() {
});
});
});
describe('Showing all contacts', function() {
var input = $('<input>');
var view = new Whisper.ConversationSearchView({ input: input }).render();
view.showAllContacts = true;
var convo = new Whisper.ConversationCollection().add({
id: 'a-left-group',
name: 'i left this group',
members: [],
type: 'group',
left: true
});
before(function(done) {
convo.save().then(done);
});
describe('with no messages', function() {
before(function(done) {
view.resetTypeahead();
view.typeahead_view.collection.on('reset', function() {
done();
});
});
it('should not surface left groups with no messages', function() {
assert.isUndefined(view.typeahead_view.collection.get(convo.id), 'got left group');
});
});
describe('with messages', function() {
before(function(done) {
convo.save({lastMessage: 'asdf'}).then(function() {
view.typeahead_view.collection.on('reset', function() {
done();
});
view.resetTypeahead();
});
});
it('should surface left groups with messages', function() {
assert.isDefined(view.typeahead_view.collection.get(convo.id), 'got left group');
});
});
});
});