refactor(pipes): use Injector instead of pipe factories for pipe instantiation
BREAKING CHANGE - Pipe factories have been removed. - PIpe names to pipe implementations are 1-to-1 instead of 1-to-* Before: class DateFormatter { transform(date, args){} } class DateFormatterFactory { supporst(obj) { return true; } create(cdRef) { return new DateFormatter(); } } new Pipes({date: [new DateFormatterFactory()]}) After class DateFormatter { transform(date, args){} } new Pipes({date: DateFormatter})
This commit is contained in:
@ -19,11 +19,6 @@ class SpyPipe extends SpyObject implements Pipe {
|
||||
noSuchMethod(m) => super.noSuchMethod(m);
|
||||
}
|
||||
|
||||
@proxy()
|
||||
class SpyPipeFactory extends SpyObject implements PipeFactory {
|
||||
noSuchMethod(m) => super.noSuchMethod(m);
|
||||
}
|
||||
|
||||
@proxy()
|
||||
class SpyDependencyProvider extends SpyObject implements DependencyProvider {
|
||||
noSuchMethod(m) => super.noSuchMethod(m);
|
||||
@ -39,3 +34,8 @@ class SpyIterableDifferFactory extends SpyObject
|
||||
implements IterableDifferFactory {
|
||||
noSuchMethod(m) => super.noSuchMethod(m);
|
||||
}
|
||||
|
||||
@proxy
|
||||
class SpyInjector extends SpyObject implements Injector {
|
||||
noSuchMethod(m) => super.noSuchMethod(m);
|
||||
}
|
||||
|
@ -22,12 +22,12 @@ export class SpyPipe extends SpyObject {
|
||||
constructor() { super(BasePipe); }
|
||||
}
|
||||
|
||||
export class SpyPipeFactory extends SpyObject {}
|
||||
|
||||
export class SpyDependencyProvider extends SpyObject {}
|
||||
|
||||
export class SpyIterableDifferFactory extends SpyObject {}
|
||||
|
||||
export class SpyInjector extends SpyObject {}
|
||||
|
||||
export class SpyChangeDetectorRef extends SpyObject {
|
||||
constructor() { super(ChangeDetectorRef); }
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ function _getAppBindings() {
|
||||
Compiler,
|
||||
CompilerCache,
|
||||
bind(ViewResolver).toClass(MockViewResolver),
|
||||
bind(Pipes).toValue(defaultPipes),
|
||||
defaultPipes,
|
||||
bind(IterableDiffers).toValue(defaultIterableDiffers),
|
||||
bind(KeyValueDiffers).toValue(defaultKeyValueDiffers),
|
||||
bind(ChangeDetection).toClass(DynamicChangeDetection),
|
||||
|
Reference in New Issue
Block a user