@@ -20,7 +20,7 @@ describe('CDK drag-drop schematic', () => {
20
20
21
21
it ( 'should create drag-drop files and add them to module' , async ( ) => {
22
22
const app = await createTestApp ( runner ) ;
23
- const tree = await runner . runSchematicAsync ( 'drag-drop' , baseOptions , app ) . toPromise ( ) ;
23
+ const tree = await runner . runSchematic ( 'drag-drop' , baseOptions , app ) ;
24
24
const moduleContent = getFileContent ( tree , '/projects/material/src/app/app.module.ts' ) ;
25
25
const files = tree . files ;
26
26
@@ -35,22 +35,19 @@ describe('CDK drag-drop schematic', () => {
35
35
36
36
it ( 'should add drag-drop module' , async ( ) => {
37
37
const app = await createTestApp ( runner ) ;
38
- const tree = await runner . runSchematicAsync ( 'drag-drop' , baseOptions , app ) . toPromise ( ) ;
38
+ const tree = await runner . runSchematic ( 'drag-drop' , baseOptions , app ) ;
39
39
const moduleContent = getFileContent ( tree , '/projects/material/src/app/app.module.ts' ) ;
40
40
41
41
expect ( moduleContent ) . toContain ( 'DragDropModule' ) ;
42
42
} ) ;
43
43
44
44
describe ( 'style option' , ( ) => {
45
45
it ( 'should respect the option value' , async ( ) => {
46
- const tree = await runner
47
- . runSchematicAsync (
48
- 'drag-drop' ,
49
- { style : 'scss' , ...baseOptions } ,
50
- await createTestApp ( runner ) ,
51
- )
52
- . toPromise ( ) ;
53
-
46
+ const tree = await runner . runSchematic (
47
+ 'drag-drop' ,
48
+ { style : 'scss' , ...baseOptions } ,
49
+ await createTestApp ( runner ) ,
50
+ ) ;
54
51
expect ( tree . files ) . toContain ( '/projects/material/src/app/foo/foo.component.scss' ) ;
55
52
} ) ;
56
53
@@ -75,20 +72,17 @@ describe('CDK drag-drop schematic', () => {
75
72
} ,
76
73
} ) ,
77
74
) ;
78
- tree = await runner . runSchematicAsync ( 'drag-drop' , baseOptions , tree ) . toPromise ( ) ;
75
+ tree = await runner . runSchematic ( 'drag-drop' , baseOptions , tree ) ;
79
76
80
77
expect ( tree . files ) . toContain ( '/projects/material/src/app/foo/foo.component.scss' ) ;
81
78
} ) ;
82
79
83
80
it ( 'should not generate invalid stylesheets' , async ( ) => {
84
- const tree = await runner
85
- . runSchematicAsync (
86
- 'drag-drop' ,
87
- { style : 'styl' , ...baseOptions } ,
88
- await createTestApp ( runner ) ,
89
- )
90
- . toPromise ( ) ;
91
-
81
+ const tree = await runner . runSchematic (
82
+ 'drag-drop' ,
83
+ { style : 'styl' , ...baseOptions } ,
84
+ await createTestApp ( runner ) ,
85
+ ) ;
92
86
// In this case we expect the schematic to generate a plain "css" file because
93
87
// the component schematics are using CSS style templates which are not compatible
94
88
// with all CLI supported styles (e.g. Stylus or Sass)
@@ -104,65 +98,58 @@ describe('CDK drag-drop schematic', () => {
104
98
} ) ;
105
99
106
100
it ( 'should fall back to the @schematics/angular:component option value' , async ( ) => {
107
- const tree = await runner
108
- . runSchematicAsync ( 'drag-drop' , baseOptions , await createTestApp ( runner , { style : 'less' } ) )
109
- . toPromise ( ) ;
110
-
101
+ const tree = await runner . runSchematic (
102
+ 'drag-drop' ,
103
+ baseOptions ,
104
+ await createTestApp ( runner , { style : 'less' } ) ,
105
+ ) ;
111
106
expect ( tree . files ) . toContain ( '/projects/material/src/app/foo/foo.component.less' ) ;
112
107
} ) ;
113
108
} ) ;
114
109
115
110
describe ( 'inlineStyle option' , ( ) => {
116
111
it ( 'should respect the option value' , async ( ) => {
117
112
const app = await createTestApp ( runner ) ;
118
- const tree = await runner
119
- . runSchematicAsync ( 'drag-drop' , { inlineStyle : true , ...baseOptions } , app )
120
- . toPromise ( ) ;
121
-
113
+ const tree = await runner . runSchematic ( 'drag-drop' , { inlineStyle : true , ...baseOptions } , app ) ;
122
114
expect ( tree . files ) . not . toContain ( '/projects/material/src/app/foo/foo.component.css' ) ;
123
115
} ) ;
124
116
125
117
it ( 'should fall back to the @schematics/angular:component option value' , async ( ) => {
126
- const tree = await runner
127
- . runSchematicAsync (
128
- 'drag-drop' ,
129
- baseOptions ,
130
- await createTestApp ( runner , { inlineStyle : true } ) ,
131
- )
132
- . toPromise ( ) ;
133
-
118
+ const tree = await runner . runSchematic (
119
+ 'drag-drop' ,
120
+ baseOptions ,
121
+ await createTestApp ( runner , { inlineStyle : true } ) ,
122
+ ) ;
134
123
expect ( tree . files ) . not . toContain ( '/projects/material/src/app/foo/foo.component.css' ) ;
135
124
} ) ;
136
125
} ) ;
137
126
138
127
describe ( 'inlineTemplate option' , ( ) => {
139
128
it ( 'should respect the option value' , async ( ) => {
140
129
const app = await createTestApp ( runner ) ;
141
- const tree = await runner
142
- . runSchematicAsync ( 'drag-drop' , { inlineTemplate : true , ...baseOptions } , app )
143
- . toPromise ( ) ;
144
-
130
+ const tree = await runner . runSchematic (
131
+ 'drag-drop' ,
132
+ { inlineTemplate : true , ...baseOptions } ,
133
+ app ,
134
+ ) ;
145
135
expect ( tree . files ) . not . toContain ( '/projects/material/src/app/foo/foo.component.html' ) ;
146
136
} ) ;
147
137
148
138
it ( 'should fall back to the @schematics/angular:component option value' , async ( ) => {
149
139
const app = await createTestApp ( runner , { inlineTemplate : true } ) ;
150
- const tree = await runner . runSchematicAsync ( 'drag-drop' , baseOptions , app ) . toPromise ( ) ;
140
+ const tree = await runner . runSchematic ( 'drag-drop' , baseOptions , app ) ;
151
141
152
142
expect ( tree . files ) . not . toContain ( '/projects/material/src/app/foo/foo.component.html' ) ;
153
143
} ) ;
154
144
} ) ;
155
145
156
146
describe ( 'skipTests option' , ( ) => {
157
147
it ( 'should respect the option value' , async ( ) => {
158
- const tree = await runner
159
- . runSchematicAsync (
160
- 'drag-drop' ,
161
- { skipTests : true , ...baseOptions } ,
162
- await createTestApp ( runner ) ,
163
- )
164
- . toPromise ( ) ;
165
-
148
+ const tree = await runner . runSchematic (
149
+ 'drag-drop' ,
150
+ { skipTests : true , ...baseOptions } ,
151
+ await createTestApp ( runner ) ,
152
+ ) ;
166
153
expect ( tree . files ) . not . toContain ( '/projects/material/src/app/foo/foo.component.spec.ts' ) ;
167
154
} ) ;
168
155
@@ -187,16 +174,17 @@ describe('CDK drag-drop schematic', () => {
187
174
} ,
188
175
} ) ,
189
176
) ;
190
- tree = await runner . runSchematicAsync ( 'drag-drop' , baseOptions , tree ) . toPromise ( ) ;
177
+ tree = await runner . runSchematic ( 'drag-drop' , baseOptions , tree ) ;
191
178
192
179
expect ( tree . files ) . not . toContain ( '/projects/material/src/app/foo/foo.component.spec.ts' ) ;
193
180
} ) ;
194
181
195
182
it ( 'should fall back to the @schematics/angular:component option value' , async ( ) => {
196
- const tree = await runner
197
- . runSchematicAsync ( 'drag-drop' , baseOptions , await createTestApp ( runner , { skipTests : true } ) )
198
- . toPromise ( ) ;
199
-
183
+ const tree = await runner . runSchematic (
184
+ 'drag-drop' ,
185
+ baseOptions ,
186
+ await createTestApp ( runner , { skipTests : true } ) ,
187
+ ) ;
200
188
expect ( tree . files ) . not . toContain ( '/projects/material/src/app/foo/foo.component.spec.ts' ) ;
201
189
} ) ;
202
190
} ) ;
0 commit comments