File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
packages/schematics/angular/guard Expand file tree Collapse file tree 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 {
6565 ...strings ,
6666 ...options ,
6767 } ) ,
68- move ( parsedPath . path ) ,
68+ move ( parsedPath . path + ( options . flat ? '' : '/' + strings . dasherize ( options . name ) ) ) ,
6969 ] ) ;
7070
7171 return chain ( [
Original file line number Diff line number Diff line change @@ -56,6 +56,15 @@ describe('Guard Schematic', () => {
5656 expect ( files ) . toContain ( '/projects/bar/src/app/foo.guard.ts' ) ;
5757 } ) ;
5858
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+
5968 it ( 'should respect the sourceRoot value' , ( ) => {
6069 const config = JSON . parse ( appTree . readContent ( '/angular.json' ) ) ;
6170 config . projects . bar . sourceRoot = 'projects/bar/custom' ;
You can’t perform that action at this time.
0 commit comments