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