diff --git a/src/app/article/article.html b/src/app/article/article.html
index ded7a7c..1204ae1 100644
--- a/src/app/article/article.html
+++ b/src/app/article/article.html
@@ -21,5 +21,5 @@
-
+
diff --git a/src/app/article/comment/comment.component.ts b/src/app/article/comment/comment.component.ts
index 93e7386..b891cfd 100644
--- a/src/app/article/comment/comment.component.ts
+++ b/src/app/article/comment/comment.component.ts
@@ -1,7 +1,7 @@
import { Input, Component } from 'ng-forward';
@Component({
- selector: 'comment',
+ selector: 'noosfero-comment',
templateUrl: 'app/article/comment/comment.html'
})
export class CommentComponent {
diff --git a/src/app/article/comment/comment.html b/src/app/article/comment/comment.html
index b1ede6d..5bf0eaf 100644
--- a/src/app/article/comment/comment.html
+++ b/src/app/article/comment/comment.html
@@ -20,6 +20,6 @@
{{ctrl.comment.body}}
-
+
diff --git a/src/app/article/comment/comments.component.spec.ts b/src/app/article/comment/comments.component.spec.ts
new file mode 100644
index 0000000..fcf97a9
--- /dev/null
+++ b/src/app/article/comment/comments.component.spec.ts
@@ -0,0 +1,52 @@
+import {Provider, provide, Component} from 'ng-forward';
+import * as helpers from "../../../spec/helpers";
+
+import {CommentsComponent} from './comments.component';
+
+const htmlTemplate: string = '';
+
+describe("Components", () => {
+ describe("Comments Component", () => {
+
+ beforeEach(angular.mock.module("templates"));
+
+ let commentService = jasmine.createSpyObj("commentService", ["getByArticle"]);
+
+ let comments = [{ id: 2 }, { id: 3 }];
+ commentService.getByArticle = jasmine.createSpy("getByArticle")
+ .and.returnValue(helpers.mocks.promiseResultTemplate({ data: comments }));
+
+ let providers = [
+ new Provider('CommentService', { useValue: commentService }),
+ new Provider('NotificationService', { useValue: helpers.mocks.notificationService })
+ ].concat(helpers.provideFilters("translateFilter"));
+
+ @Component({ selector: 'test-container-component', directives: [CommentsComponent], template: htmlTemplate, providers: providers })
+ class ContainerComponent {
+ article = { id: 1 };
+ }
+
+ it("render comments associated to an article", done => {
+ helpers.createComponentFromClass(ContainerComponent).then(fixture => {
+ expect(fixture.debugElement.queryAll("noosfero-comment").length).toEqual(2);
+ done();
+ });
+ });
+
+ it("render a post comment tag", done => {
+ helpers.createComponentFromClass(ContainerComponent).then(fixture => {
+ expect(fixture.debugElement.queryAll("noosfero-post-comment").length).toEqual(1);
+ done();
+ });
+ });
+
+ it("update comments list when receive an event", done => {
+ helpers.createComponentFromClass(ContainerComponent).then(fixture => {
+ fixture.debugElement.getLocal("$rootScope").$emit("comment.received", {});
+ expect(fixture.debugElement.queryAll("noosfero-post-comment").length).toEqual(1);
+ done();
+ });
+ });
+
+ });
+});
diff --git a/src/app/article/comment/comments.component.ts b/src/app/article/comment/comments.component.ts
index ed5dc4c..68f2e76 100644
--- a/src/app/article/comment/comments.component.ts
+++ b/src/app/article/comment/comments.component.ts
@@ -4,7 +4,7 @@ import { CommentService } from "../../../lib/ng-noosfero-api/http/comment.servic
import { CommentComponent } from "./comment.component";
@Component({
- selector: 'comments',
+ selector: 'noosfero-comments',
templateUrl: 'app/article/comment/comments.html',
directives: [PostCommentComponent, CommentComponent]
})
diff --git a/src/app/article/comment/comments.html b/src/app/article/comment/comments.html
index ac11b1d..88dd8b2 100644
--- a/src/app/article/comment/comments.html
+++ b/src/app/article/comment/comments.html
@@ -1,7 +1,7 @@
diff --git a/src/app/article/comment/post-comment.component.ts b/src/app/article/comment/post-comment.component.ts
index 1fa5140..c940fdb 100644
--- a/src/app/article/comment/post-comment.component.ts
+++ b/src/app/article/comment/post-comment.component.ts
@@ -3,7 +3,7 @@ import { CommentService } from "../../../lib/ng-noosfero-api/http/comment.servic
import { NotificationService } from "../../shared/services/notification.service";
@Component({
- selector: 'post-comment',
+ selector: 'noosfero-post-comment',
templateUrl: 'app/article/comment/post-comment.html'
})
@Inject(CommentService, NotificationService, "$rootScope")
--
libgit2 0.21.2