Skip to content

Commit

Permalink
fix(generate): fix module component path if module is created in chil…
Browse files Browse the repository at this point in the history
…d folder

fixes #3063
  • Loading branch information
Meligy committed Nov 8, 2016
1 parent f815228 commit b91fffe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/angular-cli/blueprints/module/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ module.exports = {
},

afterInstall: function (options) {
options.entity.name = path.join(this.dasherizedModuleName, this.dasherizedModuleName);
var componentPath = path.join(this.generatePath, this.dasherizedModuleName);

options.entity.name = path.relative(this.dynamicPath.appRoot, componentPath);
options.flat = true;
options.route = false;
options.inlineTemplate = false;
Expand Down
10 changes: 10 additions & 0 deletions tests/acceptance/generate-module.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,14 @@ describe('Acceptance: ng generate module', function () {
expect(existsSync(path.join(testPath, 'two-word', 'two-word.module.spec.ts'))).to.equal(false);
});
});

it('ng generate module parent/child', function () {
return ng(['generate', 'module', 'parent']).then(() =>
ng(['generate', 'module', 'parent/child']).then(() => {
expect(existsSync(path.join(testPath, 'parent/child', 'child.module.ts'))).to.equal(true);
expect(existsSync(path.join(testPath, 'parent/child', 'child.module.spec.ts'))).to.equal(false);
expect(existsSync(path.join(testPath, 'parent/child', 'child.component.ts'))).to.equal(true);
})
);
});
});

0 comments on commit b91fffe

Please sign in to comment.