now you can click on an entire post to favorite / unfav it. yay. [ci skip]

This commit is contained in:
danielgrippi 2012-04-23 23:04:53 -07:00
parent 4be6f196cd
commit dbe3b48aee
3 changed files with 29 additions and 2 deletions

View file

@ -69,6 +69,7 @@ app.views.SmallFrame = app.views.Base.extend({
}, },
goToPost : function() { goToPost : function() {
if(app.page.editMode) { this.favoritePost(); return false; }
app.router.navigate(this.model.url(), true) app.router.navigate(this.model.url(), true)
} }
}); });

View file

@ -41,13 +41,18 @@
.edit-mode { .edit-mode {
#edit-controls { #edit-controls {
@include opacity(1); @include opacity(1);
//display : block;
} }
.canvas-frame .fav { .canvas-frame .fav {
@include opacity(1) @include opacity(1)
} }
.canvas-frame {
.info {
display : none
}
}
#edit-mode-toggle.control { #edit-mode-toggle.control {
@include opacity(1); @include opacity(1);
} }

View file

@ -18,4 +18,25 @@ describe("app.views.SmallFrame", function(){
describe("photos", function() { describe("photos", function() {
// ratio pending... // ratio pending...
}) })
describe("redirecting to a post", function(){
beforeEach(function(){
app.router = new app.Router()
spyOn(app.router, "navigate")
})
it("redirects", function() {
this.view.goToPost()
expect(app.router.navigate).toHaveBeenCalled()
})
it("doesn't redirect if the page is in edit mode, and instead favorites the post", function() {
app.page = {editMode : true}
spyOn(this.view, "favoritePost")
this.view.goToPost()
expect(app.router.navigate).not.toHaveBeenCalled()
expect(this.view.favoritePost).toHaveBeenCalled()
})
})
}); });