Merge Request #56
@@ -12,6 +12,7 @@ const htmlTemplate: string = '<noosfero-activity [activity]="ctrl.activity"></no | @@ -12,6 +12,7 @@ const htmlTemplate: string = '<noosfero-activity [activity]="ctrl.activity"></no | ||
12 | describe("Components", () => { | 12 | describe("Components", () => { |
13 | 13 | ||
14 | describe("Noosfero Activity", () => { | 14 | describe("Noosfero Activity", () => { |
15 | + let activity = { name: "activity1", verb: "create_article" }; | ||
15 | 16 | ||
16 | beforeEach(angular.mock.module("templates")); | 17 | beforeEach(angular.mock.module("templates")); |
17 | 18 | ||
@@ -21,18 +22,54 @@ describe("Components", () => { | @@ -21,18 +22,54 @@ describe("Components", () => { | ||
21 | directives: [ActivityComponent], | 22 | directives: [ActivityComponent], |
22 | providers: provideFilters("truncateFilter", "stripTagsFilter", "translateFilter") | 23 | providers: provideFilters("truncateFilter", "stripTagsFilter", "translateFilter") |
23 | }) | 24 | }) |
25 | + | ||
24 | class BlockContainerComponent { | 26 | class BlockContainerComponent { |
25 | - activity = { name: "activity1", verb: "create_article" }; | 27 | + activity = activity; |
26 | } | 28 | } |
27 | 29 | ||
28 | it("render the specific template for an activity verb", done => { | 30 | it("render the specific template for an activity verb", done => { |
29 | tcb.createAsync(BlockContainerComponent).then(fixture => { | 31 | tcb.createAsync(BlockContainerComponent).then(fixture => { |
30 | let component: ActivityComponent = fixture.debugElement.componentViewChildren[0].componentInstance; | 32 | let component: ActivityComponent = fixture.debugElement.componentViewChildren[0].componentInstance; |
31 | expect(component.getActivityTemplate()).toEqual('app/profile/activities/activity/create_article.html'); | 33 | expect(component.getActivityTemplate()).toEqual('app/profile/activities/activity/create_article.html'); |
34 | + done(); | ||
35 | + }); | ||
36 | + }); | ||
37 | + | ||
38 | + it("render create article template correctly", done => { | ||
39 | + activity = { name: "activity1", verb: "create_article" }; | ||
3 |
|
||
40 | + tcb.createAsync(BlockContainerComponent).then(fixture => { | ||
41 | + let component: ActivityComponent = fixture.debugElement.componentViewChildren[0].componentInstance; | ||
32 | expect(fixture.debugElement.queryAll(".activity.create_article").length).toEqual(1); | 42 | expect(fixture.debugElement.queryAll(".activity.create_article").length).toEqual(1); |
33 | done(); | 43 | done(); |
34 | }); | 44 | }); |
35 | }); | 45 | }); |
46 | + | ||
47 | + it("render add_member_in_community template correctly", done => { | ||
1 |
|
||
48 | + activity = { name: "add_member_in_community1", verb: "add_member_in_community" }; | ||
49 | + tcb.createAsync(BlockContainerComponent).then(fixture => { | ||
50 | + let component: ActivityComponent = fixture.debugElement.componentViewChildren[0].componentInstance; | ||
51 | + expect(fixture.debugElement.queryAll(".activity.add_member_in_community").length).toEqual(1); | ||
52 | + done(); | ||
53 | + }); | ||
54 | + }); | ||
55 | + | ||
56 | + it("render new_friendship template correctly", done => { | ||
3 |
|
||
57 | + activity = { name: "new_friendship1", verb: "new_friendship" }; | ||
58 | + tcb.createAsync(BlockContainerComponent).then(fixture => { | ||
59 | + let component: ActivityComponent = fixture.debugElement.componentViewChildren[0].componentInstance; | ||
60 | + expect(fixture.debugElement.queryAll(".activity.new_friendship").length).toEqual(1); | ||
61 | + done(); | ||
62 | + }); | ||
63 | + }); | ||
64 | + | ||
65 | + it("render leave scrap template correctly", done => { | ||
66 | + activity = { name: "scrap1", verb: "leave_scrap" }; | ||
67 | + tcb.createAsync(BlockContainerComponent).then(fixture => { | ||
68 | + let component: ActivityComponent = fixture.debugElement.componentViewChildren[0].componentInstance; | ||
69 | + expect(fixture.debugElement.queryAll(".activity.leave_scrap").length).toEqual(1); | ||
70 | + done(); | ||
71 | + }); | ||
72 | + }); | ||
36 | }); | 73 | }); |
37 | 74 | ||
38 | }); | 75 | }); |
@@ -0,0 +1,17 @@ | @@ -0,0 +1,17 @@ | ||
1 | +<timeline-badge class="success"> | ||
2 | + <i class="fa fa-commenting-o"></i> | ||
3 | +</timeline-badge> | ||
4 | +<timeline-panel> | ||
5 | + <timeline-heading> | ||
6 | + <h4 class="timeline-title"> | ||
7 | + <a ui-sref="main.profile.info({profile: ctrl.activity.user.identifier})"><strong ng-bind="ctrl.activity.user.name"></strong></a> | ||
8 | + <span> {{"activities.scrap.description" | translate}} </span> | ||
9 | + </h4> | ||
10 | + <p><small class="text-muted"><i class="fa fa-clock-o"></i> <span am-time-ago="ctrl.activity.created_at | dateFormat"></span></small></p> | ||
11 | + </timeline-heading> | ||
12 | + <div class="timeline-body"> | ||
13 | + <div class="scrap"> | ||
14 | + <div ng-bind-html="ctrl.activity.content | stripTags | truncate: 100 : '...': true"></div> | ||
15 | + </div> | ||
16 | + </div> | ||
17 | +</timeline-panel> |
@@ -21,6 +21,7 @@ | @@ -21,6 +21,7 @@ | ||
21 | "profile.person.title": "Person", | 21 | "profile.person.title": "Person", |
22 | "activities.title": "Activities", | 22 | "activities.title": "Activities", |
23 | "activities.create_article.description": "has published on", | 23 | "activities.create_article.description": "has published on", |
24 | + "activities.scrap.description": "wrote in its timeline", | ||
24 | "activities.add_member_in_community.description": "has joined the community", | 25 | "activities.add_member_in_community.description": "has joined the community", |
25 | "activities.new_friendship.description": "has made {friends, plural, one{one new friend} other{# new friends}}:", | 26 | "activities.new_friendship.description": "has made {friends, plural, one{one new friend} other{# new friends}}:", |
26 | "auth.title": "Great to have you back!", | 27 | "auth.title": "Great to have you back!", |
@@ -21,6 +21,7 @@ | @@ -21,6 +21,7 @@ | ||
21 | "profile.person.title": "Pessoa", | 21 | "profile.person.title": "Pessoa", |
22 | "activities.title": "Atividades", | 22 | "activities.title": "Atividades", |
23 | "activities.create_article.description": "publicou em", | 23 | "activities.create_article.description": "publicou em", |
24 | + "activities.scrap.description": "escreveu em sua linha do tempo", | ||
24 | "activities.add_member_in_community.description": "entrou na comunidade", | 25 | "activities.add_member_in_community.description": "entrou na comunidade", |
25 | "activities.new_friendship.description": "fez {friends, plural, one{um novo amigo} other{# novos amigos}}:", | 26 | "activities.new_friendship.description": "fez {friends, plural, one{um novo amigo} other{# novos amigos}}:", |
26 | "auth.title": "Legal ter você de volta!", | 27 | "auth.title": "Legal ter você de volta!", |
-
add_member_in_community
eh um campo/método do backend? Se sim, não seria melhor que na descrição do teste tivesse uma definição do que isso significa para o negócio, ao invés do nome do campo aq? -
new_friendship
eh um campo/método do backend? Se sim, não seria melhor que na descrição do teste tivesse uma definição do que isso significa para o negócio, ao invés do nome do campo aq? -
@michel isso é somente um teste de algo que já existia e não tinha teste. Isso nem fazia parte do escopo deste MR só fiz o teste aproveitando que já estava mexendo nesta funcionalidade
-
Tranquilo. É só para nos atentarmos a isso na hora de escrever uma descrição dos testes unitários
-
@leandronunes Você não utilizou a classe
ComponentTestHelper
por que você queria sobrescrever este atributo do componente para cada teste diferente, ou teve algum outro motivo em específico? -
@mfdeveloper precisou da variavel para fazer os diferentes testes
-
@leandronunes Entendi :)
-
Added 23 new commits:
- 1e4736a4 - added events-hub service
- b3953cbd - improving adding a base interface EventsHubKnownEventNames
- 332c24ec - added changes to allow pass string[] or EventsHubKnownEventNames to EventsHubService constructor
- 328a7a82 - some small refactoring on class naming and changed to allow EVENTS_HUB_KNOW_EVEN…
- fb1e923a - Merge branch 'events-hub' into 'master'
- 3d2172f3 - Adds account register module
- bc91225e - Refactor of the account register component to uses service and restangular instead.
- 42443554 - Fixing registration - it is working now
- 503976b5 - add redirect to home in case of succeded signup
- e10ddb2a - Added notification when user is created
- 716c2a26 - Added welcome message for translation on signup
- 74b67520 - Refactory html template + new environment service property
- 64b0a116 - Added environment fields and ngMessages form validation
- 4c25e839 - Added the ng.ui.bootstrap typescript definitions
- 015b68e2 - Added the modal to show environment terms of use text
- 224b593d - Added module 'angular-password' to check password confir match
- a4dac9ec - Added unit tests and minor refactories
- b4a0a739 - Fix rebase with master adjusts
- 64000ab5 - Merge branch 'register_page' into 'master'
- 26ff5335 - Change txt navbar menuitem from 'Novo Artigo' to 'Novo post' on pt.json
- d3bba43c - Ticket #118: Profile images block
- 6596b7af - adding scrap activity in profile timeline
- e80a93b4 - change scrap timeline visualization
-
mentioned in commit de08c0f67886656d9a6a75eb73679e0e251f1554
30 | 32 | let component: ActivityComponent = fixture.debugElement.componentViewChildren[0].componentInstance; |
31 | 33 | expect(component.getActivityTemplate()).toEqual('app/profile/activities/activity/create_article.html'); |
34 | + done(); | |
35 | + }); | |
36 | + }); | |
37 | + | |
38 | + it("render create article template correctly", done => { | |
39 | + activity = { name: "activity1", verb: "create_article" }; | |
40 | + tcb.createAsync(BlockContainerComponent).then(fixture => { | |
41 | + let component: ActivityComponent = fixture.debugElement.componentViewChildren[0].componentInstance; | |
32 | 42 | expect(fixture.debugElement.queryAll(".activity.create_article").length).toEqual(1); |
33 | 43 | done(); |
34 | 44 | }); |
35 | 45 | }); |
46 | + | |
47 | + it("render add_member_in_community template correctly", done => { | |
1 |
|
41 | + let component: ActivityComponent = fixture.debugElement.componentViewChildren[0].componentInstance; | |
32 | 42 | expect(fixture.debugElement.queryAll(".activity.create_article").length).toEqual(1); |
33 | 43 | done(); |
34 | 44 | }); |
35 | 45 | }); |
46 | + | |
47 | + it("render add_member_in_community template correctly", done => { | |
48 | + activity = { name: "add_member_in_community1", verb: "add_member_in_community" }; | |
49 | + tcb.createAsync(BlockContainerComponent).then(fixture => { | |
50 | + let component: ActivityComponent = fixture.debugElement.componentViewChildren[0].componentInstance; | |
51 | + expect(fixture.debugElement.queryAll(".activity.add_member_in_community").length).toEqual(1); | |
52 | + done(); | |
53 | + }); | |
54 | + }); | |
55 | + | |
56 | + it("render new_friendship template correctly", done => { | |
3 |
|
25 | + | |
24 | 26 | class BlockContainerComponent { |
25 | - activity = { name: "activity1", verb: "create_article" }; | |
27 | + activity = activity; | |
26 | 28 | } |
27 | 29 | |
28 | 30 | it("render the specific template for an activity verb", done => { |
29 | 31 | tcb.createAsync(BlockContainerComponent).then(fixture => { |
30 | 32 | let component: ActivityComponent = fixture.debugElement.componentViewChildren[0].componentInstance; |
31 | 33 | expect(component.getActivityTemplate()).toEqual('app/profile/activities/activity/create_article.html'); |
34 | + done(); | |
35 | + }); | |
36 | + }); | |
37 | + | |
38 | + it("render create article template correctly", done => { | |
39 | + activity = { name: "activity1", verb: "create_article" }; | |
3 |
|