@@ -45,19 +45,7 @@ describe('ng-add schematic', () => {
45
45
. toContain ( filePath ) ;
46
46
}
47
47
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
-
55
48
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
-
61
49
const tree = await runner . runSchematic ( 'ng-add' , baseOptions , appTree ) ;
62
50
const packageJson = JSON . parse ( getFileContent ( tree , '/package.json' ) ) as PackageJson ;
63
51
const dependencies = packageJson . dependencies ;
@@ -68,11 +56,6 @@ describe('ng-add schematic', () => {
68
56
expect ( dependencies [ '@angular/forms' ] )
69
57
. withContext ( 'Expected the @angular/forms package to have the same version as @angular/core.' )
70
58
. 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 ) ;
76
59
77
60
expect ( Object . keys ( dependencies ) )
78
61
. withContext ( 'Expected the modified "dependencies" to be sorted alphabetically.' )
@@ -185,73 +168,6 @@ describe('ng-add schematic', () => {
185
168
) ;
186
169
} ) ;
187
170
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
-
255
171
describe ( 'custom project builders' , ( ) => {
256
172
/** Overwrites a target builder for the workspace in the given tree */
257
173
function overwriteTargetBuilder ( tree : Tree , targetName : 'build' | 'test' , newBuilder : string ) {
@@ -576,16 +492,6 @@ describe('ng-add schematic', () => {
576
492
'body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }' ,
577
493
) ;
578
494
} ) ;
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
- } ) ;
589
495
} ) ;
590
496
591
497
describe ( 'using browser-esbuild builder' , ( ) => {
@@ -646,16 +552,6 @@ describe('ng-add schematic', () => {
646
552
'body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }' ,
647
553
) ;
648
554
} ) ;
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
- } ) ;
659
555
} ) ;
660
556
661
557
describe ( 'using lower dependency builder' , ( ) => {
@@ -693,30 +589,6 @@ describe('ng-add schematic', () => {
693
589
694
590
expectProjectStyleFile ( project , '@angular/material/prebuilt-themes/azure-blue.css' ) ;
695
591
} ) ;
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
- } ) ;
720
592
} ) ;
721
593
} ) ;
722
594
0 commit comments