Commit 5633c308f087ff13cd36216056fd006a32e39298

Authored by Victor Costa
1 parent 9b46bb13
Exists in master and in 1 other branch dev-fixes

Fix tests broken by angular-translate

src/app/components/auth/auth_service.spec.ts
@@ -14,7 +14,9 @@ describe("Services", () => { @@ -14,7 +14,9 @@ describe("Services", () => {
14 let $rootScope: ng.IRootScopeService; 14 let $rootScope: ng.IRootScopeService;
15 let user: User; 15 let user: User;
16 16
17 - beforeEach(angular.mock.module("noosferoApp")); 17 + beforeEach(angular.mock.module("noosferoApp", ($translateProvider: angular.translate.ITranslateProvider) => {
  18 + $translateProvider.translations('en', {});
  19 + }));
18 20
19 beforeEach(inject((_$httpBackend_: ng.IHttpBackendService, _$rootScope_: ng.IRootScopeService, _AuthService_: AuthService) => { 21 beforeEach(inject((_$httpBackend_: ng.IHttpBackendService, _$rootScope_: ng.IRootScopeService, _AuthService_: AuthService) => {
20 $httpBackend = _$httpBackend_; 22 $httpBackend = _$httpBackend_;
@@ -77,4 +79,4 @@ describe("Services", () => { @@ -77,4 +79,4 @@ describe("Services", () => {
77 79
78 80
79 }); 81 });
80 -});  
81 \ No newline at end of file 82 \ No newline at end of file
  83 +});
src/app/components/navbar/navbar.spec.ts
@@ -72,7 +72,7 @@ describe("Components", () => { @@ -72,7 +72,7 @@ describe("Components", () => {
72 AUTH_EVENTS 72 AUTH_EVENTS
73 } 73 }
74 }) 74 })
75 - ], 75 + ].concat(helpers.provideFilters("translateFilter")),
76 directives: [Navbar], 76 directives: [Navbar],
77 template: '<acme-navbar></acme-navbar>' 77 template: '<acme-navbar></acme-navbar>'
78 }); 78 });
@@ -182,4 +182,4 @@ describe(&quot;Components&quot;, () =&gt; { @@ -182,4 +182,4 @@ describe(&quot;Components&quot;, () =&gt; {
182 182
183 183
184 }); 184 });
185 -});  
186 \ No newline at end of file 185 \ No newline at end of file
  186 +});
src/app/components/noosfero-blocks/profile-image-block/profile-image-block.component.spec.ts
@@ -10,22 +10,23 @@ const tcb = new TestComponentBuilder(); @@ -10,22 +10,23 @@ const tcb = new TestComponentBuilder();
10 const htmlTemplate: string = '<noosfero-profile-image-block [block]="ctrl.block" [owner]="ctrl.owner"></noosfero-profile-image-block>'; 10 const htmlTemplate: string = '<noosfero-profile-image-block [block]="ctrl.block" [owner]="ctrl.owner"></noosfero-profile-image-block>';
11 11
12 describe("Components", () => { 12 describe("Components", () => {
13 - 13 +
14 describe("Profile Image Block Component", () => { 14 describe("Profile Image Block Component", () => {
15 15
16 beforeEach(angular.mock.module("templates")); 16 beforeEach(angular.mock.module("templates"));
17 - 17 +
18 @Component({ 18 @Component({
19 selector: 'test-container-component', 19 selector: 'test-container-component',
20 template: htmlTemplate, 20 template: htmlTemplate,
21 - directives: [ProfileImageBlock]  
22 - }) 21 + directives: [ProfileImageBlock],
  22 + providers: helpers.provideFilters("translateFilter")
  23 + })
23 class BlockContainerComponent { 24 class BlockContainerComponent {
24 block = { type: 'Block' }; 25 block = { type: 'Block' };
25 owner = { name: 'profile-name' }; 26 owner = { name: 'profile-name' };
26 constructor() { 27 constructor() {
27 } 28 }
28 - } 29 + }
29 30
30 it("show image if present", () => { 31 it("show image if present", () => {
31 helpers.tcb.createAsync(BlockContainerComponent).then(fixture => { 32 helpers.tcb.createAsync(BlockContainerComponent).then(fixture => {
@@ -33,13 +34,13 @@ describe(&quot;Components&quot;, () =&gt; { @@ -33,13 +34,13 @@ describe(&quot;Components&quot;, () =&gt; {
33 expect(elProfile.query('div.profile-image-block').length).toEqual(1); 34 expect(elProfile.query('div.profile-image-block').length).toEqual(1);
34 }); 35 });
35 }); 36 });
36 - 37 +
37 it("has link to the profile", () => { 38 it("has link to the profile", () => {
38 helpers.tcb.createAsync(BlockContainerComponent).then(fixture => { 39 helpers.tcb.createAsync(BlockContainerComponent).then(fixture => {
39 var elProfile = fixture.debugElement.componentViewChildren[0]; 40 var elProfile = fixture.debugElement.componentViewChildren[0];
40 expect(elProfile.query('a.settings-link').length).toEqual(1); 41 expect(elProfile.query('a.settings-link').length).toEqual(1);
41 - }); 42 + });
42 }); 43 });
43 - 44 +
44 }); 45 });
45 -});  
46 \ No newline at end of file 46 \ No newline at end of file
  47 +});
src/lib/ng-noosfero-api/http/article.service.spec.ts
@@ -9,7 +9,9 @@ describe(&quot;Services&quot;, () =&gt; { @@ -9,7 +9,9 @@ describe(&quot;Services&quot;, () =&gt; {
9 let $httpBackend: ng.IHttpBackendService; 9 let $httpBackend: ng.IHttpBackendService;
10 let articleService: ArticleService; 10 let articleService: ArticleService;
11 11
12 - beforeEach(angular.mock.module("noosferoApp")); 12 + beforeEach(angular.mock.module("noosferoApp", ($translateProvider: angular.translate.ITranslateProvider) => {
  13 + $translateProvider.translations('en', {});
  14 + }));
13 15
14 beforeEach(inject((_$httpBackend_: ng.IHttpBackendService, _ArticleService_: ArticleService) => { 16 beforeEach(inject((_$httpBackend_: ng.IHttpBackendService, _ArticleService_: ArticleService) => {
15 $httpBackend = _$httpBackend_; 17 $httpBackend = _$httpBackend_;
src/lib/ng-noosfero-api/http/profile.service.spec.ts
@@ -9,7 +9,9 @@ describe(&quot;Services&quot;, () =&gt; { @@ -9,7 +9,9 @@ describe(&quot;Services&quot;, () =&gt; {
9 let profileService: ProfileService; 9 let profileService: ProfileService;
10 let $rootScope: ng.IRootScopeService; 10 let $rootScope: ng.IRootScopeService;
11 11
12 - beforeEach(angular.mock.module("noosferoApp")); 12 + beforeEach(angular.mock.module("noosferoApp", ($translateProvider: angular.translate.ITranslateProvider) => {
  13 + $translateProvider.translations('en', {});
  14 + }));
13 15
14 beforeEach(inject((_$httpBackend_: ng.IHttpBackendService, _ProfileService_: ProfileService, _$rootScope_: ng.IRootScopeService) => { 16 beforeEach(inject((_$httpBackend_: ng.IHttpBackendService, _ProfileService_: ProfileService, _$rootScope_: ng.IRootScopeService) => {
15 $httpBackend = _$httpBackend_; 17 $httpBackend = _$httpBackend_;