@@ -200,4 +200,73 @@ describe(`Update to ${version}`, () => {
200200</div>
201201` . replace ( lineBreaksAndSpaceRegex , '' ) ) ;
202202 } ) ;
203+
204+ it ( 'should insert a comment when exporter services are present in module.ts files' , async ( ) => {
205+ appTree . create ( '/testSrc/appPrefix/component/app.module.ts' ,
206+ `import { NgModule } from "@angular/core";
207+ import { FormsModule } from "@angular/forms";
208+ import { BrowserModule } from "@angular/platform-browser";
209+ import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
210+ import { AppComponent } from "./app.component";
211+ import { IgxCsvExporterService, IgxExcelExporterService } from "igniteui-angular";
212+ import { ExcelExportComponent } from "./services/export-excel/excel-export.component";
213+
214+ @NgModule({
215+ bootstrap: [AppComponent],
216+ declarations: [
217+ AppComponent,
218+ ExcelExportComponent
219+ ],
220+ imports: [
221+ BrowserModule,
222+ BrowserAnimationsModule,
223+ FormsModule
224+ ],
225+ providers: [
226+ IgxCsvExporterService,
227+ IgxExcelExporterService
228+ ],
229+ entryComponents: [],
230+ schemas: []
231+ })
232+ export class AppModule {}
233+ ` ) ;
234+
235+ const tree = await schematicRunner
236+ . runSchematicAsync ( migrationName , { } , appTree )
237+ . toPromise ( ) ;
238+
239+ expect (
240+ tree . readContent ( '/testSrc/appPrefix/component/app.module.ts' )
241+ ) . toEqual (
242+ `// IgxCsvExporterService and IgxExcelExporterService no longer need to be manually provided and can be safely removed.
243+ import { NgModule } from "@angular/core";
244+ import { FormsModule } from "@angular/forms";
245+ import { BrowserModule } from "@angular/platform-browser";
246+ import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
247+ import { AppComponent } from "./app.component";
248+ import { IgxCsvExporterService, IgxExcelExporterService } from "igniteui-angular";
249+ import { ExcelExportComponent } from "./services/export-excel/excel-export.component";
250+
251+ @NgModule({
252+ bootstrap: [AppComponent],
253+ declarations: [
254+ AppComponent,
255+ ExcelExportComponent
256+ ],
257+ imports: [
258+ BrowserModule,
259+ BrowserAnimationsModule,
260+ FormsModule
261+ ],
262+ providers: [
263+ IgxCsvExporterService,
264+ IgxExcelExporterService
265+ ],
266+ entryComponents: [],
267+ schemas: []
268+ })
269+ export class AppModule {}
270+ ` ) ;
271+ } ) ;
203272} ) ;
0 commit comments