diff --git a/src/app/article/comment/comment.component.spec.ts b/src/app/article/comment/comment.component.spec.ts index c5bf006..4366f11 100644 --- a/src/app/article/comment/comment.component.spec.ts +++ b/src/app/article/comment/comment.component.spec.ts @@ -7,16 +7,23 @@ const htmlTemplate: string = ' { describe("Comment Component", () => { - beforeEach(angular.mock.module("templates")); + let properties: any; + beforeEach(angular.mock.module("templates")); + beforeEach(() => { + properties = { + article: { id: 1, accept_comments: true }, + comment: { title: "title", body: "body" } + }; + }); function createComponent() { let providers = helpers.provideFilters("translateFilter"); @Component({ selector: 'test-container-component', directives: [CommentComponent], template: htmlTemplate, providers: providers }) class ContainerComponent { - article = { id: 1 }; - comment = { title: "title", body: "body" }; + article = properties['article']; + comment = properties['comment']; } return helpers.createComponentFromClass(ContainerComponent); } @@ -52,5 +59,20 @@ describe("Components", () => { done(); }); }); + + it("display reply button", done => { + createComponent().then(fixture => { + expect(fixture.debugElement.queryAll(".comment .actions .reply").length).toEqual(1); + done(); + }); + }); + + it("not display reply button when accept_comments is false", done => { + properties['article']['accept_comments'] = false; + createComponent().then(fixture => { + expect(fixture.debugElement.queryAll(".comment .actions .reply").length).toEqual(0); + done(); + }); + }); }); }); diff --git a/src/app/article/comment/comment.html b/src/app/article/comment/comment.html index 3acfb0e..868285d 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}}
-- libgit2 0.21.2