Permalink
Browse files

wrap CompositeView#children as an underscore array

  • Loading branch information...
1 parent 2d3fa34 commit f00642b4fa69dc9e6dcf70650181d77b52a8218b @nickrivadeneira nickrivadeneira committed Aug 12, 2011
Showing with 4 additions and 4 deletions.
  1. +2 −2 lib/assets/backbone-support/composite_view.js
  2. +2 −2 spec/javascripts/composite_view_spec.js
@@ -1,5 +1,5 @@
Support.CompositeView = function(options) {
- this.children = [];
+ this.children = _([]);
Backbone.View.apply(this, [options]);
};
@@ -28,7 +28,7 @@ _.extend(Support.CompositeView.prototype, Backbone.View.prototype, {
},
_leaveChildren: function() {
- _(this.children).chain().clone().each(function(view) {
+ this.children.chain().clone().each(function(view) {
if (view.leave)
view.leave();
});
@@ -121,13 +121,13 @@ describe("Support.CompositeView", function() {
expect($("#test1").size()).toEqual(1);
expect($("#test2").size()).toEqual(1);
- expect(view.children.length).toEqual(2);
+ expect(view.children.size()).toEqual(2);
childView.leave();
expect($("#test1").size()).toEqual(0);
expect($("#test2").size()).toEqual(1);
- expect(view.children.length).toEqual(1);
+ expect(view.children.size()).toEqual(1);
});
});
});

0 comments on commit f00642b

Please sign in to comment.