@@ -45,19 +45,7 @@ describe('ng-add schematic', () => {
4545 . toContain ( filePath ) ;
4646 }
4747
48- /** Removes the specified dependency from the /package.json in the given tree. */
49- function removePackageJsonDependency ( tree : Tree , dependencyName : string ) {
50- const packageContent = JSON . parse ( getFileContent ( tree , '/package.json' ) ) as PackageJson ;
51- delete packageContent . dependencies [ dependencyName ] ;
52- tree . overwrite ( '/package.json' , JSON . stringify ( packageContent , null , 2 ) ) ;
53- }
54-
5548 it ( 'should update package.json' , async ( ) => {
56- // By default, the Angular workspace schematic sets up "@angular/animations". In order
57- // to verify that we would set up the dependency properly if someone doesn't have the
58- // animations installed already, we remove the animations dependency explicitly.
59- removePackageJsonDependency ( appTree , '@angular/animations' ) ;
60-
6149 const tree = await runner . runSchematic ( 'ng-add' , baseOptions , appTree ) ;
6250 const packageJson = JSON . parse ( getFileContent ( tree , '/package.json' ) ) as PackageJson ;
6351 const dependencies = packageJson . dependencies ;
@@ -68,11 +56,6 @@ describe('ng-add schematic', () => {
6856 expect ( dependencies [ '@angular/forms' ] )
6957 . withContext ( 'Expected the @angular/forms package to have the same version as @angular/core.' )
7058 . toBe ( angularCoreVersion ) ;
71- expect ( dependencies [ '@angular/animations' ] )
72- . withContext (
73- 'Expected the @angular/animations package to have the same ' + 'version as @angular/core.' ,
74- )
75- . toBe ( angularCoreVersion ) ;
7659
7760 expect ( Object . keys ( dependencies ) )
7861 . withContext ( 'Expected the modified "dependencies" to be sorted alphabetically.' )
@@ -185,73 +168,6 @@ describe('ng-add schematic', () => {
185168 ) ;
186169 } ) ;
187170
188- it ( 'should add provideAnimationsAsync to the project module' , async ( ) => {
189- const tree = await runner . runSchematic ( 'ng-add-setup-project' , baseOptions , appTree ) ;
190- const fileContent = getFileContent ( tree , '/projects/material/src/app/app.module.ts' ) ;
191-
192- expect ( fileContent ) . toContain ( 'provideAnimationsAsync()' ) ;
193- expect ( fileContent ) . toContain (
194- `import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';` ,
195- ) ;
196- } ) ;
197-
198- it ( 'should add the provideAnimationsAsync to a bootstrapApplication call' , async ( ) => {
199- appTree . delete ( '/projects/material/src/app/app.module.ts' ) ;
200- appTree . create (
201- '/projects/material/src/app/app.config.ts' ,
202- `
203- export const appConfig = {
204- providers: [{ provide: 'foo', useValue: 1 }]
205- };
206- ` ,
207- ) ;
208- appTree . overwrite (
209- '/projects/material/src/main.ts' ,
210- `
211- import { bootstrapApplication } from '@angular/platform-browser';
212- import { AppComponent } from './app/app.component';
213- import { appConfig } from './app/app.config';
214-
215- bootstrapApplication(AppComponent, appConfig);
216- ` ,
217- ) ;
218-
219- const tree = await runner . runSchematic ( 'ng-add-setup-project' , baseOptions , appTree ) ;
220- const fileContent = getFileContent ( tree , '/projects/material/src/app/app.config.ts' ) ;
221-
222- expect ( fileContent ) . toContain (
223- `import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';` ,
224- ) ;
225- expect ( fileContent ) . toContain ( `[{ provide: 'foo', useValue: 1 }, provideAnimationsAsync()]` ) ;
226- } ) ;
227-
228- it ( "should add the provideAnimationAsync('noop') to the project module if animations are disabled" , async ( ) => {
229- const tree = await runner . runSchematic (
230- 'ng-add-setup-project' ,
231- { ...baseOptions , animations : 'disabled' } ,
232- appTree ,
233- ) ;
234- const fileContent = getFileContent ( tree , '/projects/material/src/app/app.module.ts' ) ;
235-
236- expect ( fileContent ) . toContain ( `provideAnimationsAsync('noop')` ) ;
237- expect ( fileContent ) . toContain (
238- `import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';` ,
239- ) ;
240- } ) ;
241-
242- it ( 'should not add any animations code if animations are excluded' , async ( ) => {
243- const tree = await runner . runSchematic (
244- 'ng-add-setup-project' ,
245- { ...baseOptions , animations : 'excluded' } ,
246- appTree ,
247- ) ;
248- const fileContent = getFileContent ( tree , '/projects/material/src/app/app.module.ts' ) ;
249-
250- expect ( fileContent ) . not . toContain ( 'provideAnimationsAsync' ) ;
251- expect ( fileContent ) . not . toContain ( '@angular/platform-browser/animations' ) ;
252- expect ( fileContent ) . not . toContain ( '@angular/animations' ) ;
253- } ) ;
254-
255171 describe ( 'custom project builders' , ( ) => {
256172 /** Overwrites a target builder for the workspace in the given tree */
257173 function overwriteTargetBuilder ( tree : Tree , targetName : 'build' | 'test' , newBuilder : string ) {
@@ -576,16 +492,6 @@ describe('ng-add schematic', () => {
576492 'body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }' ,
577493 ) ;
578494 } ) ;
579-
580- it ( 'should add the provideAnimationsAsync to the project module' , async ( ) => {
581- const tree = await runner . runSchematic ( 'ng-add-setup-project' , baseOptions , appTree ) ;
582- const fileContent = getFileContent ( tree , '/projects/material/src/app/app.module.ts' ) ;
583-
584- expect ( fileContent ) . toContain ( 'provideAnimationsAsync()' ) ;
585- expect ( fileContent ) . toContain (
586- `import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';` ,
587- ) ;
588- } ) ;
589495 } ) ;
590496
591497 describe ( 'using browser-esbuild builder' , ( ) => {
@@ -646,16 +552,6 @@ describe('ng-add schematic', () => {
646552 'body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }' ,
647553 ) ;
648554 } ) ;
649-
650- it ( 'should add the provideAnimationsAsync to the project module' , async ( ) => {
651- const tree = await runner . runSchematic ( 'ng-add-setup-project' , baseOptions , appTree ) ;
652- const fileContent = getFileContent ( tree , '/projects/material/src/app/app.module.ts' ) ;
653-
654- expect ( fileContent ) . toContain ( 'provideAnimationsAsync()' ) ;
655- expect ( fileContent ) . toContain (
656- `import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';` ,
657- ) ;
658- } ) ;
659555 } ) ;
660556
661557 describe ( 'using lower dependency builder' , ( ) => {
@@ -693,30 +589,6 @@ describe('ng-add schematic', () => {
693589
694590 expectProjectStyleFile ( project , '@angular/material/prebuilt-themes/azure-blue.css' ) ;
695591 } ) ;
696-
697- it ( 'should add material app styles' , async ( ) => {
698- const tree = await runner . runSchematic ( 'ng-add-setup-project' , baseOptions , appTree ) ;
699- const workspace = await getWorkspace ( tree ) ;
700- const project = getProjectFromWorkspace ( workspace , baseOptions . project ) ;
701-
702- const defaultStylesPath = getProjectStyleFile ( project ) ! ;
703- const htmlContent = tree . read ( defaultStylesPath ) ! . toString ( ) ;
704-
705- expect ( htmlContent ) . toContain ( 'html, body { height: 100%; }' ) ;
706- expect ( htmlContent ) . toContain (
707- 'body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }' ,
708- ) ;
709- } ) ;
710-
711- it ( 'should add the provideAnimationsAsync to the project module' , async ( ) => {
712- const tree = await runner . runSchematic ( 'ng-add-setup-project' , baseOptions , appTree ) ;
713- const fileContent = getFileContent ( tree , '/projects/material/src/app/app.module.ts' ) ;
714-
715- expect ( fileContent ) . toContain ( 'provideAnimationsAsync()' ) ;
716- expect ( fileContent ) . toContain (
717- `import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';` ,
718- ) ;
719- } ) ;
720592 } ) ;
721593} ) ;
722594
0 commit comments