This commit is contained in:
danielgrippi 2012-04-18 14:18:22 -07:00 committed by Dennis Collinson
parent 6d9dd1f4d3
commit f62b9f9698
4 changed files with 62 additions and 8 deletions

View file

@ -1,16 +1,34 @@
app.pages.Profile = app.views.Base.extend({ //= require ../views/small_frame
app.pages.Profile = app.views.Base.extend(_.extend(app.views.infiniteScrollMixin, {
templateName : "profile", templateName : "profile",
subviews : { // subviews : {
"#canvas" : "canvasView" // "#canvas" : "canvasView"
}, // },
initialize : function() { initialize : function() {
this.initViews() this.stream = this.model = this.model || new app.models.Stream()
this.collection = this.model.posts
this.model.fetch();
this.stream.bind("fetched", this.mason, this)
// this.initViews()
this.setupInfiniteScroll()
}, },
initViews : function() { postClass : app.views.SmallFrame,
this.canvasView = new app.views.Canvas()
mason : function() {
this.$el.isotope({
itemSelector : '.canvas-frame'
})
} }
});
// initViews : function() {
// this.canvasView = new app.views.Canvas({model : this.model})
// }
}));

View file

@ -0,0 +1,5 @@
app.views.SmallFrame = app.views.Base.extend({
templateName: "small-frame"
});

View file

@ -0,0 +1,8 @@
<div class="canvas-frame">
<div class="content">
filler
</div>
<div class="info">
{{author.name}}
</div>
</div>

View file

@ -0,0 +1,23 @@
describe("app.pages.Profile", function(){
beforeEach(function(){
this.page = new app.pages.Profile();
this.stream = this.page.stream
});
it("passes the model down to the post view", function(){
expect(this.page.canvasView.model).toBeDefined()
expect(this.page.canvasView.model).toBe(this.stream)
});
it("fetches the stream for the user", function(){
spyOn(this.stream, "fetch")
new app.pages.Profile({model : this.stream})
expect(this.stream.fetch).toHaveBeenCalled()
})
describe("rendering", function(){
beforeEach(function(){
this.page.render();
});
});
});