Skip to content

Commit 1139c7e

Browse files
committed
fix(generate): missing string-utils and empty test
1 parent a6cf825 commit 1139c7e

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

addon/ng2/blueprints/component/index.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
var path = require('path');
2-
var stringUtils = require('ember-cli-string-utils');
32
var chalk = require('chalk');
43
var Blueprint = require('ember-cli/lib/models/blueprint');
54
var dynamicPathParser = require('../../utilities/dynamic-path-parser');
65
var addBarrelRegistration = require('../../utilities/barrel-management');
76
var getFiles = Blueprint.prototype.files;
7+
const stringUtils = require('ember-cli/lib/utilities/string');
88

99
module.exports = {
1010
description: '',
11-
11+
1212
availableOptions: [
1313
{ name: 'flat', type: Boolean, default: false },
1414
{ name: 'route', type: Boolean, default: false },
@@ -21,27 +21,27 @@ module.exports = {
2121
var parsedPath = dynamicPathParser(this.project, entityName);
2222

2323
this.dynamicPath = parsedPath;
24-
24+
2525
var defaultPrefix = '';
26-
if (this.project.ngConfig &&
26+
if (this.project.ngConfig &&
2727
this.project.ngConfig.defaults &&
2828
this.project.ngConfig.defaults.prefix) {
2929
defaultPrefix = this.project.ngConfig.defaults.prefix + '-';
3030
}
3131
var prefix = this.options.prefix ? defaultPrefix : '';
3232
this.selector = stringUtils.dasherize(prefix + parsedPath.name);
33-
33+
3434
if (this.selector.indexOf('-') === -1) {
3535
this._writeStatusToUI(chalk.yellow, 'WARNING', 'selectors should contain a dash');
3636
}
37-
37+
3838
return parsedPath.name;
3939
},
4040

4141
locals: function (options) {
4242
//TODO: pull value from config
4343
this.styleExt = 'css';
44-
44+
4545
return {
4646
dynamicPath: this.dynamicPath.dir.replace(this.dynamicPath.appRoot, ''),
4747
flat: options.flat,
@@ -54,10 +54,10 @@ module.exports = {
5454
selector: this.selector
5555
};
5656
},
57-
57+
5858
files: function() {
5959
var fileList = getFiles.call(this);
60-
60+
6161
if (this.options && this.options.flat) {
6262
fileList = fileList.filter(p => p.indexOf('index.ts') <= 0);
6363
}
@@ -73,15 +73,15 @@ module.exports = {
7373

7474
return fileList;
7575
},
76-
76+
7777
fileMapTokens: function (options) {
7878
// Return custom template variables here.
7979
return {
8080
__path__: () => {
8181
var dir = this.dynamicPath.dir;
8282
if (!options.locals.flat) {
8383
dir += path.sep + options.dasherizedModuleName;
84-
84+
8585
if (options.locals.isLazyRoute) {
8686
var dirParts = dir.split(path.sep);
8787
dirParts[dirParts.length - 1] = `+${dirParts[dirParts.length - 1]}`;
@@ -97,12 +97,12 @@ module.exports = {
9797
}
9898
};
9999
},
100-
100+
101101
afterInstall: function(options) {
102102
if (!options.flat) {
103103
var filePath = path.join('src', 'client', 'system-config.ts');
104104
var barrelUrl = this.appDir.replace(path.sep, '/');
105-
105+
106106
return addBarrelRegistration(this, this.generatePath)
107107
.then(() => {
108108
return this.insertIntoFile(
@@ -113,7 +113,7 @@ module.exports = {
113113
})
114114
} else {
115115
return addBarrelRegistration(
116-
this,
116+
this,
117117
this.generatePath,
118118
options.entity.name + '.component');
119119
}

tests/acceptance/generate-component.spec.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ describe('Acceptance: ng generate component', function () {
138138
expect(existsSync(testPath)).to.equal(false);
139139
});
140140
});
141-
141+
142142
it('ng generate component mycomp will prefix selector', () => {
143143
return ng(['generate', 'component', 'mycomp'])
144144
.then(() => {
@@ -148,7 +148,7 @@ describe('Acceptance: ng generate component', function () {
148148
expect(contents.indexOf('selector: \'app-mycomp\'') === -1).to.equal(false);
149149
});
150150
});
151-
151+
152152
it('ng generate component mycomp --no-prefix will not prefix selector', () => {
153153
return ng(['generate', 'component', 'mycomp', '--no-prefix'])
154154
.then(() => {
@@ -158,29 +158,27 @@ describe('Acceptance: ng generate component', function () {
158158
expect(contents.indexOf('selector: \'mycomp\'') === -1).to.equal(false);
159159
});
160160
});
161-
161+
162162
it('ng generate component myComp will succeed', () => {
163163
return ng(['generate', 'component', 'myComp'])
164164
.then(() => {
165165
var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-comp', 'my-comp.component.ts');
166166
expect(existsSync(testPath)).to.equal(true);
167167
});
168168
});
169-
169+
170170
it('ng generate component my-comp --inline-template', function () {
171171
return ng(['generate', 'component', 'my-comp', '--inline-template']).then(() => {
172172
var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-comp', 'my-comp.component.html');
173173
expect(existsSync(testPath)).to.equal(false);
174174
});
175175
});
176-
176+
177177
it('ng generate component my-comp --inline-style', function () {
178178
return ng(['generate', 'component', 'my-comp', '--inline-style']).then(() => {
179179
var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-comp', 'my-comp.component.css');
180180
expect(existsSync(testPath)).to.equal(false);
181181
});
182182
});
183-
184-
it('should ', () => {
185-
});
183+
186184
});

0 commit comments

Comments
 (0)