From d56bc4d47f5421ce9b3c6b4faa67dffdcd0fbc44 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Tue, 10 May 2016 11:38:46 -0300 Subject: [PATCH] Do now show comment form when article doesn't accept comments --- src/app/article/comment/comment.html | 2 +- src/app/article/comment/comments.scss | 6 ++++++ src/app/article/comment/post-comment/post-comment.component.spec.ts | 12 +++++++++++- src/app/article/comment/post-comment/post-comment.html | 2 +- src/app/article/comment/post-comment/post-comment.scss | 1 - src/plugins/comment_paragraph/side-comments/side-comments.scss | 2 ++ 6 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 src/app/article/comment/comments.scss diff --git a/src/app/article/comment/comment.html b/src/app/article/comment/comment.html index 1f5df8a..3acfb0e 100644 --- a/src/app/article/comment/comment.html +++ b/src/app/article/comment/comment.html @@ -18,7 +18,7 @@
{{ctrl.comment.title}}
{{ctrl.comment.body}}
- + {{"comment.reply" | translate}}
diff --git a/src/app/article/comment/comments.scss b/src/app/article/comment/comments.scss new file mode 100644 index 0000000..2735bf4 --- /dev/null +++ b/src/app/article/comment/comments.scss @@ -0,0 +1,6 @@ +.comments { + border-top: 2px solid #F3F3F3; + .comments { + border-top: 0; + } +} diff --git a/src/app/article/comment/post-comment/post-comment.component.spec.ts b/src/app/article/comment/post-comment/post-comment.component.spec.ts index 7c1149a..73ed3e4 100644 --- a/src/app/article/comment/post-comment/post-comment.component.spec.ts +++ b/src/app/article/comment/post-comment/post-comment.component.spec.ts @@ -7,6 +7,8 @@ const htmlTemplate: string = ' { describe("Post Comment Component", () => { + let properties = { article: { id: 1, accept_comments: true } }; + beforeEach(angular.mock.module("templates")); let commentService = jasmine.createSpyObj("commentService", ["createInArticle"]); @@ -19,7 +21,7 @@ describe("Components", () => { @Component({ selector: 'test-container-component', directives: [PostCommentComponent], template: htmlTemplate, providers: providers }) class ContainerComponent { - article = { id: 1 }; + article = properties['article']; comment = { id: 2 }; } @@ -30,6 +32,14 @@ describe("Components", () => { }); }); + it("not render the post comment form when article doesn't accept comments", done => { + properties['article'].accept_comments = false; + helpers.createComponentFromClass(ContainerComponent).then(fixture => { + expect(fixture.debugElement.queryAll("form").length).toEqual(0); + done(); + }); + }); + it("emit an event when create comment", done => { helpers.createComponentFromClass(ContainerComponent).then(fixture => { let component: PostCommentComponent = fixture.debugElement.componentViewChildren[0].componentInstance; diff --git a/src/app/article/comment/post-comment/post-comment.html b/src/app/article/comment/post-comment/post-comment.html index 4a49a0c..152a77a 100644 --- a/src/app/article/comment/post-comment/post-comment.html +++ b/src/app/article/comment/post-comment/post-comment.html @@ -1,4 +1,4 @@ -
+
diff --git a/src/app/article/comment/post-comment/post-comment.scss b/src/app/article/comment/post-comment/post-comment.scss index 5b87166..100a690 100644 --- a/src/app/article/comment/post-comment/post-comment.scss +++ b/src/app/article/comment/post-comment/post-comment.scss @@ -1,7 +1,6 @@ .comments { .post-comment { .media { - border-top: 2px solid #F3F3F3; padding-top: 10px; .media-left { padding: 10px 0; diff --git a/src/plugins/comment_paragraph/side-comments/side-comments.scss b/src/plugins/comment_paragraph/side-comments/side-comments.scss index dcdd697..1644b50 100644 --- a/src/plugins/comment_paragraph/side-comments/side-comments.scss +++ b/src/plugins/comment_paragraph/side-comments/side-comments.scss @@ -1,5 +1,7 @@ comment-paragraph-side-comments { .comments { + min-height: 20px; + border-top: 0; .comment { margin: 0; &.media { -- libgit2 0.21.2