-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load initial comments in the SPV on pageload #7168
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,9 +116,10 @@ | |
|
||
.no-comments { text-align: center; } | ||
|
||
a { | ||
.author-name { | ||
color: $link-color; | ||
} | ||
|
||
.count { | ||
float: left; | ||
i { | ||
|
@@ -145,6 +146,14 @@ | |
padding: 10px; | ||
} | ||
|
||
.show-comments { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently this style is different from how it looks in the |
||
text-align: center; | ||
} | ||
|
||
.loading-comments { | ||
text-align: left; | ||
} | ||
|
||
.count, | ||
.interaction-avatars { | ||
line-height: 25px; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
describe("app.views.SinglePostCommentStream", function() { | ||
beforeEach(function() { | ||
this.post = factory.post(); | ||
this.post = factory.postWithInteractions(); | ||
this.view = new app.views.SinglePostCommentStream({model: this.post}); | ||
}); | ||
|
||
|
@@ -9,10 +9,91 @@ describe("app.views.SinglePostCommentStream", function() { | |
expect(this.view.CommentView).toBe(app.views.ExpandedComment); | ||
}); | ||
|
||
it("calls highlightPermalinkComment on hashchange", function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: this name is misleading. |
||
spyOn(app.views.SinglePostCommentStream.prototype, "highlightPermalinkComment"); | ||
this.view.initialize(); | ||
$(window).trigger("hashchange"); | ||
expect(app.views.SinglePostCommentStream.prototype.highlightPermalinkComment).toHaveBeenCalled(); | ||
}); | ||
|
||
it("calls setupBindings", function() { | ||
spyOn(app.views.SinglePostCommentStream.prototype, "setupBindings"); | ||
this.view.initialize(); | ||
expect(app.views.SinglePostCommentStream.prototype.setupBindings).toHaveBeenCalled(); | ||
}); | ||
}); | ||
|
||
describe("highlightPermalinkComment", function() { | ||
beforeEach(function() { | ||
this.view.render(); | ||
}); | ||
|
||
it("calls highlightComment if the comment is visible", function() { | ||
document.location.hash = "#" + this.post.comments.first().get("guid"); | ||
spyOn(this.view, "highlightComment"); | ||
this.view.highlightPermalinkComment(); | ||
expect(this.view.highlightComment).toHaveBeenCalledWith(document.location.hash); | ||
}); | ||
|
||
it("doesn't call expandComments if the comment is visible", function() { | ||
document.location.hash = "#" + this.post.comments.first().get("guid"); | ||
spyOn(this.view, "expandComments"); | ||
this.view.highlightPermalinkComment(); | ||
expect(this.view.expandComments).not.toHaveBeenCalled(); | ||
}); | ||
|
||
it("calls expandComments if the comment isn't visible yet", function() { | ||
document.location.hash = "#404-guid-not-found"; | ||
spyOn(this.view, "expandComments"); | ||
this.view.highlightPermalinkComment(); | ||
expect(this.view.expandComments).toHaveBeenCalled(); | ||
}); | ||
|
||
it("calls hightlightComment after the comments are expanded", function() { | ||
document.location.hash = "#404-guid-not-found"; | ||
spyOn(_, "defer").and.callFake(function(fn, arg) { fn(arg); }); | ||
spyOn(this.view, "highlightComment"); | ||
this.view.highlightPermalinkComment(); | ||
this.view.trigger("commentsExpanded"); | ||
expect(this.view.highlightComment).toHaveBeenCalledWith(document.location.hash); | ||
}); | ||
}); | ||
|
||
describe("highlightComment", function() { | ||
beforeEach(function() { | ||
this.view.render(); | ||
}); | ||
|
||
it("removes the existing highlighting and highlights the given comment", function() { | ||
var firstGuidSelector = "#" + this.post.comments.first().get("guid"), | ||
lastGuidSelector = "#" + this.post.comments.last().get("guid"); | ||
this.view.$(lastGuidSelector).addClass("highlighted"); | ||
this.view.highlightComment(firstGuidSelector); | ||
expect(this.view.$(lastGuidSelector)).not.toHaveClass("highlighted"); | ||
expect(this.view.$(firstGuidSelector)).toHaveClass("highlighted"); | ||
}); | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Maybe worth adding a test for scrolling as well? |
||
|
||
describe("postRenderTemplate", function() { | ||
it("calls app.views.CommentStream.prototype.postRenderTemplate", function() { | ||
spyOn(app.views.CommentStream.prototype, "postRenderTemplate"); | ||
this.view.postRenderTemplate(); | ||
expect(app.views.CommentStream.prototype.postRenderTemplate).toHaveBeenCalled(); | ||
}); | ||
|
||
it("shows the new comment form wrapper", function() { | ||
this.view.render(); | ||
this.view.$(".new-comment-form-wrapper").addClass("hidden"); | ||
expect(this.view.$(".new-comment-form-wrapper")).toHaveClass("hidden"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need to verify the effect of |
||
this.view.postRenderTemplate(); | ||
expect(this.view.$(".new-comment-form-wrapper")).not.toHaveClass("hidden"); | ||
}); | ||
|
||
it("defers a highlightPermalinkComment call", function() { | ||
spyOn(_, "defer").and.callFake(function(fn) { fn(); }); | ||
spyOn(this.view, "highlightPermalinkComment"); | ||
this.view.postRenderTemplate(); | ||
expect(this.view.highlightPermalinkComment).toHaveBeenCalled(); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You override
text-align
for SPV and and comment stream hastext-center
class by default:diaspora/app/assets/templates/comment-stream_tpl.jst.hbs
Line 9 in b3d3445
So this line is no-op here.