@@ -17,6 +17,7 @@ var unique = require('lodash/uniq');
17
17
var forEach = require ( 'lodash/forEach' ) ;
18
18
var any = require ( 'lodash/some' ) ;
19
19
var EOL = require ( 'os' ) . EOL ;
20
+ var existsSync = require ( 'exists-sync' ) ;
20
21
21
22
var defaultIgnoredFiles = Blueprint . ignoredFiles ;
22
23
@@ -44,7 +45,8 @@ describe('Acceptance: ng init', function () {
44
45
return tmp . teardown ( './tmp' ) ;
45
46
} ) ;
46
47
47
- function confirmBlueprinted ( isMobile ) {
48
+ function confirmBlueprinted ( isMobile , routing ) {
49
+ routing = ! ! routing ;
48
50
var blueprintPath = path . join ( root , 'blueprints' , 'ng2' , 'files' ) ;
49
51
var mobileBlueprintPath = path . join ( root , 'blueprints' , 'mobile' , 'files' ) ;
50
52
var expected = unique ( walkSync ( blueprintPath ) . concat ( isMobile ? walkSync ( mobileBlueprintPath ) : [ ] ) . sort ( ) ) ;
@@ -55,14 +57,18 @@ describe('Acceptance: ng init', function () {
55
57
} ) ;
56
58
57
59
expected . forEach ( function ( file , index ) {
58
- expected [ index ] = file . replace ( / _ _ n a m e _ _ / g, 'tmp ' ) ;
60
+ expected [ index ] = file . replace ( / _ _ n a m e _ _ / g, 'app ' ) ;
59
61
expected [ index ] = expected [ index ] . replace ( / _ _ s t y l e e x t _ _ / g, 'css' ) ;
60
62
expected [ index ] = expected [ index ] . replace ( / _ _ p a t h _ _ / g, 'src' ) ;
61
63
} ) ;
62
-
64
+
63
65
if ( isMobile ) {
64
- expected = expected . filter ( p => p . indexOf ( 'tmp.component.html' ) < 0 ) ;
65
- expected = expected . filter ( p => p . indexOf ( 'tmp.component.css' ) < 0 ) ;
66
+ expected = expected . filter ( p => p . indexOf ( 'app.component.html' ) < 0 ) ;
67
+ expected = expected . filter ( p => p . indexOf ( 'app.component.css' ) < 0 ) ;
68
+ }
69
+
70
+ if ( ! routing ) {
71
+ expected = expected . filter ( p => p . indexOf ( 'app-routing.module.ts' ) < 0 ) ;
66
72
}
67
73
68
74
removeIgnored ( expected ) ;
@@ -200,4 +206,20 @@ describe('Acceptance: ng init', function () {
200
206
} )
201
207
. then ( confirmBlueprinted ) ;
202
208
} ) ;
209
+
210
+ it ( 'ng init --inline-template does not generate a template file' , ( ) => {
211
+ return ng ( [ 'init' , '--skip-npm' , '--skip-git' , '--inline-template' ] )
212
+ . then ( ( ) => {
213
+ const templateFile = path . join ( 'src' , 'app' , 'app.component.html' ) ;
214
+ expect ( existsSync ( templateFile ) ) . to . equal ( false ) ;
215
+ } ) ;
216
+ } ) ;
217
+
218
+ it ( 'ng init --inline-style does not gener a style file' , ( ) => {
219
+ return ng ( [ 'init' , '--skip-npm' , '--skip-git' , '--inline-style' ] )
220
+ . then ( ( ) => {
221
+ const styleFile = path . join ( 'src' , 'app' , 'app.component.css' ) ;
222
+ expect ( existsSync ( styleFile ) ) . to . equal ( false ) ;
223
+ } ) ;
224
+ } ) ;
203
225
} ) ;
0 commit comments