Commit e389402ee7164c30774260f509bd4b5002e7f5b3
1 parent
332c24ec
some small refactoring on class naming and changed to allow EVENTS_HUB_KNOW_EVEN…
…T_NAMES to be an array of strings
Showing
3 changed files
with
14 additions
and
5 deletions
Show diff stats
src/app/known-events.ts
| @@ -2,7 +2,7 @@ import { EventsHubKnownEventNames } from './shared/services/events-hub.service'; | @@ -2,7 +2,7 @@ import { EventsHubKnownEventNames } from './shared/services/events-hub.service'; | ||
| 2 | 2 | ||
| 3 | export class NoosferoKnownEvents implements EventsHubKnownEventNames { | 3 | export class NoosferoKnownEvents implements EventsHubKnownEventNames { |
| 4 | IMAGE_PROFILE_UPDATED: string = 'IMAGE_PROFILE_UPDATED'; | 4 | IMAGE_PROFILE_UPDATED: string = 'IMAGE_PROFILE_UPDATED'; |
| 5 | - PROFILE_INFO_UPDATED: string = 'IMAGE_PROFILE_UPDATED'; | 5 | + PROFILE_INFO_UPDATED: string = 'PROFILE_INFO_UPDATED'; |
| 6 | ARTICLE_UPDATED: string = 'ARTICLE_UPDATED'; | 6 | ARTICLE_UPDATED: string = 'ARTICLE_UPDATED'; |
| 7 | 7 | ||
| 8 | constructor() { | 8 | constructor() { |
src/app/main/main.component.spec.ts
| @@ -4,8 +4,9 @@ import {TestComponentBuilder, ComponentFixture} from "ng-forward/cjs/testing/tes | @@ -4,8 +4,9 @@ import {TestComponentBuilder, ComponentFixture} from "ng-forward/cjs/testing/tes | ||
| 4 | 4 | ||
| 5 | import {quickCreateComponent} from "../../spec/helpers"; | 5 | import {quickCreateComponent} from "../../spec/helpers"; |
| 6 | import {getAngularServiceFactory} from "../../spec/helpers"; | 6 | import {getAngularServiceFactory} from "../../spec/helpers"; |
| 7 | +import { EVENTS_HUB_KNOW_EVENT_NAMES } from "../shared/services/events-hub.service"; | ||
| 7 | 8 | ||
| 8 | -describe("MainComponent", function() { | 9 | +describe("MainComponent", function () { |
| 9 | 10 | ||
| 10 | let localFixture: ComponentFixture; | 11 | let localFixture: ComponentFixture; |
| 11 | let $state: angular.ui.IStateService; | 12 | let $state: angular.ui.IStateService; |
| @@ -34,6 +35,14 @@ describe("MainComponent", function() { | @@ -34,6 +35,14 @@ describe("MainComponent", function() { | ||
| 34 | { | 35 | { |
| 35 | useValue: environmentService | 36 | useValue: environmentService |
| 36 | }), | 37 | }), |
| 38 | + provide(EVENTS_HUB_KNOW_EVENT_NAMES, | ||
| 39 | + { | ||
| 40 | + useValue: [ | ||
| 41 | + 'IMAGE_PROFILE_UPDATED', | ||
| 42 | + 'PROFILE_INFO_UPDATED', | ||
| 43 | + 'ARTICLE_UPDATED' | ||
| 44 | + ] | ||
| 45 | + }), | ||
| 37 | ] | 46 | ] |
| 38 | }) | 47 | }) |
| 39 | class MainComponentParent { | 48 | class MainComponentParent { |
| @@ -57,7 +66,7 @@ describe("MainComponent", function() { | @@ -57,7 +66,7 @@ describe("MainComponent", function() { | ||
| 57 | // navigates to the environment home | 66 | // navigates to the environment home |
| 58 | $state.go("main.environment.home"); | 67 | $state.go("main.environment.home"); |
| 59 | localFixture.detectChanges(); | 68 | localFixture.detectChanges(); |
| 60 | - // after changes were detected it checks the current $state route | 69 | + // after changes were detected it checks the current $state route |
| 61 | expect($state.current.name).toEqual("main.environment.home"); | 70 | expect($state.current.name).toEqual("main.environment.home"); |
| 62 | done(); | 71 | done(); |
| 63 | }); | 72 | }); |
src/app/main/main.component.ts
| @@ -48,7 +48,7 @@ import {SearchComponent} from "../search/search.component"; | @@ -48,7 +48,7 @@ import {SearchComponent} from "../search/search.component"; | ||
| 48 | import {SearchFormComponent} from "../search/search-form/search-form.component"; | 48 | import {SearchFormComponent} from "../search/search-form/search-form.component"; |
| 49 | 49 | ||
| 50 | import { EVENTS_HUB_KNOW_EVENT_NAMES, EventsHubService } from "../shared/services/events-hub.service"; | 50 | import { EVENTS_HUB_KNOW_EVENT_NAMES, EventsHubService } from "../shared/services/events-hub.service"; |
| 51 | -import { NoosferoEventsHubKnownEventNames } from "../events-hub-known-events"; | 51 | +import { NoosferoKnownEvents } from "../known-events"; |
| 52 | /** | 52 | /** |
| 53 | * @ngdoc controller | 53 | * @ngdoc controller |
| 54 | * @name main.MainContentComponent | 54 | * @name main.MainContentComponent |
| @@ -71,7 +71,7 @@ export class MainContentComponent { | @@ -71,7 +71,7 @@ export class MainContentComponent { | ||
| 71 | 71 | ||
| 72 | constructor( | 72 | constructor( |
| 73 | private bodyStateClassesService: BodyStateClassesService, | 73 | private bodyStateClassesService: BodyStateClassesService, |
| 74 | - eventsNames: NoosferoEventsHubKnownEventNames, | 74 | + eventsNames: NoosferoKnownEvents, |
| 75 | eventsHubService: EventsHubService | 75 | eventsHubService: EventsHubService |
| 76 | ) { | 76 | ) { |
| 77 | try { | 77 | try { |