added spec for .like_action link being rendered; added comments div back to stream_element for now

This commit is contained in:
danielgrippi 2011-12-18 18:30:05 -08:00 committed by Dennis Collinson
parent 7f51bc02ef
commit 31d24c60c7
4 changed files with 27 additions and 10 deletions

View file

@ -1,13 +1,11 @@
<div class="info"> <div class="info">
<% if(like) { %> <a href="#" class="like_action" rel='nofollow'>
<a href="#" class="like_action unlike" rel='nofollow'> <%= like ? "Unlike" : "Like" %>
Unlike </a>
</a>
<% } else { %>
<a href="#" class="like_action like" rel='nofollow'>
Like
</a>
<% } %>
· ·
<a href="#" class="focus_comment_textarea" rel="nofollow">
Comment
</a>
</div> </div>

View file

@ -47,6 +47,7 @@
<% } %> <% } %>
<div class="feedback"> </div> <div class="feedback"> </div>
<div class="comments"> </div>
</div> </div>
</div> </div>

View file

@ -11,11 +11,14 @@ App.Views.Post = App.Views.StreamObject.extend({
}, },
render: function() { render: function() {
// subview rendering
this.renderTemplate() this.renderTemplate()
.initializeTooltips()
.renderPostContent() .renderPostContent()
.renderFeedback()
.renderComments(); .renderComments();
//
this.initializeTooltips();
this.$(".details time").timeago(); this.$(".details time").timeago();
return this; return this;
@ -39,6 +42,14 @@ App.Views.Post = App.Views.StreamObject.extend({
return this; return this;
}, },
renderFeedback: function(){
this.$(".feedback").html(new App.Views.Feedback({
model: this.model
}).render().el);
return this;
},
removeNsfwShield: function(evt){ removeNsfwShield: function(evt){
if(evt){ evt.preventDefault(); } if(evt){ evt.preventDefault(); }

View file

@ -11,6 +11,13 @@ describe("App.views.Post", function(){
this.statusMessage = this.collection.models[0]; this.statusMessage = this.collection.models[0];
}) })
it("contains a '.like_action' link", function(){
var view = new App.Views.Post({model : this.statusMessage}).render();
var statusElement = $(view.el);
expect(statusElement.find(".like_action").html()).not.toBeNull();
})
context("NSFW", function(){ context("NSFW", function(){
it("contains a shield element", function(){ it("contains a shield element", function(){
this.statusMessage.set({text : "this is safe for work. #sfw"}); this.statusMessage.set({text : "this is safe for work. #sfw"});