-
-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(lib): add define global injections function
- Loading branch information
Netanel Basal
committed
May 21, 2019
1 parent
6097376
commit 5456230
Showing
10 changed files
with
71 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { TestModuleMetadata } from '@angular/core/testing'; | ||
|
||
let globals: TestModuleMetadata = { | ||
providers: [], | ||
declarations: [], | ||
imports: [] | ||
}; | ||
|
||
export function defineGlobalsInjections(config: TestModuleMetadata) { | ||
globals = { ...globals, ...config }; | ||
} | ||
|
||
export function getGlobalsInjections() { | ||
return globals; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import { TranslateService } from './translate.service'; | ||
|
||
@Pipe({ | ||
name: 'translate' | ||
}) | ||
export class TranslatePipe implements PipeTransform { | ||
constructor(private translateService: TranslateService) {} | ||
|
||
transform(value: any, args?: any): any { | ||
return this.translateService.transform(value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Injectable } from '@angular/core'; | ||
|
||
@Injectable() | ||
export class TranslateService { | ||
constructor() {} | ||
|
||
transform(value: any) { | ||
return value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
import 'jest-preset-angular'; | ||
import { defineGlobalsInjections } from '../projects/spectator/src/lib/globals-injections'; | ||
import { TranslateService } from './app/translate.service'; | ||
import { TranslatePipe } from './app/translate.pipe'; | ||
|
||
defineGlobalsInjections({ | ||
providers: [TranslateService], | ||
declarations: [TranslatePipe] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters