diff --git a/addon/ng2/blueprints/component/files/__path__/__name__.css b/addon/ng2/blueprints/component/files/__path__/__name__.component.__styleext__ similarity index 100% rename from addon/ng2/blueprints/component/files/__path__/__name__.css rename to addon/ng2/blueprints/component/files/__path__/__name__.component.__styleext__ diff --git a/addon/ng2/blueprints/component/files/__path__/__name__.html b/addon/ng2/blueprints/component/files/__path__/__name__.component.html similarity index 100% rename from addon/ng2/blueprints/component/files/__path__/__name__.html rename to addon/ng2/blueprints/component/files/__path__/__name__.component.html diff --git a/addon/ng2/blueprints/component/files/__path__/__name__.spec.ts b/addon/ng2/blueprints/component/files/__path__/__name__.component.spec.ts similarity index 59% rename from addon/ng2/blueprints/component/files/__path__/__name__.spec.ts rename to addon/ng2/blueprints/component/files/__path__/__name__.component.spec.ts index 82961b117413..634ab9bb2567 100644 --- a/addon/ng2/blueprints/component/files/__path__/__name__.spec.ts +++ b/addon/ng2/blueprints/component/files/__path__/__name__.component.spec.ts @@ -1,16 +1,17 @@ import { - it, - iit, + beforeEachProviders, describe, ddescribe, expect, + iit, + it, inject, injectAsync, - TestComponentBuilder, - beforeEachProviders + ComponentFixture, + TestComponentBuilder } from 'angular2/testing'; import {provide} from 'angular2/core'; -import {<%= classifiedModuleName %>} from './<%= dasherizedModuleName %>'; +import {<%= classifiedModuleName %>Component} from './<%= dasherizedModuleName %>.component'; describe('<%= classifiedModuleName %> Component', () => { @@ -18,7 +19,7 @@ describe('<%= classifiedModuleName %> Component', () => { it('should ...', injectAsync([TestComponentBuilder], (tcb:TestComponentBuilder) => { - return tcb.createAsync(<%= classifiedModuleName %>).then((fixture) => { + return tcb.createAsync(<%= classifiedModuleName %>Component).then((fixture: ComponentFixture) => { fixture.detectChanges(); }); })); diff --git a/addon/ng2/blueprints/component/files/__path__/__name__.component.ts b/addon/ng2/blueprints/component/files/__path__/__name__.component.ts new file mode 100644 index 000000000000..56c1cffc7399 --- /dev/null +++ b/addon/ng2/blueprints/component/files/__path__/__name__.component.ts @@ -0,0 +1,16 @@ +import {Component, OnInit} from 'angular2/core'; + +@Component({ + moduleId: __moduleName, + selector: '<%= dasherizedModuleName %>', + templateUrl: '<%= dasherizedModuleName %>.component.html', + styleUrls: ['<%= dasherizedModuleName %>.component.<%= styleExt %>'] +}) +export class <%= classifiedModuleName %>Component implements OnInit { + + constructor() {} + + ngOnInit() { + } + +} diff --git a/addon/ng2/blueprints/component/files/__path__/__name__.ts b/addon/ng2/blueprints/component/files/__path__/__name__.ts deleted file mode 100644 index d20bdb6ba757..000000000000 --- a/addon/ng2/blueprints/component/files/__path__/__name__.ts +++ /dev/null @@ -1,16 +0,0 @@ -import {Component} from 'angular2/core'; - - -@Component({ - selector: '<%= dasherizedModuleName %>', - templateUrl: 'app<%= dynamicPath %>/<%= dasherizedModuleName %>/<%= dasherizedModuleName %>.html', - styleUrls: ['app<%= dynamicPath %>/<%= dasherizedModuleName %>/<%= dasherizedModuleName %>.css'], - providers: [], - directives: [], - pipes: [] -}) -export class <%= classifiedModuleName %> { - - constructor() {} - -} diff --git a/addon/ng2/blueprints/component/files/__path__/index.ts b/addon/ng2/blueprints/component/files/__path__/index.ts new file mode 100644 index 000000000000..38c9dbf59603 --- /dev/null +++ b/addon/ng2/blueprints/component/files/__path__/index.ts @@ -0,0 +1 @@ +export {<%= classifiedModuleName %>Component} from './<%= dasherizedModuleName %>.component'; \ No newline at end of file diff --git a/addon/ng2/blueprints/component/index.js b/addon/ng2/blueprints/component/index.js index 9ea61aa44207..a33914fd6a34 100644 --- a/addon/ng2/blueprints/component/index.js +++ b/addon/ng2/blueprints/component/index.js @@ -1,11 +1,14 @@ var path = require('path'); +var Blueprint = require('ember-cli/lib/models/blueprint'); var dynamicPathParser = require('../../utilities/dynamic-path-parser'); +var getFiles = Blueprint.prototype.files; + module.exports = { description: '', availableOptions: [ - { name: 'flat', type: Boolean, default: false, aliases: ['f'] } + { name: 'flat', type: Boolean, default: false } ], normalizeEntityName: function (entityName) { @@ -16,12 +19,28 @@ module.exports = { }, locals: function (options) { + //TODO: pull value from config + this.styleExt = 'css'; + return { dynamicPath: this.dynamicPath.dir.replace(this.dynamicPath.appRoot, ''), - flat: options.flat + flat: options.flat, + styleExt: this.styleExt, + isLazyRoute: !!options.isLazyRoute, + isAppComponent: !!options.isAppComponent }; }, + + files: function() { + var fileList = getFiles.call(this); + + if (this.options.flat) { + fileList = fileList.filter(p => p.indexOf('index.ts') <= 0); + } + return fileList; + }, + fileMapTokens: function (options) { // Return custom template variables here. return { @@ -29,9 +48,31 @@ module.exports = { var dir = this.dynamicPath.dir; if (!options.locals.flat) { dir += path.sep + options.dasherizedModuleName; + + if (options.locals.isLazyRoute) { + var dirParts = dir.split(path.sep); + dirParts[dirParts.length - 1] = `+${dirParts[dirParts.length - 1]}`; + dir = dirParts.join(path.sep); + } } + this.appDir = dir.replace(`src${path.sep}client${path.sep}`, ''); return dir; + }, + __styleext__: () => { + return options.locals.styleExt; } }; + }, + + afterInstall: function(options) { + if (!options.flat) { + var filePath = path.join('src', 'client', 'system-config.ts'); + var barrelUrl = this.appDir.replace(path.sep, '/'); + return this.insertIntoFile( + filePath, + ` '${barrelUrl}',`, + { before: ' /** @cli-barrel */' } + ); + } } }; diff --git a/addon/ng2/blueprints/directive/files/__path__/__name__.spec.ts b/addon/ng2/blueprints/directive/files/__path__/__name__.directive.spec.ts similarity index 77% rename from addon/ng2/blueprints/directive/files/__path__/__name__.spec.ts rename to addon/ng2/blueprints/directive/files/__path__/__name__.directive.spec.ts index 0e5c50473136..f737809adee4 100644 --- a/addon/ng2/blueprints/directive/files/__path__/__name__.spec.ts +++ b/addon/ng2/blueprints/directive/files/__path__/__name__.directive.spec.ts @@ -1,16 +1,17 @@ import { - it, - iit, + beforeEachProviders, describe, ddescribe, expect, + iit, + it, inject, injectAsync, - TestComponentBuilder, - beforeEachProviders + ComponentFixture, + TestComponentBuilder } from 'angular2/testing'; import {provide, Component} from 'angular2/core'; -import {<%= classifiedModuleName %>} from './<%= dasherizedModuleName %>'; +import {<%= classifiedModuleName %>} from './<%= dasherizedModuleName %>.directive'; @Component({ @@ -25,7 +26,7 @@ describe('<%= classifiedModuleName %> Directive', () => { it('should ...', injectAsync([TestComponentBuilder], (tcb:TestComponentBuilder) => { - return tcb.createAsync(TestComponent).then((fixture) => { + return tcb.createAsync(TestComponent).then((fixture: ComponentFixture) => { fixture.detectChanges(); }); })); diff --git a/addon/ng2/blueprints/directive/files/__path__/__name__.ts b/addon/ng2/blueprints/directive/files/__path__/__name__.directive.ts similarity index 62% rename from addon/ng2/blueprints/directive/files/__path__/__name__.ts rename to addon/ng2/blueprints/directive/files/__path__/__name__.directive.ts index bcbc6d6e779a..1c6f046ea63f 100644 --- a/addon/ng2/blueprints/directive/files/__path__/__name__.ts +++ b/addon/ng2/blueprints/directive/files/__path__/__name__.directive.ts @@ -1,11 +1,7 @@ import {Directive} from 'angular2/core'; - @Directive({ - selector: '<%= dasherizedModuleName %>', - providers: [], - host: {}, - + selector: '<%= rawEntityName %>' }) export class <%= classifiedModuleName %> { diff --git a/addon/ng2/blueprints/directive/index.js b/addon/ng2/blueprints/directive/index.js index 2232263768eb..dffdc7455a12 100644 --- a/addon/ng2/blueprints/directive/index.js +++ b/addon/ng2/blueprints/directive/index.js @@ -5,20 +5,22 @@ module.exports = { description: '', availableOptions: [ - { name: 'flat', type: Boolean, default: false, aliases: ['f'] } + { name: 'flat', type: Boolean, default: false } ], normalizeEntityName: function (entityName) { var parsedPath = dynamicPathParser(this.project, entityName); this.dynamicPath = parsedPath; + this.rawEntityName = parsedPath.name; return parsedPath.name; }, locals: function (options) { return { dynamicPath: this.dynamicPath.dir, - flat: options.flat + flat: options.flat, + rawEntityName: this.rawEntityName }; }, diff --git a/addon/ng2/blueprints/ng2/files/karma-test-shim.js b/addon/ng2/blueprints/ng2/files/karma-test-shim.js index 22254c16f3c8..306a42e61592 100644 --- a/addon/ng2/blueprints/ng2/files/karma-test-shim.js +++ b/addon/ng2/blueprints/ng2/files/karma-test-shim.js @@ -1,49 +1,59 @@ /*global jasmine, __karma__, window*/ Error.stackTraceLimit = Infinity; - jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000; __karma__.loaded = function () { }; -System.config({ - packages: { - 'base/dist/app': { - defaultExtension: false, - format: 'register', - map: Object.keys(window.__karma__.files) - .filter(onlyAppFiles) - .reduce(function (pathsMapping, appPath) { - var moduleName = appPath.replace(/^\/base\/dist\/app\//, './').replace(/\.js$/, ''); - pathsMapping[moduleName] = appPath + '?' + window.__karma__.files[appPath]; - return pathsMapping; - }, {}) - } - } -}); +var distPath = '/base/dist/'; +var appPath = distPath + 'app/'; -System.import('angular2/testing').then(function (testing) { - return System.import('angular2/platform/testing/browser').then(function (providers) { - testing.setBaseTestProviders(providers.TEST_BROWSER_PLATFORM_PROVIDERS, - providers.TEST_BROWSER_APPLICATION_PROVIDERS); - }); -}).then(function () { - return Promise.all( - Object.keys(window.__karma__.files) - .filter(onlySpecFiles) - .map(function (moduleName) { - return System.import(moduleName); - })); -}).then(function () { - __karma__.start(); -}, function (error) { - __karma__.error(error.stack || error); -}); - -function onlyAppFiles(filePath) { - return /^\/base\/dist\/app\/(?!.*\.spec\.js$)([a-z0-9-_\.\/]+)\.js$/.test(filePath); +function isJsFile(path) { + return path.slice(-3) == '.js'; } -function onlySpecFiles(path) { - return /\.spec\.js$/.test(path); +function isSpecFile(path) { + return path.slice(-8) == '.spec.js'; } + +function isAppFile(path) { + return isJsFile(path) && (path.substr(0, appPath.length) == appPath); +} + +var allSpecFiles = Object.keys(window.__karma__.files) + .filter(isSpecFile) + .filter(isAppFile); + +// Load our SystemJS configuration. +System.import('base/dist/system-config.js').then(function(systemJsConfig) { + // We need to add the distPrefix to our system config packages. + var config = systemJsConfig.config; + Object.keys(config.packages).forEach(function(pkgName) { + if (pkgName[0] != '/' && pkgName[0] != '.') { + var pkg = config.packages[pkgName]; + delete config.packages[pkgName]; + config.packages[distPath + pkgName] = pkg; + } + }); + + System.config(config); +}).then(function() { + // Load and configure the TestComponentBuilder. + return Promise.all([ + System.import('angular2/testing'), + System.import('angular2/platform/testing/browser') + ]).then(function (providers) { + var testing = providers[0]; + var testingBrowser = providers[1]; + + testing.setBaseTestProviders(testingBrowser.TEST_BROWSER_PLATFORM_PROVIDERS, + testingBrowser.TEST_BROWSER_APPLICATION_PROVIDERS); + }); +}).then(function() { + // Finally, load all spec files. + // This will run the tests directly. + return Promise.all( + allSpecFiles.map(function (moduleName) { + return System.import(moduleName); + })); +}).then(__karma__.start, __karma__.error); \ No newline at end of file diff --git a/addon/ng2/blueprints/ng2/files/src/client/app/__name__.__styleext__ b/addon/ng2/blueprints/ng2/files/src/client/app/__name__.__styleext__ new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/addon/ng2/blueprints/ng2/files/src/client/app/__name__.ts b/addon/ng2/blueprints/ng2/files/src/client/app/__name__.ts index d4c097fdde3f..e3beb84f32a7 100644 --- a/addon/ng2/blueprints/ng2/files/src/client/app/__name__.ts +++ b/addon/ng2/blueprints/ng2/files/src/client/app/__name__.ts @@ -2,9 +2,11 @@ import {Component} from 'angular2/core'; import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS} from 'angular2/router'; @Component({ + moduleId: __moduleName, selector: '<%= htmlComponentName %>-app', providers: [ROUTER_PROVIDERS], - templateUrl: 'app/<%= htmlComponentName %>.html', + templateUrl: '<%= htmlComponentName %>.html', + styleUrls: ['<%= dasherizedModuleName %>.<%= styleExt %>'], directives: [ROUTER_DIRECTIVES], pipes: [] }) diff --git a/addon/ng2/blueprints/ng2/files/src/client/index.html b/addon/ng2/blueprints/ng2/files/src/client/index.html index 197237d92520..9d10ea642109 100644 --- a/addon/ng2/blueprints/ng2/files/src/client/index.html +++ b/addon/ng2/blueprints/ng2/files/src/client/index.html @@ -31,17 +31,14 @@ - + + diff --git a/addon/ng2/blueprints/ng2/files/src/client/app.ts b/addon/ng2/blueprints/ng2/files/src/client/main.ts similarity index 100% rename from addon/ng2/blueprints/ng2/files/src/client/app.ts rename to addon/ng2/blueprints/ng2/files/src/client/main.ts diff --git a/addon/ng2/blueprints/ng2/files/src/client/system-config.ts b/addon/ng2/blueprints/ng2/files/src/client/system-config.ts new file mode 100644 index 000000000000..5973b1fbe2cf --- /dev/null +++ b/addon/ng2/blueprints/ng2/files/src/client/system-config.ts @@ -0,0 +1,23 @@ +const barrels: string[] = [ + 'app', + /** @cli-barrel */ +]; + +function createPackageConfig(barrels: string[]): any { + return barrels.reduce((barrelConfig: any, barrelName: string) => { + barrelConfig[barrelName] = { + format: 'register', + defaultExtension: 'js', + main: 'index' + }; + return barrelConfig; + }, {}); +} + + +// Add your custom SystemJS configuration here. +export const config: any = { + packages: Object.assign({ + // Add your custom SystemJS packages here. + }, createPackageConfig(barrels)) +}; \ No newline at end of file diff --git a/addon/ng2/blueprints/ng2/files/src/client/typings.d.ts b/addon/ng2/blueprints/ng2/files/src/client/typings.d.ts index 86a6cbabf250..886f540776ce 100644 --- a/addon/ng2/blueprints/ng2/files/src/client/typings.d.ts +++ b/addon/ng2/blueprints/ng2/files/src/client/typings.d.ts @@ -1 +1,3 @@ /// + +declare var __moduleName: string; \ No newline at end of file diff --git a/addon/ng2/blueprints/ng2/index.js b/addon/ng2/blueprints/ng2/index.js index c38eb51ea90d..95ca643c0f74 100644 --- a/addon/ng2/blueprints/ng2/index.js +++ b/addon/ng2/blueprints/ng2/index.js @@ -4,14 +4,22 @@ module.exports = { description: '', locals: function(options) { - // Return custom template variables here. + //TODO: pull value from config + this.styleExt = 'css'; + return { htmlComponentName: stringUtils.dasherize(options.entity.name), - jsComponentName: stringUtils.classify(options.entity.name) + jsComponentName: stringUtils.classify(options.entity.name), + styleExt: this.styleExt + }; + }, + + fileMapTokens: function (options) { + // Return custom template variables here. + return { + __styleext__: () => { + return options.locals.styleExt; + } }; } - - // afterInstall: function(options) { - // // Perform extra work here. - // } }; diff --git a/addon/ng2/blueprints/pipe/files/__path__/__name__.ts b/addon/ng2/blueprints/pipe/files/__path__/__name__.pipe.ts similarity index 100% rename from addon/ng2/blueprints/pipe/files/__path__/__name__.ts rename to addon/ng2/blueprints/pipe/files/__path__/__name__.pipe.ts diff --git a/addon/ng2/blueprints/pipe/files/__path__/__name__.spec.ts b/addon/ng2/blueprints/pipe/files/__path__/__name__pipe.spec.ts similarity index 97% rename from addon/ng2/blueprints/pipe/files/__path__/__name__.spec.ts rename to addon/ng2/blueprints/pipe/files/__path__/__name__pipe.spec.ts index c9a8817c7830..43a562105c0a 100644 --- a/addon/ng2/blueprints/pipe/files/__path__/__name__.spec.ts +++ b/addon/ng2/blueprints/pipe/files/__path__/__name__pipe.spec.ts @@ -10,7 +10,7 @@ import { beforeEachProviders } from 'angular2/testing'; import {provide} from 'angular2/core'; -import {<%= classifiedModuleName %>} from './<%= dasherizedModuleName %>'; +import {<%= classifiedModuleName %>} from './<%= dasherizedModuleName %>.pipe'; describe('<%= classifiedModuleName %> Pipe', () => { diff --git a/addon/ng2/blueprints/pipe/index.js b/addon/ng2/blueprints/pipe/index.js index a8bb926516c2..f5aeb38e1d72 100644 --- a/addon/ng2/blueprints/pipe/index.js +++ b/addon/ng2/blueprints/pipe/index.js @@ -5,7 +5,7 @@ module.exports = { description: '', availableOptions: [ - { name: 'flat', type: Boolean, default: false, aliases: ['f'] } + { name: 'flat', type: Boolean, default: true } ], normalizeEntityName: function (entityName) { diff --git a/addon/ng2/blueprints/route-config/files/__path__/route-config.ts b/addon/ng2/blueprints/route-config/files/__path__/route-config.ts deleted file mode 100644 index d8e76dc1cad0..000000000000 --- a/addon/ng2/blueprints/route-config/files/__path__/route-config.ts +++ /dev/null @@ -1,7 +0,0 @@ -// DO NOT EDIT THIS FILE -// IT IS AUTO GENERATED BY ANGULAR-CLI -<%= imports %> - -export const CliRouteConfig = [ - <%= routeDefinitions %> -]; \ No newline at end of file diff --git a/addon/ng2/blueprints/route-config/index.js b/addon/ng2/blueprints/route-config/index.js deleted file mode 100644 index 5921aa199a57..000000000000 --- a/addon/ng2/blueprints/route-config/index.js +++ /dev/null @@ -1,56 +0,0 @@ -var fs = require('fs-extra'); -var path = require('path'); -var dynamicPathParser = require('../../utilities/dynamic-path-parser'); - -var imports, routeDefinitions; - -module.exports = { - description: 'Registers the route with the router.', - - normalizeEntityName: function () { - var parsedPath = dynamicPathParser(this.project, 'ignore'); - - this.dynamicPath = parsedPath; - return parsedPath.name; - }, - - beforeInstall: function (options) { - var routeConfigPath = path.join(options.project.root, 'src', 'client', 'app', 'route-config.ts'); - try { - fs.unlinkSync(routeConfigPath); - } catch (e) { - // doing nothing here - } - }, - - locals: function (options) { - return generateLocals.call(this, options); - }, - - fileMapTokens: function () { - // Return custom template variables here. - return { - __path__: () => { - return this.dynamicPath.dir; - } - }; - } -}; - -function generateLocals(options) { - var ngCliConfigPath = path.join(options.project.root, 'angular-cli.json'); - var ngCliConfig = JSON.parse(fs.readFileSync(ngCliConfigPath, 'utf-8')); - - imports = - ngCliConfig.routes.map(route => `import {${route.component}} from '${route.componentPath}';`) - .join('\n'); - - routeDefinitions = - ngCliConfig.routes - .map( - route => - `{path: '${route.routePath}', name: '${route.component}', component: ${route.component}},`) - .join('\n'); - - return { imports, routeDefinitions } -} diff --git a/addon/ng2/blueprints/route/files/__path__/__name__.ts b/addon/ng2/blueprints/route/files/__path__/__name__.ts deleted file mode 100644 index c77c64e0e384..000000000000 --- a/addon/ng2/blueprints/route/files/__path__/__name__.ts +++ /dev/null @@ -1,13 +0,0 @@ -import {Component} from 'angular2/core'; -import {RouteConfig, RouterOutlet} from 'angular2/router'; - -@Component({ - template: '', - providers: [], - directives: [RouterOutlet] -}) -@RouteConfig([ -]) -export class <%= classifiedModuleName %> { - constructor() {} -} diff --git a/addon/ng2/blueprints/route/index.js b/addon/ng2/blueprints/route/index.js index 223cc2689fce..6cd43ffe24f8 100644 --- a/addon/ng2/blueprints/route/index.js +++ b/addon/ng2/blueprints/route/index.js @@ -4,6 +4,7 @@ const fs = require('fs'); const path = require('path'); const dynamicPathParser = require('../../utilities/dynamic-path-parser'); const stringUtils = require('ember-cli/lib/utilities/string'); +const Blueprint = require('ember-cli/lib/models/blueprint'); module.exports = { @@ -11,8 +12,16 @@ module.exports = { availableOptions: [ { name: 'skip-router-generation', type: Boolean, default: false, aliases: ['srg'] }, - { name: 'default', type: Boolean, default: false } + { name: 'default', type: Boolean, default: false }, + { name: 'lazy', type: Boolean, default: true } ], + + beforeInstall: function(options) { + if (options.lazy) { + options.isLazyRoute = true; + } + return Blueprint.load(path.join(__dirname, '..', 'component')).install(options); + }, afterInstall: function (options) { if (!options.skipRouterGeneration) { @@ -28,7 +37,9 @@ module.exports = { var parsedPath = dynamicPathParser(this.project, entityName); this.dynamicPath = parsedPath; - return parsedPath.name; + + //leave the entity name intact for component generation + return entityName; }, locals: function () { @@ -72,10 +83,9 @@ module.exports = { const jsComponentName = stringUtils.classify(options.entity.name); const base = parsedPath.base; - const name = parsedPath.name; let content = fs.readFileSync(parentFile, 'utf-8'); - const importTemplate = `import {${jsComponentName}} from './${base}/${name}';\n`; + const importTemplate = `import {${jsComponentName}} from './+${base}`; if (content.indexOf(importTemplate) == -1) { // Not found, nothing to do. return; @@ -99,11 +109,10 @@ module.exports = { const jsComponentName = stringUtils.classify(options.entity.name); const base = parsedPath.base; - const name = parsedPath.name; // Insert the import statement. let content = fs.readFileSync(parentFile, 'utf-8'); - const importTemplate = `import {${jsComponentName}} from './${base}/${name}';`; + const importTemplate = `import {${jsComponentName}Component} from './+${base}';`; if (content.indexOf(importTemplate) != -1) { // Already there, do nothing. @@ -115,7 +124,7 @@ module.exports = { return `${m1}\n${importTemplate}\n`; }); - let route = `{path: '/${base}/...', name: '${jsComponentName}', component: ${jsComponentName}},`; + let route = `{path: '/${base}/...', name: '${jsComponentName}', component: ${jsComponentName}Component},`; content = content.replace(/(@RouteConfig\(\[\s*\n)([\s\S\n]*?)(^\s*\]\))/m, function(_, m1, m2, m3) { if (m2.length) { // Add a `,` if there's none. diff --git a/addon/ng2/blueprints/service/files/__path__/__name__.spec.ts b/addon/ng2/blueprints/service/files/__path__/__name__.service.spec.ts similarity index 85% rename from addon/ng2/blueprints/service/files/__path__/__name__.spec.ts rename to addon/ng2/blueprints/service/files/__path__/__name__.service.spec.ts index ed8ae4eedc63..3fc70de4fff7 100644 --- a/addon/ng2/blueprints/service/files/__path__/__name__.spec.ts +++ b/addon/ng2/blueprints/service/files/__path__/__name__.service.spec.ts @@ -1,23 +1,21 @@ import { + beforeEachProviders, it, iit, describe, ddescribe, expect, inject, - injectAsync, - TestComponentBuilder, - beforeEachProviders + injectAsync } from 'angular2/testing'; import {provide} from 'angular2/core'; -import {<%= classifiedModuleName %>} from './<%= dasherizedModuleName %>'; +import {<%= classifiedModuleName %>} from './<%= dasherizedModuleName %>.service'; describe('<%= classifiedModuleName %> Service', () => { beforeEachProviders(() => [<%= classifiedModuleName %>]); - - + it('should ...', inject([<%= classifiedModuleName %>], (service: <%= classifiedModuleName %>) => { })); diff --git a/addon/ng2/blueprints/service/files/__path__/__name__.ts b/addon/ng2/blueprints/service/files/__path__/__name__.service.ts similarity index 99% rename from addon/ng2/blueprints/service/files/__path__/__name__.ts rename to addon/ng2/blueprints/service/files/__path__/__name__.service.ts index b6affa0cde77..f01adbea5f51 100644 --- a/addon/ng2/blueprints/service/files/__path__/__name__.ts +++ b/addon/ng2/blueprints/service/files/__path__/__name__.service.ts @@ -1,6 +1,5 @@ import {Injectable} from 'angular2/core'; - @Injectable() export class <%= classifiedModuleName %> { diff --git a/addon/ng2/blueprints/service/index.js b/addon/ng2/blueprints/service/index.js index 2232263768eb..128367e2ef38 100644 --- a/addon/ng2/blueprints/service/index.js +++ b/addon/ng2/blueprints/service/index.js @@ -5,7 +5,7 @@ module.exports = { description: '', availableOptions: [ - { name: 'flat', type: Boolean, default: false, aliases: ['f'] } + { name: 'flat', type: Boolean, default: true } ], normalizeEntityName: function (entityName) { diff --git a/addon/ng2/utilities/dynamic-path-parser.js b/addon/ng2/utilities/dynamic-path-parser.js index 284f9d011978..13f5d2156ab5 100644 --- a/addon/ng2/utilities/dynamic-path-parser.js +++ b/addon/ng2/utilities/dynamic-path-parser.js @@ -38,6 +38,10 @@ module.exports = function dynamicPathParser(project, entityName) { var adjustedPath = outputPath.replace(projectRoot, ''); var parsedPath = path.parse(adjustedPath); + + if (parsedPath.dir.indexOf(path.sep) === 0) { + parsedPath.dir = parsedPath.dir.substr(1); + } parsedPath.dir = parsedPath.dir === path.sep ? '' : parsedPath.dir; parsedPath.appRoot = appRoot diff --git a/tests/acceptance/dynamic-path-parser.spec.js b/tests/acceptance/dynamic-path-parser.spec.js index a8b88754b49a..76a4b418aa0d 100644 --- a/tests/acceptance/dynamic-path-parser.spec.js +++ b/tests/acceptance/dynamic-path-parser.spec.js @@ -4,7 +4,7 @@ var expect = require('chai').expect; var path = require('path'); var dynamicPathParser = require('../../addon/ng2/utilities/dynamic-path-parser'); -var appDir = `${path.sep}src${path.sep}client${path.sep}app`; +var appDir = `src${path.sep}client${path.sep}app`; describe('dynamic path parser', () => { var project; diff --git a/tests/acceptance/generate-component.spec.js b/tests/acceptance/generate-component.spec.js index d15ea58461d0..04574cd9070c 100644 --- a/tests/acceptance/generate-component.spec.js +++ b/tests/acceptance/generate-component.spec.js @@ -32,14 +32,14 @@ describe('Acceptance: ng generate component', function () { it('ng generate component my-comp', function () { return ng(['generate', 'component', 'my-comp']).then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-comp', 'my-comp.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-comp', 'my-comp.component.ts'); expect(existsSync(testPath)).to.equal(true); }); }); it('ng generate component test' + path.sep + 'my-comp', function () { return ng(['generate', 'component', 'test' + path.sep + 'my-comp']).then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'test', 'my-comp', 'my-comp.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'test', 'my-comp', 'my-comp.component.ts'); expect(existsSync(testPath)).to.equal(true); }); }); @@ -47,7 +47,7 @@ describe('Acceptance: ng generate component', function () { it('ng generate component test' + path.sep + '..' + path.sep + 'my-comp', function () { return ng(['generate', 'component', 'test' + path.sep + '..' + path.sep + 'my-comp']) .then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-comp', 'my-comp.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-comp', 'my-comp.component.ts'); expect(existsSync(testPath)).to.equal(true); }); }); @@ -65,7 +65,7 @@ describe('Acceptance: ng generate component', function () { return ng(['generate', 'component', 'my-comp']) }) .then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'my-comp', 'my-comp.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'my-comp', 'my-comp.component.ts'); expect(existsSync(testPath)).to.equal(true); }, err => console.log('ERR: ', err)); }); @@ -84,7 +84,7 @@ describe('Acceptance: ng generate component', function () { }) .then(() => { var testPath = path.join( - root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'child-dir', 'my-comp', 'my-comp.ts'); + root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'child-dir', 'my-comp', 'my-comp.component.ts'); expect(existsSync(testPath)).to.equal(true); }, err => console.log('ERR: ', err)); }); @@ -106,7 +106,7 @@ describe('Acceptance: ng generate component', function () { }) .then(() => { var testPath = - path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'my-comp', 'my-comp.ts'); + path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'my-comp', 'my-comp.component.ts'); expect(existsSync(testPath)).to.equal(true); }, err => console.log('ERR: ', err)); }); @@ -126,14 +126,14 @@ describe('Acceptance: ng generate component', function () { return ng(['generate', 'component', path.sep + 'my-comp']) }) .then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-comp', 'my-comp.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-comp', 'my-comp.component.ts'); expect(existsSync(testPath)).to.equal(true); }, err => console.log('ERR: ', err)); }); it('ng generate component ..' + path.sep + 'my-comp from root dir will fail', () => { return ng(['generate', 'component', '..' + path.sep + 'my-comp']).then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '..', 'my-comp', 'my-comp.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '..', 'my-comp', 'my-comp.component.ts'); expect(existsSync(testPath)).to.equal(false); }); }); diff --git a/tests/acceptance/generate-directive.spec.js b/tests/acceptance/generate-directive.spec.js index 088531d179a2..30450bdcee4c 100644 --- a/tests/acceptance/generate-directive.spec.js +++ b/tests/acceptance/generate-directive.spec.js @@ -32,14 +32,14 @@ describe('Acceptance: ng generate directive', function () { it('ng generate directive my-dir', function () { return ng(['generate', 'directive', 'my-dir']).then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-dir', 'my-dir.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-dir', 'my-dir.directive.ts'); expect(existsSync(testPath)).to.equal(true); }); }); it('ng generate directive test' + path.sep + 'my-dir', function () { return ng(['generate', 'directive', 'test' + path.sep + 'my-dir']).then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'test', 'my-dir', 'my-dir.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'test', 'my-dir', 'my-dir.directive.ts'); expect(existsSync(testPath)).to.equal(true); }); }); @@ -47,7 +47,7 @@ describe('Acceptance: ng generate directive', function () { it('ng generate directive test' + path.sep + '..' + path.sep + 'my-dir', function () { return ng(['generate', 'directive', 'test' + path.sep + '..' + path.sep + 'my-dir']) .then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-dir', 'my-dir.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-dir', 'my-dir.directive.ts'); expect(existsSync(testPath)).to.equal(true); }); }); @@ -66,7 +66,7 @@ describe('Acceptance: ng generate directive', function () { return ng(['generate', 'directive', 'my-dir']) }) .then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'my-dir', 'my-dir.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'my-dir', 'my-dir.directive.ts'); expect(existsSync(testPath)).to.equal(true); }, err => console.log('ERR: ', err)); }); @@ -86,7 +86,7 @@ describe('Acceptance: ng generate directive', function () { }) .then(() => { var testPath = path.join( - root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'child-dir', 'my-dir', 'my-dir.ts'); + root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'child-dir', 'my-dir', 'my-dir.directive.ts'); expect(existsSync(testPath)).to.equal(true); }, err => console.log('ERR: ', err)); }); @@ -108,7 +108,7 @@ describe('Acceptance: ng generate directive', function () { }) .then(() => { var testPath = - path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'my-dir', 'my-dir.ts'); + path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'my-dir', 'my-dir.directive.ts'); expect(existsSync(testPath)).to.equal(true); }, err => console.log('ERR: ', err)); }); @@ -129,14 +129,14 @@ describe('Acceptance: ng generate directive', function () { return ng(['generate', 'directive', path.sep + 'my-dir']) }) .then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-dir', 'my-dir.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-dir', 'my-dir.directive.ts'); expect(existsSync(testPath)).to.equal(true); }, err => console.log('ERR: ', err)); }); it('ng generate directive ..' + path.sep + 'my-dir from root dir will fail', () => { return ng(['generate', 'directive', '..' + path.sep + 'my-dir']).then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '..', 'my-dir', 'my-dir.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '..', 'my-dir', 'my-dir.directive.ts'); expect(existsSync(testPath)).to.equal(false); }); }); diff --git a/tests/acceptance/generate-pipe.spec.js b/tests/acceptance/generate-pipe.spec.js index ea33ec47ddca..e8ea02562224 100644 --- a/tests/acceptance/generate-pipe.spec.js +++ b/tests/acceptance/generate-pipe.spec.js @@ -32,21 +32,21 @@ describe('Acceptance: ng generate pipe', function () { it('ng generate pipe my-pipe', function () { return ng(['generate', 'pipe', 'my-pipe']).then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-pipe', 'my-pipe.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-pipe.pipe.ts'); expect(existsSync(testPath)).to.equal(true); }); }); it('ng generate pipe test' + path.sep + 'my-pipe', function () { return ng(['generate', 'pipe', 'test' + path.sep + 'my-pipe']).then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'test', 'my-pipe', 'my-pipe.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'test', 'my-pipe.pipe.ts'); expect(existsSync(testPath)).to.equal(true); }); }); it('ng generate pipe test' + path.sep + '..' + path.sep + 'my-pipe', function () { return ng(['generate', 'pipe', 'test' + path.sep + '..' + path.sep + 'my-pipe']).then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-pipe', 'my-pipe.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-pipe.pipe.ts'); expect(existsSync(testPath)).to.equal(true); }); }); @@ -65,7 +65,7 @@ describe('Acceptance: ng generate pipe', function () { return ng(['generate', 'pipe', 'my-pipe']) }) .then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'my-pipe', 'my-pipe.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'my-pipe.pipe.ts'); expect(existsSync(testPath)).to.equal(true); }, err => console.log('ERR: ', err)); }); @@ -85,7 +85,7 @@ describe('Acceptance: ng generate pipe', function () { }) .then(() => { var testPath = path.join( - root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'child-dir', 'my-pipe', 'my-pipe.ts'); + root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'child-dir', 'my-pipe.pipe.ts'); expect(existsSync(testPath)).to.equal(true); }, err => console.log('ERR: ', err)); }); @@ -104,7 +104,7 @@ describe('Acceptance: ng generate pipe', function () { return ng(['generate', 'pipe', 'child-dir' + path.sep + '..' + path.sep + 'my-pipe']) }) .then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'my-pipe', 'my-pipe.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'my-pipe.pipe.ts'); expect(existsSync(testPath)).to.equal(true); }, err => console.log('ERR: ', err)); }); @@ -125,14 +125,14 @@ describe('Acceptance: ng generate pipe', function () { return ng(['generate', 'pipe', path.sep + 'my-pipe']) }) .then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-pipe', 'my-pipe.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-pipe.pipe.ts'); expect(existsSync(testPath)).to.equal(true); }, err => console.log('ERR: ', err)); }); it('ng generate pipe ..' + path.sep + 'my-pipe from root dir will fail', () => { return ng(['generate', 'pipe', '..' + path.sep + 'my-pipe']).then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '..', 'my-pipe', 'my-pipe.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '..', 'my-pipe.pipe.ts'); expect(existsSync(testPath)).to.equal(false); }); }); diff --git a/tests/acceptance/generate-route.spec.js b/tests/acceptance/generate-route.spec.js index 9652724965ce..5dd5d53c3209 100644 --- a/tests/acceptance/generate-route.spec.js +++ b/tests/acceptance/generate-route.spec.js @@ -1,17 +1,18 @@ 'use strict'; var ng = require('../helpers/ng'); -var sh = require('shelljs'); var existsSync = require('exists-sync'); var expect = require('chai').expect; var path = require('path'); var tmp = require('../helpers/tmp'); var root = process.cwd(); var conf = require('ember-cli/tests/helpers/conf'); -var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-route'); +var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app'); -var fileExpectations = function (expectation) { - expect(existsSync(path.join(testPath, 'my-route.ts'))).to.equal(expectation); +var fileExpectations = function (lazy, expectation) { + var lazyPrefix = lazy ? '+' : ''; + var dir = `${lazyPrefix}my-route`; + expect(existsSync(path.join(testPath, dir, 'my-route.component.ts'))).to.equal(expectation); }; describe('Acceptance: ng generate route', function () { @@ -35,24 +36,13 @@ describe('Acceptance: ng generate route', function () { it('ng generate route my-route', function () { return ng(['generate', 'route', 'my-route']).then(() => { - fileExpectations(true); + fileExpectations(true, true); }); }); - it('ng generate route my-route with skip-router-generation flag does not generate router config', - function () { - return ng(['generate', 'route', 'my-route', '--skip-router-generation']).then(() => { - fileExpectations(true); - }); + + it('ng generate route my-route --lazy false', function () { + return ng(['generate', 'route', 'my-route', '--lazy', 'false']).then(() => { + fileExpectations(false, true); }); - it('ng generate route my-route then destroy', function () { - return ng(['generate', 'route', 'my-route']) - .then(() => fileExpectations(true)) - .then(() => ng(['destroy', 'route', 'my-route'])) - .then(() => { - fileExpectations(false); - - // Expect everything to be the same as before. - expect(sh.exec('git status --porcelain').output).to.be.equal(''); - }); }); }); diff --git a/tests/acceptance/generate-service.spec.js b/tests/acceptance/generate-service.spec.js index 2633a7223d1e..54fe5466cd23 100644 --- a/tests/acceptance/generate-service.spec.js +++ b/tests/acceptance/generate-service.spec.js @@ -32,21 +32,21 @@ describe('Acceptance: ng generate service', function () { it('ng generate service my-svc', function () { return ng(['generate', 'service', 'my-svc']).then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-svc', 'my-svc.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-svc.service.ts'); expect(existsSync(testPath)).to.equal(true); }); }); it('ng generate service test' + path.sep + 'my-svc', function () { return ng(['generate', 'service', 'test' + path.sep + 'my-svc']).then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'test', 'my-svc', 'my-svc.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'test', 'my-svc.service.ts'); expect(existsSync(testPath)).to.equal(true); }); }); it('ng generate service test' + path.sep + '..' + path.sep + 'my-svc', function () { return ng(['generate', 'service', 'test' + path.sep + '..' + path.sep + 'my-svc']).then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-svc', 'my-svc.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-svc.service.ts'); expect(existsSync(testPath)).to.equal(true); }); }); @@ -65,7 +65,7 @@ describe('Acceptance: ng generate service', function () { return ng(['generate', 'service', 'my-svc']) }) .then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'my-svc', 'my-svc.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'my-svc.service.ts'); expect(existsSync(testPath)).to.equal(true); }, err => console.log('ERR: ', err)); }); @@ -85,7 +85,7 @@ describe('Acceptance: ng generate service', function () { }) .then(() => { var testPath = path.join( - root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'child-dir', 'my-svc', 'my-svc.ts'); + root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'child-dir', 'my-svc.service.ts'); expect(existsSync(testPath)).to.equal(true); }, err => console.log('ERR: ', err)); }); @@ -107,7 +107,7 @@ describe('Acceptance: ng generate service', function () { }) .then(() => { var testPath = - path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'my-svc', 'my-svc.ts'); + path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '1', 'my-svc.service.ts'); expect(existsSync(testPath)).to.equal(true); }, err => console.log('ERR: ', err)); }); @@ -128,14 +128,14 @@ describe('Acceptance: ng generate service', function () { return ng(['generate', 'service', path.sep + 'my-svc']) }) .then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-svc', 'my-svc.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', 'my-svc.service.ts'); expect(existsSync(testPath)).to.equal(true); }, err => console.log('ERR: ', err)); }); it('ng generate service ..' + path.sep + 'my-svc from root dir will fail', () => { return ng(['generate', 'service', '..' + path.sep + 'my-svc']).then(() => { - var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '..', 'my-svc', 'my-svc.ts'); + var testPath = path.join(root, 'tmp', 'foo', 'src', 'client', 'app', '..', 'my-svc.service.ts'); expect(existsSync(testPath)).to.equal(false); }); }); diff --git a/tests/acceptance/init.spec.js b/tests/acceptance/init.spec.js index 2bcd968b2eaf..638043e908ba 100644 --- a/tests/acceptance/init.spec.js +++ b/tests/acceptance/init.spec.js @@ -53,6 +53,7 @@ describe('Acceptance: ng init', function () { expected.forEach(function (file, index) { expected[index] = file.replace(/__name__/g, 'tmp'); + expected[index] = expected[index].replace(/__styleext__/g, 'css'); }); removeIgnored(expected); diff --git a/tests/e2e/e2e_workflow.spec.js b/tests/e2e/e2e_workflow.spec.js index c6c3fd75c367..842cc4796825 100644 --- a/tests/e2e/e2e_workflow.spec.js +++ b/tests/e2e/e2e_workflow.spec.js @@ -203,8 +203,8 @@ describe('Basic end-to-end Workflow', function () { return ng(['generate', 'component', 'test-component']) .then(() => { let componentPath = path.join(process.cwd(), 'src', 'client', 'app', 'test-component'); - let cssFile = path.join(componentPath, 'test-component.css'); - let scssFile = path.join(componentPath, 'test-component.scss'); + let cssFile = path.join(componentPath, 'test-component.component.css'); + let scssFile = path.join(componentPath, 'test-component.component.scss'); expect(existsSync(componentPath)).to.be.equal(true); sh.mv(cssFile, scssFile); @@ -214,7 +214,7 @@ describe('Basic end-to-end Workflow', function () { fs.writeFileSync(scssFile, scssExample, 'utf8'); sh.exec('ng build --silent'); - let destCss = path.join(process.cwd(), 'dist', 'app', 'test-component', 'test-component.css'); + let destCss = path.join(process.cwd(), 'dist', 'app', 'test-component', 'test-component.component.css'); expect(existsSync(destCss)).to.be.equal(true); let contents = fs.readFileSync(destCss, 'utf8'); expect(contents).to.include('.outer .inner'); @@ -238,8 +238,8 @@ describe('Basic end-to-end Workflow', function () { return ng(['generate', 'component', 'test-component']) .then(() => { let componentPath = path.join(process.cwd(), 'src', 'client', 'app', 'test-component'); - let cssFile = path.join(componentPath, 'test-component.css'); - let lessFile = path.join(componentPath, 'test-component.less'); + let cssFile = path.join(componentPath, 'test-component.component.css'); + let lessFile = path.join(componentPath, 'test-component.component.less'); expect(existsSync(componentPath)).to.be.equal(true); sh.mv(cssFile, lessFile); @@ -249,7 +249,7 @@ describe('Basic end-to-end Workflow', function () { fs.writeFileSync(lessFile, lessExample, 'utf8'); sh.exec('ng build --silent'); - let destCss = path.join(process.cwd(), 'dist', 'app', 'test-component', 'test-component.css'); + let destCss = path.join(process.cwd(), 'dist', 'app', 'test-component', 'test-component.component.css'); expect(existsSync(destCss)).to.be.equal(true); let contents = fs.readFileSync(destCss, 'utf8'); expect(contents).to.include('.outer .inner'); @@ -273,8 +273,8 @@ describe('Basic end-to-end Workflow', function () { return ng(['generate', 'component', 'test-component']) .then(() => { let componentPath = path.join(process.cwd(), 'src', 'client', 'app', 'test-component'); - let cssFile = path.join(componentPath, 'test-component.css'); - let stylusFile = path.join(componentPath, 'test-component.styl'); + let cssFile = path.join(componentPath, 'test-component.component.css'); + let stylusFile = path.join(componentPath, 'test-component.component.styl'); sh.mv(cssFile, stylusFile); expect(existsSync(stylusFile)).to.be.equal(true); @@ -283,7 +283,7 @@ describe('Basic end-to-end Workflow', function () { fs.writeFileSync(stylusFile, stylusExample, 'utf8'); sh.exec('ng build --silent'); - let destCss = path.join(process.cwd(), 'dist', 'app', 'test-component', 'test-component.css'); + let destCss = path.join(process.cwd(), 'dist', 'app', 'test-component', 'test-component.component.css'); expect(existsSync(destCss)).to.be.equal(true); let contents = fs.readFileSync(destCss, 'utf8'); expect(contents).to.include('.outer .inner');