File tree 2 files changed +10
-1
lines changed
packages/schematics/angular/guard
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ export default function (options: GuardOptions): Rule {
65
65
...strings ,
66
66
...options ,
67
67
} ) ,
68
- move ( parsedPath . path ) ,
68
+ move ( parsedPath . path + ( options . flat ? '' : '/' + strings . dasherize ( options . name ) ) ) ,
69
69
] ) ;
70
70
71
71
return chain ( [
Original file line number Diff line number Diff line change @@ -56,6 +56,15 @@ describe('Guard Schematic', () => {
56
56
expect ( files ) . toContain ( '/projects/bar/src/app/foo.guard.ts' ) ;
57
57
} ) ;
58
58
59
+ it ( 'should respect the flat flag' , ( ) => {
60
+ const options = { ...defaultOptions , flat : false } ;
61
+
62
+ const tree = schematicRunner . runSchematic ( 'guard' , options , appTree ) ;
63
+ const files = tree . files ;
64
+ expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo.guard.spec.ts' ) ;
65
+ expect ( files ) . toContain ( '/projects/bar/src/app/foo/foo.guard.ts' ) ;
66
+ } ) ;
67
+
59
68
it ( 'should respect the sourceRoot value' , ( ) => {
60
69
const config = JSON . parse ( appTree . readContent ( '/angular.json' ) ) ;
61
70
config . projects . bar . sourceRoot = 'projects/bar/custom' ;
You can’t perform that action at this time.
0 commit comments