Skip to content

fix(@angular/cli): Correct reading of camel-cased defaults #10586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@angular/cli/models/schematic-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ export abstract class SchematicCommand extends Command {

private _cleanDefaults<T, K extends keyof T>(defaults: T, undefinedOptions: string[]): T {
(Object.keys(defaults) as K[])
.filter(key => !undefinedOptions.includes(key))
.filter(key => !undefinedOptions.map(strings.camelize).includes(key))
.forEach(key => {
delete defaults[key];
});
Expand Down
4 changes: 3 additions & 1 deletion tests/e2e/tests/commands/config/config-global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {expectToFail} from '../../../utils/utils';
import { expectFileToExist } from '../../../utils/fs';
import * as path from 'path';
import { homedir } from 'os';
import { deleteFile } from '../../../utils/fs';


export default function() {
Expand All @@ -27,5 +28,6 @@ export default function() {
})
.then(() => expectToFail(() => ng('config', '--global', 'cli.warnings.notreal', 'true')))
.then(() => ng('config', '--global', 'cli.warnings.versionMismatch', 'false'))
.then(() => expectFileToExist(path.join(homedir(), '.angular-config.json')));
.then(() => expectFileToExist(path.join(homedir(), '.angular-config.json')))
.then(() => deleteFile(path.join(homedir(), '.angular-config.json')));
}
26 changes: 26 additions & 0 deletions tests/e2e/tests/generate/component/component-inline-template.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {join} from 'path';
import {ng} from '../../../utils/process';
import {expectFileToExist} from '../../../utils/fs';
import {updateJsonFile} from '../../../utils/project';
import { expectToFail } from '../../../utils/utils';


// tslint:disable:max-line-length
export default function() {
const componentDir = join('src', 'app', 'test-component');
return Promise.resolve()
.then(() => updateJsonFile('angular.json', configJson => {
configJson.projects['test-project'].schematics = {
'@schematics/angular:component': { inlineTemplate: true }
};
}))
.then(() => ng('generate', 'component', 'test-component'))
.then(() => expectFileToExist(componentDir))
.then(() => expectFileToExist(join(componentDir, 'test-component.component.ts')))
.then(() => expectFileToExist(join(componentDir, 'test-component.component.spec.ts')))
.then(() => expectToFail(() => expectFileToExist(join(componentDir, 'test-component.component.html'))))
.then(() => expectFileToExist(join(componentDir, 'test-component.component.css')))

// Try to run the unit tests.
.then(() => ng('test', '--watch=false'));
}