Remember toggle state of group headers. updates #83
This commit is contained in:
parent
1810e8090e
commit
ce0096de33
|
@ -3286,9 +3286,11 @@
|
||||||
var $el = $(ev.target);
|
var $el = $(ev.target);
|
||||||
this.$el.nextUntil('dt').slideToggle();
|
this.$el.nextUntil('dt').slideToggle();
|
||||||
if ($el.hasClass("icon-opened")) {
|
if ($el.hasClass("icon-opened")) {
|
||||||
|
this.model.set({state: CLOSED});
|
||||||
$el.removeClass("icon-opened").addClass("icon-closed");
|
$el.removeClass("icon-opened").addClass("icon-closed");
|
||||||
} else {
|
} else {
|
||||||
$el.removeClass("icon-closed").addClass("icon-opened");
|
$el.removeClass("icon-closed").addClass("icon-opened");
|
||||||
|
this.model.set({state: OPENED});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@
|
||||||
|
|
||||||
describe("The Contacts Roster", $.proxy(function (mock, utils) {
|
describe("The Contacts Roster", $.proxy(function (mock, utils) {
|
||||||
|
|
||||||
describe("Roster Groups", $.proxy(function () {
|
describe("A Roster Group", $.proxy(function () {
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
converse.roster_groups = true;
|
converse.roster_groups = true;
|
||||||
|
@ -188,7 +188,7 @@
|
||||||
}, converse));
|
}, converse));
|
||||||
}, converse));
|
}, converse));
|
||||||
|
|
||||||
it("can share contacts among them (values aren't distinct)", $.proxy(function () {
|
it("can share contacts with other roster groups", $.proxy(function () {
|
||||||
_clearContacts();
|
_clearContacts();
|
||||||
var i=0, j=0, t;
|
var i=0, j=0, t;
|
||||||
spyOn(converse, 'emit');
|
spyOn(converse, 'emit');
|
||||||
|
@ -213,8 +213,36 @@
|
||||||
expect(names.length).toEqual(mock.cur_names.length);
|
expect(names.length).toEqual(mock.cur_names.length);
|
||||||
}, converse));
|
}, converse));
|
||||||
}, converse));
|
}, converse));
|
||||||
}, converse));
|
|
||||||
|
|
||||||
|
it("remembers whether it is closed or opened", $.proxy(function () {
|
||||||
|
var i=0, j=0, t;
|
||||||
|
var groups = {
|
||||||
|
'colleagues': 3,
|
||||||
|
'friends & acquaintences': 3,
|
||||||
|
'Ungrouped': 2
|
||||||
|
};
|
||||||
|
_.each(_.keys(groups), $.proxy(function (name) {
|
||||||
|
j = i;
|
||||||
|
for (i=j; i<j+groups[name]; i++) {
|
||||||
|
this.rosterview.roster.create({
|
||||||
|
jid: mock.cur_names[i].replace(/ /g,'.').toLowerCase() + '@localhost',
|
||||||
|
subscription: 'both',
|
||||||
|
ask: null,
|
||||||
|
groups: name === 'ungrouped'? [] : [name],
|
||||||
|
fullname: mock.cur_names[i],
|
||||||
|
is_last: i===(mock.cur_names.length-1)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, converse));
|
||||||
|
var view = this.rosterview.get('colleagues');
|
||||||
|
var $toggle = view.$el.find('a.group-toggle');
|
||||||
|
expect(view.model.get('state')).toBe('opened');
|
||||||
|
$toggle.click();
|
||||||
|
expect(view.model.get('state')).toBe('closed');
|
||||||
|
$toggle.click();
|
||||||
|
expect(view.model.get('state')).toBe('opened');
|
||||||
|
}, converse));
|
||||||
|
}, converse));
|
||||||
|
|
||||||
describe("Pending Contacts", $.proxy(function () {
|
describe("Pending Contacts", $.proxy(function () {
|
||||||
function _clearContacts () {
|
function _clearContacts () {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user