test: improve missing-injectable migration test case in ng-update integration test (#33223)

Improves the `missing-injectable` migration test case in the
`ng_update_migrations` integration test by adding scenarios
for the recent changes that have been made to the migration.

e.g. 5557dec120

PR Close #33223
This commit is contained in:
Paul Gschwendtner 2019-10-17 12:22:44 +02:00 committed by Matias Niemelä
parent 06093559a2
commit d1323b5c8f
2 changed files with 65 additions and 4 deletions

View File

@ -1,4 +1,30 @@
import {Directive, NgModule, NgZone} from '@angular/core';
import {Component, Directive, NgModule, NgZone} from '@angular/core';
export class ComponentTypeProvider {}
export class ComponentDontNeedCase {}
export class ComponentProvider {}
export class ComponentProvider2 {}
@Component({
template: '',
viewProviders: [ComponentTypeProvider, [
{provide: ComponentDontNeedCase, useExisting: ComponentProvider}]
],
providers: [ComponentProvider2]
})
export class ProvidersTestComponent {}
export class DirectiveTypeProvider {}
export class DirectiveDontNeedCase {}
export class DirectiveProvider {}
@Directive({
selector: 'test-dir',
providers: [DirectiveTypeProvider, [
{provide: DirectiveDontNeedCase, useExisting: DirectiveProvider}]
],
})
export class ProvidersTestDirective {}
export class TypeCase {}
@ -26,6 +52,8 @@ export class DirectiveCase {}
{provide: DontNeedCase, useExisting: TypeCase},
{provide: DontNeedCase, useClass: ProviderClass},
DirectiveCase,
]
],
declarations: [ProvidersTestDirective, ProvidersTestComponent],
})
export class ProvidersTestModule {}

View File

@ -1,4 +1,35 @@
import { Directive, NgModule, NgZone, Injectable } from '@angular/core';
import { Component, Directive, NgModule, NgZone, Injectable } from '@angular/core';
@Injectable()
export class ComponentTypeProvider {}
export class ComponentDontNeedCase {}
@Injectable()
export class ComponentProvider {}
@Injectable()
export class ComponentProvider2 {}
@Component({
template: '',
viewProviders: [ComponentTypeProvider, [
{provide: ComponentDontNeedCase, useExisting: ComponentProvider}]
],
providers: [ComponentProvider2]
})
export class ProvidersTestComponent {}
@Injectable()
export class DirectiveTypeProvider {}
export class DirectiveDontNeedCase {}
@Injectable()
export class DirectiveProvider {}
@Directive({
selector: 'test-dir',
providers: [DirectiveTypeProvider, [
{provide: DirectiveDontNeedCase, useExisting: DirectiveProvider}]
],
})
export class ProvidersTestDirective {}
@Injectable()
export class TypeCase {}
@ -30,6 +61,8 @@ export class DirectiveCase {}
{provide: DontNeedCase, useExisting: TypeCase},
{provide: DontNeedCase, useClass: ProviderClass},
DirectiveCase,
]
],
declarations: [ProvidersTestDirective, ProvidersTestComponent],
})
export class ProvidersTestModule {}