Commit acf3f75b authored by JC Brand's avatar JC Brand

Test that chatboxes are stored to localStorage

parent 0f0599d5
...@@ -281,6 +281,26 @@ ...@@ -281,6 +281,26 @@
expect(this.chatboxes.length).toEqual(i+2); expect(this.chatboxes.length).toEqual(i+2);
} }
}, xmppchat)); }, xmppchat));
it("can be saved to, and retrieved from, localStorage", $.proxy(function () {
var old_chatboxes = this.chatboxes;
expect(this.chatboxes.length).toEqual(6);
this.chatboxes = new this.ChatBoxes();
expect(this.chatboxes.length).toEqual(0);
this.chatboxes.onConnected();
expect(this.chatboxes.length).toEqual(6);
// Check that the roster items retrieved from localStorage
// have the same attributes values as the original ones.
attrs = ['id', 'box_id', 'visible'];
for (i=0; i<attrs.length; i++) {
new_attrs = _.pluck(_.pluck(this.chatboxes.models, 'attributes'), attrs[i]);
old_attrs = _.pluck(_.pluck(old_chatboxes.models, 'attributes'), attrs[i]);
expect(_.isEqual(new_attrs, old_attrs)).toEqual(true);
}
this.rosterview.render();
}, xmppchat));
}, xmppchat)); }, xmppchat));
}, xmppchat)); }, xmppchat));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment