diff --git a/packages/angular-cli/blueprints/component/index.js b/packages/angular-cli/blueprints/component/index.js index f67a4801358b..1770fdce9b07 100644 --- a/packages/angular-cli/blueprints/component/index.js +++ b/packages/angular-cli/blueprints/component/index.js @@ -124,7 +124,7 @@ module.exports = { const returns = []; const className = stringUtils.classify(`${options.entity.name}Component`); const fileName = stringUtils.dasherize(`${options.entity.name}.component`); - const componentDir = path.relative(path.dirname(this.pathToModule), this.generatePath).toLowerCase(); + const componentDir = path.relative(path.dirname(this.pathToModule), this.generatePath); const importPath = componentDir ? `./${componentDir}/${fileName}` : `./${fileName}`; if (!options['skip-import']) { diff --git a/packages/angular-cli/blueprints/directive/index.js b/packages/angular-cli/blueprints/directive/index.js index 2e568e4959fc..ba53e7e95442 100644 --- a/packages/angular-cli/blueprints/directive/index.js +++ b/packages/angular-cli/blueprints/directive/index.js @@ -87,7 +87,7 @@ module.exports = { const fileName = stringUtils.dasherize(`${options.entity.name}.directive`); const fullGeneratePath = path.join(this.project.root, this.generatePath); const moduleDir = path.parse(this.pathToModule).dir; - const relativeDir = path.relative(moduleDir, fullGeneratePath).toLowerCase(); + const relativeDir = path.relative(moduleDir, fullGeneratePath); const importPath = relativeDir ? `./${relativeDir}/${fileName}` : `./${fileName}`; if (!options['skip-import']) { diff --git a/packages/angular-cli/blueprints/pipe/index.js b/packages/angular-cli/blueprints/pipe/index.js index 7fbdf9e2ca63..12f957add718 100644 --- a/packages/angular-cli/blueprints/pipe/index.js +++ b/packages/angular-cli/blueprints/pipe/index.js @@ -75,7 +75,7 @@ module.exports = { const fileName = stringUtils.dasherize(`${options.entity.name}.pipe`); const fullGeneratePath = path.join(this.project.root, this.generatePath); const moduleDir = path.parse(this.pathToModule).dir; - const relativeDir = path.relative(moduleDir, fullGeneratePath).toLowerCase(); + const relativeDir = path.relative(moduleDir, fullGeneratePath); const importPath = relativeDir ? `./${relativeDir}/${fileName}` : `./${fileName}`; if (!options['skip-import']) { diff --git a/tests/e2e/tests/build/styles/styles-array.ts b/tests/e2e/tests/build/styles/styles-array.ts index 8e5b6cf26007..184adc165f78 100644 --- a/tests/e2e/tests/build/styles/styles-array.ts +++ b/tests/e2e/tests/build/styles/styles-array.ts @@ -47,11 +47,10 @@ export default function() { .then(() => expectFileToMatch('dist/styles.bundle.js', /.upper.*.lower.*background.*#def/)) .then(() => ng('build', '--prod')) - .then(() => new Promise(() => - glob.sync('dist/styles.*.bundle.css').find(file => !!file))) + .then(() => glob.sync('dist/styles.*.bundle.css').find(file => !!file)) .then((styles) => - expectFileToMatch(styles, 'body { background-color: blue; }') - .then(() => expectFileToMatch(styles, 'p { background-color: red; }') + expectFileToMatch(styles, /body\s*\{\s*background-color:\s*blue\s*\}/) + .then(() => expectFileToMatch(styles, /p\s*\{\s*background-color:\s*red\s*\}/) .then(() => expectFileToMatch(styles, /.outer.*.inner.*background:\s*#[fF]+/)) .then(() => expectFileToMatch(styles, /.upper.*.lower.*background.*#def/))) ); diff --git a/tests/e2e/tests/generate/component/component-path-case.ts b/tests/e2e/tests/generate/component/component-path-case.ts index 942e2459a7c6..450d267a312a 100644 --- a/tests/e2e/tests/generate/component/component-path-case.ts +++ b/tests/e2e/tests/generate/component/component-path-case.ts @@ -4,16 +4,22 @@ import {expectFileToExist, createDir} from '../../../utils/fs'; export default function() { - const rootDir = join('src', 'app', 'upper-dir'); - const componentDir = join(rootDir.toLowerCase(), 'test-component'); + const rootDir = join('src', 'app', 'Upper-Dir'); createDir(rootDir); + const componentDir = join(rootDir, 'test-component'); + const componentTwoDir = join(rootDir, 'test-component-two'); - return ng('generate', 'component', 'Upper-Dir', 'test-component') + return ng('generate', 'component', 'Upper-Dir/test-component') .then(() => expectFileToExist(componentDir)) .then(() => expectFileToExist(join(componentDir, 'test-component.component.ts'))) .then(() => expectFileToExist(join(componentDir, 'test-component.component.spec.ts'))) .then(() => expectFileToExist(join(componentDir, 'test-component.component.html'))) .then(() => expectFileToExist(join(componentDir, 'test-component.component.css'))) + .then(() => ng('generate', 'component', 'Upper-Dir/Test-Component-Two')) + .then(() => expectFileToExist(join(componentTwoDir, 'test-component-two.component.ts'))) + .then(() => expectFileToExist(join(componentTwoDir, 'test-component-two.component.spec.ts'))) + .then(() => expectFileToExist(join(componentTwoDir, 'test-component-two.component.html'))) + .then(() => expectFileToExist(join(componentTwoDir, 'test-component-two.component.css'))) // Try to run the unit tests. .then(() => ng('test', '--watch=false'));