diff --git a/integration/ng_update_migrations/src/app/migration-tests/providers-test-module.ts b/integration/ng_update_migrations/src/app/migration-tests/providers-test-module.ts index 3c0e65522f..cf35d63f11 100644 --- a/integration/ng_update_migrations/src/app/migration-tests/providers-test-module.ts +++ b/integration/ng_update_migrations/src/app/migration-tests/providers-test-module.ts @@ -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 {} + diff --git a/integration/ng_update_migrations/src/app/migration-tests/providers-test-module_expected.ts b/integration/ng_update_migrations/src/app/migration-tests/providers-test-module_expected.ts index 9faa5120d1..c25fba964a 100644 --- a/integration/ng_update_migrations/src/app/migration-tests/providers-test-module_expected.ts +++ b/integration/ng_update_migrations/src/app/migration-tests/providers-test-module_expected.ts @@ -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 {} +