From 8c93461a18d29b803ab892d64ec6c5e7a0b44d0e Mon Sep 17 00:00:00 2001 From: Danny Blue Date: Sat, 21 May 2016 00:25:11 -0400 Subject: [PATCH 1/5] fix(template): remove /... from generated child routes --- addon/ng2/blueprints/route/index.js | 25 +++++++++---------------- tests/acceptance/generate-route.spec.js | 6 +++--- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/addon/ng2/blueprints/route/index.js b/addon/ng2/blueprints/route/index.js index 780de6a19d32..c1de53173b9a 100644 --- a/addon/ng2/blueprints/route/index.js +++ b/addon/ng2/blueprints/route/index.js @@ -350,28 +350,21 @@ module.exports = { } let parentComponentName = path.basename(parsedPath.dir); - if (parentComponentName[0] == '+') parentComponentName = parentComponentName.substr(1); + + if (parentComponentName[0] === '+') { + parentComponentName = parentComponentName.substr(1); + } + const jsComponentName = stringUtils.classify(parentComponentName); - const routeRegex = new RegExp(`^\\s*\\{.*component: ${jsComponentName}.*` - + '\\},?\\s*\\n?', 'm'); + const routeRegex = new RegExp(`^\\s*\\{.*component: ${jsComponentName}.*` + '\\},?\\s*\\n?', 'm'); let content = fs.readFileSync(gParentFile, 'utf-8'); const m = content.match(routeRegex); + if (m) { - // Replace `path: '/blah'` with the proper `path: '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/blah/...'`. - let json = m[0].replace(/(path:\s*['"])([^'"]+?)(['"])/, function(m, prefix, value, suffix) { - // If the path isn't ending with `...`, add it (with a URL separator). - if (!value.match(/\.\.\.$/)) { - if (!value.match(/\/$/)) { - value += '/'; - } - value += '...'; - } - return prefix + value + suffix; - }); - content = content.substr(0, m.index) + json + content.substr(m.index + m[0].length); + content = content.substr(0, m.index) + m[0] + content.substr(m.index + m[0].length); } fs.writeFileSync(gParentFile, content, 'utf-8'); } -}; +}; \ No newline at end of file diff --git a/tests/acceptance/generate-route.spec.js b/tests/acceptance/generate-route.spec.js index ce665427a56d..19d4f16289b7 100644 --- a/tests/acceptance/generate-route.spec.js +++ b/tests/acceptance/generate-route.spec.js @@ -72,8 +72,8 @@ describe('Acceptance: ng generate route', function () { const myOtherRouteContent = fs.readFileSync(path.join(testPath, '+my-route/+my-other/my-other.component.ts'), 'utf-8'); const myThirdRouteContent = fs.readFileSync(path.join(testPath, '+my-route/+my-other/+my-third/my-third.component.ts'), 'utf-8'); - expect(appContent).to.match(/@Routes\(\[[\s\S]+\/\+my-route\/\.\.\.[\s\S]+\]\)/m); - expect(myRouteContent).to.match(/@Routes\(\[[\s\S]+\/my-other\/\.\.\.[\s\S]+\]\)/m); + expect(appContent).to.match(/@Routes\(\[[\s\S]+\/\+my-route[\s\S]+\]\)/m); + expect(myRouteContent).to.match(/@Routes\(\[[\s\S]+\/my-other[\s\S]+\]\)/m); expect(myOtherRouteContent).to.match(/@Routes\(\[[\s\S]+\/my-third[^\.][\s\S]+\]\)/m); expect(myThirdRouteContent).to.not.include('@Routes'); }); @@ -102,4 +102,4 @@ describe('Acceptance: ng generate route', function () { expect(afterGenerateParentHtml).to.equal(unmodifiedParentComponentHtml); }); }); -}); +}); \ No newline at end of file From 25c797b0dc23a547100ff412ad8e37f21e74bbb6 Mon Sep 17 00:00:00 2001 From: Danny Blue Date: Sat, 21 May 2016 00:25:11 -0400 Subject: [PATCH 2/5] fix(template): remove /... from generated child routes add correct white space to routes and remove unused function --- addon/ng2/blueprints/route/index.js | 55 +++---------------------- tests/acceptance/generate-route.spec.js | 6 +-- 2 files changed, 9 insertions(+), 52 deletions(-) diff --git a/addon/ng2/blueprints/route/index.js b/addon/ng2/blueprints/route/index.js index 780de6a19d32..43a8cca7431c 100644 --- a/addon/ng2/blueprints/route/index.js +++ b/addon/ng2/blueprints/route/index.js @@ -6,12 +6,10 @@ const dynamicPathParser = require('../../utilities/dynamic-path-parser'); const stringUtils = require('ember-cli-string-utils'); const Blueprint = require('ember-cli/lib/models/blueprint'); - function _regexEscape(str) { return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); } - function _insertImport(content, symbolName, fileName) { // Check if an import from the same file is there. const importRegex = new RegExp('' + @@ -123,7 +121,6 @@ module.exports = { } this._addRouteToParent(options); - this._verifyParentRoute(options); }, afterUninstall: function (options) { @@ -229,16 +226,15 @@ module.exports = { // Insert the import statement. let content = fs.readFileSync(parentFile, 'utf-8'); - content = _insertImport(content, `${jsComponentName}Component`, - `./${options.isLazyRoute ? '+' : ''}${stringUtils.dasherize(base)}`); + content = _insertImport(content, `${jsComponentName}Component`, `./${options.isLazyRoute ? '+' : ''}${stringUtils.dasherize(base)}`); let defaultReg = options.default ? ', useAsDefault: true' : ''; let routePath = options.path || `/${base}`; - let route = '{' + let route = '{ ' + `path: '${routePath}', ` + `component: ${jsComponentName}Component` + defaultReg - + '}'; + + ' }'; // Add the route configuration. content = _addRoutes(content); @@ -256,7 +252,7 @@ module.exports = { content = content.replace(/(@Component\(\{)([\s\S\n]*?)(\n\}\))/m, function(_, prefix, json, suffix) { const m = json.match(/(^\s+directives:\s*\[)([\s\S\n]*)(\]\s*,?.*$)/m); if (m) { - if (m[2].indexOf('ROUTER_DIRECTIVES') != -1) { + if (m[2].indexOf('ROUTER_DIRECTIVES') !== -1) { // Already there. return _; } @@ -314,6 +310,7 @@ module.exports = { } else { // There's no template, look for the HTML file. const htmlFile = parentFile.replace(/\.ts$/, '.html'); + if (!fs.existsSync(htmlFile)) { // eslint-disable-next-line no-console console.log('Cannot find HTML: ' + htmlFile); @@ -333,45 +330,5 @@ module.exports = { }); fs.writeFileSync(parentFile, content, 'utf-8'); - }, - - _verifyParentRoute: function() { - const parsedPath = this.dynamicPath; - const parentFile = this._findParentRouteFile(parsedPath.dir); - if (!parentFile) { - return; - } - - const gParentDir = path.dirname(path.dirname(parentFile)); - const gParentFile = this._findParentRouteFile(gParentDir); - - if (!gParentFile) { - return; - } - - let parentComponentName = path.basename(parsedPath.dir); - if (parentComponentName[0] == '+') parentComponentName = parentComponentName.substr(1); - const jsComponentName = stringUtils.classify(parentComponentName); - const routeRegex = new RegExp(`^\\s*\\{.*component: ${jsComponentName}.*` - + '\\},?\\s*\\n?', 'm'); - - let content = fs.readFileSync(gParentFile, 'utf-8'); - const m = content.match(routeRegex); - if (m) { - // Replace `path: '/blah'` with the proper `path: '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/blah/...'`. - let json = m[0].replace(/(path:\s*['"])([^'"]+?)(['"])/, function(m, prefix, value, suffix) { - // If the path isn't ending with `...`, add it (with a URL separator). - if (!value.match(/\.\.\.$/)) { - if (!value.match(/\/$/)) { - value += '/'; - } - value += '...'; - } - return prefix + value + suffix; - }); - content = content.substr(0, m.index) + json + content.substr(m.index + m[0].length); - } - - fs.writeFileSync(gParentFile, content, 'utf-8'); } -}; +}; \ No newline at end of file diff --git a/tests/acceptance/generate-route.spec.js b/tests/acceptance/generate-route.spec.js index ce665427a56d..19d4f16289b7 100644 --- a/tests/acceptance/generate-route.spec.js +++ b/tests/acceptance/generate-route.spec.js @@ -72,8 +72,8 @@ describe('Acceptance: ng generate route', function () { const myOtherRouteContent = fs.readFileSync(path.join(testPath, '+my-route/+my-other/my-other.component.ts'), 'utf-8'); const myThirdRouteContent = fs.readFileSync(path.join(testPath, '+my-route/+my-other/+my-third/my-third.component.ts'), 'utf-8'); - expect(appContent).to.match(/@Routes\(\[[\s\S]+\/\+my-route\/\.\.\.[\s\S]+\]\)/m); - expect(myRouteContent).to.match(/@Routes\(\[[\s\S]+\/my-other\/\.\.\.[\s\S]+\]\)/m); + expect(appContent).to.match(/@Routes\(\[[\s\S]+\/\+my-route[\s\S]+\]\)/m); + expect(myRouteContent).to.match(/@Routes\(\[[\s\S]+\/my-other[\s\S]+\]\)/m); expect(myOtherRouteContent).to.match(/@Routes\(\[[\s\S]+\/my-third[^\.][\s\S]+\]\)/m); expect(myThirdRouteContent).to.not.include('@Routes'); }); @@ -102,4 +102,4 @@ describe('Acceptance: ng generate route', function () { expect(afterGenerateParentHtml).to.equal(unmodifiedParentComponentHtml); }); }); -}); +}); \ No newline at end of file From 032193d01459e72318914f9d70afab48a56e3eb8 Mon Sep 17 00:00:00 2001 From: Danny Blue Date: Sat, 21 May 2016 00:25:11 -0400 Subject: [PATCH 3/5] fix(template): remove /... from generated child routes add correct white space to routes and remove unused function --- addon/ng2/blueprints/route/index.js | 46 ++++------------------------- 1 file changed, 5 insertions(+), 41 deletions(-) diff --git a/addon/ng2/blueprints/route/index.js b/addon/ng2/blueprints/route/index.js index c1de53173b9a..43a8cca7431c 100644 --- a/addon/ng2/blueprints/route/index.js +++ b/addon/ng2/blueprints/route/index.js @@ -6,12 +6,10 @@ const dynamicPathParser = require('../../utilities/dynamic-path-parser'); const stringUtils = require('ember-cli-string-utils'); const Blueprint = require('ember-cli/lib/models/blueprint'); - function _regexEscape(str) { return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); } - function _insertImport(content, symbolName, fileName) { // Check if an import from the same file is there. const importRegex = new RegExp('' + @@ -123,7 +121,6 @@ module.exports = { } this._addRouteToParent(options); - this._verifyParentRoute(options); }, afterUninstall: function (options) { @@ -229,16 +226,15 @@ module.exports = { // Insert the import statement. let content = fs.readFileSync(parentFile, 'utf-8'); - content = _insertImport(content, `${jsComponentName}Component`, - `./${options.isLazyRoute ? '+' : ''}${stringUtils.dasherize(base)}`); + content = _insertImport(content, `${jsComponentName}Component`, `./${options.isLazyRoute ? '+' : ''}${stringUtils.dasherize(base)}`); let defaultReg = options.default ? ', useAsDefault: true' : ''; let routePath = options.path || `/${base}`; - let route = '{' + let route = '{ ' + `path: '${routePath}', ` + `component: ${jsComponentName}Component` + defaultReg - + '}'; + + ' }'; // Add the route configuration. content = _addRoutes(content); @@ -256,7 +252,7 @@ module.exports = { content = content.replace(/(@Component\(\{)([\s\S\n]*?)(\n\}\))/m, function(_, prefix, json, suffix) { const m = json.match(/(^\s+directives:\s*\[)([\s\S\n]*)(\]\s*,?.*$)/m); if (m) { - if (m[2].indexOf('ROUTER_DIRECTIVES') != -1) { + if (m[2].indexOf('ROUTER_DIRECTIVES') !== -1) { // Already there. return _; } @@ -314,6 +310,7 @@ module.exports = { } else { // There's no template, look for the HTML file. const htmlFile = parentFile.replace(/\.ts$/, '.html'); + if (!fs.existsSync(htmlFile)) { // eslint-disable-next-line no-console console.log('Cannot find HTML: ' + htmlFile); @@ -333,38 +330,5 @@ module.exports = { }); fs.writeFileSync(parentFile, content, 'utf-8'); - }, - - _verifyParentRoute: function() { - const parsedPath = this.dynamicPath; - const parentFile = this._findParentRouteFile(parsedPath.dir); - if (!parentFile) { - return; - } - - const gParentDir = path.dirname(path.dirname(parentFile)); - const gParentFile = this._findParentRouteFile(gParentDir); - - if (!gParentFile) { - return; - } - - let parentComponentName = path.basename(parsedPath.dir); - - if (parentComponentName[0] === '+') { - parentComponentName = parentComponentName.substr(1); - } - - const jsComponentName = stringUtils.classify(parentComponentName); - const routeRegex = new RegExp(`^\\s*\\{.*component: ${jsComponentName}.*` + '\\},?\\s*\\n?', 'm'); - - let content = fs.readFileSync(gParentFile, 'utf-8'); - const m = content.match(routeRegex); - - if (m) { - content = content.substr(0, m.index) + m[0] + content.substr(m.index + m[0].length); - } - - fs.writeFileSync(gParentFile, content, 'utf-8'); } }; \ No newline at end of file From d87fbf8fe8cd7c7a08a81de1143197252bbcec18 Mon Sep 17 00:00:00 2001 From: Danny Blue Date: Mon, 23 May 2016 12:00:56 -0400 Subject: [PATCH 4/5] fix(template): remove /... from generated child routes --- addon/ng2/blueprints/route/index.js | 55 +++---------------------- tests/acceptance/generate-route.spec.js | 6 +-- 2 files changed, 9 insertions(+), 52 deletions(-) diff --git a/addon/ng2/blueprints/route/index.js b/addon/ng2/blueprints/route/index.js index 780de6a19d32..43a8cca7431c 100644 --- a/addon/ng2/blueprints/route/index.js +++ b/addon/ng2/blueprints/route/index.js @@ -6,12 +6,10 @@ const dynamicPathParser = require('../../utilities/dynamic-path-parser'); const stringUtils = require('ember-cli-string-utils'); const Blueprint = require('ember-cli/lib/models/blueprint'); - function _regexEscape(str) { return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); } - function _insertImport(content, symbolName, fileName) { // Check if an import from the same file is there. const importRegex = new RegExp('' + @@ -123,7 +121,6 @@ module.exports = { } this._addRouteToParent(options); - this._verifyParentRoute(options); }, afterUninstall: function (options) { @@ -229,16 +226,15 @@ module.exports = { // Insert the import statement. let content = fs.readFileSync(parentFile, 'utf-8'); - content = _insertImport(content, `${jsComponentName}Component`, - `./${options.isLazyRoute ? '+' : ''}${stringUtils.dasherize(base)}`); + content = _insertImport(content, `${jsComponentName}Component`, `./${options.isLazyRoute ? '+' : ''}${stringUtils.dasherize(base)}`); let defaultReg = options.default ? ', useAsDefault: true' : ''; let routePath = options.path || `/${base}`; - let route = '{' + let route = '{ ' + `path: '${routePath}', ` + `component: ${jsComponentName}Component` + defaultReg - + '}'; + + ' }'; // Add the route configuration. content = _addRoutes(content); @@ -256,7 +252,7 @@ module.exports = { content = content.replace(/(@Component\(\{)([\s\S\n]*?)(\n\}\))/m, function(_, prefix, json, suffix) { const m = json.match(/(^\s+directives:\s*\[)([\s\S\n]*)(\]\s*,?.*$)/m); if (m) { - if (m[2].indexOf('ROUTER_DIRECTIVES') != -1) { + if (m[2].indexOf('ROUTER_DIRECTIVES') !== -1) { // Already there. return _; } @@ -314,6 +310,7 @@ module.exports = { } else { // There's no template, look for the HTML file. const htmlFile = parentFile.replace(/\.ts$/, '.html'); + if (!fs.existsSync(htmlFile)) { // eslint-disable-next-line no-console console.log('Cannot find HTML: ' + htmlFile); @@ -333,45 +330,5 @@ module.exports = { }); fs.writeFileSync(parentFile, content, 'utf-8'); - }, - - _verifyParentRoute: function() { - const parsedPath = this.dynamicPath; - const parentFile = this._findParentRouteFile(parsedPath.dir); - if (!parentFile) { - return; - } - - const gParentDir = path.dirname(path.dirname(parentFile)); - const gParentFile = this._findParentRouteFile(gParentDir); - - if (!gParentFile) { - return; - } - - let parentComponentName = path.basename(parsedPath.dir); - if (parentComponentName[0] == '+') parentComponentName = parentComponentName.substr(1); - const jsComponentName = stringUtils.classify(parentComponentName); - const routeRegex = new RegExp(`^\\s*\\{.*component: ${jsComponentName}.*` - + '\\},?\\s*\\n?', 'm'); - - let content = fs.readFileSync(gParentFile, 'utf-8'); - const m = content.match(routeRegex); - if (m) { - // Replace `path: '/blah'` with the proper `path: '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/blah/...'`. - let json = m[0].replace(/(path:\s*['"])([^'"]+?)(['"])/, function(m, prefix, value, suffix) { - // If the path isn't ending with `...`, add it (with a URL separator). - if (!value.match(/\.\.\.$/)) { - if (!value.match(/\/$/)) { - value += '/'; - } - value += '...'; - } - return prefix + value + suffix; - }); - content = content.substr(0, m.index) + json + content.substr(m.index + m[0].length); - } - - fs.writeFileSync(gParentFile, content, 'utf-8'); } -}; +}; \ No newline at end of file diff --git a/tests/acceptance/generate-route.spec.js b/tests/acceptance/generate-route.spec.js index ce665427a56d..19d4f16289b7 100644 --- a/tests/acceptance/generate-route.spec.js +++ b/tests/acceptance/generate-route.spec.js @@ -72,8 +72,8 @@ describe('Acceptance: ng generate route', function () { const myOtherRouteContent = fs.readFileSync(path.join(testPath, '+my-route/+my-other/my-other.component.ts'), 'utf-8'); const myThirdRouteContent = fs.readFileSync(path.join(testPath, '+my-route/+my-other/+my-third/my-third.component.ts'), 'utf-8'); - expect(appContent).to.match(/@Routes\(\[[\s\S]+\/\+my-route\/\.\.\.[\s\S]+\]\)/m); - expect(myRouteContent).to.match(/@Routes\(\[[\s\S]+\/my-other\/\.\.\.[\s\S]+\]\)/m); + expect(appContent).to.match(/@Routes\(\[[\s\S]+\/\+my-route[\s\S]+\]\)/m); + expect(myRouteContent).to.match(/@Routes\(\[[\s\S]+\/my-other[\s\S]+\]\)/m); expect(myOtherRouteContent).to.match(/@Routes\(\[[\s\S]+\/my-third[^\.][\s\S]+\]\)/m); expect(myThirdRouteContent).to.not.include('@Routes'); }); @@ -102,4 +102,4 @@ describe('Acceptance: ng generate route', function () { expect(afterGenerateParentHtml).to.equal(unmodifiedParentComponentHtml); }); }); -}); +}); \ No newline at end of file From 4774110c9ecd69b7edea5eac4cf9104c0eebbc11 Mon Sep 17 00:00:00 2001 From: Danny Blue Date: Mon, 23 May 2016 12:00:56 -0400 Subject: [PATCH 5/5] fix(template): remove /... from generated child routes fix(template): remove /... from generated child routes add correct white space to routes and remove unused function fix(template): remove /... from generated child routes add correct white space to routes and remove unused function --- addon/ng2/blueprints/route/index.js | 55 +++---------------------- tests/acceptance/generate-route.spec.js | 6 +-- 2 files changed, 9 insertions(+), 52 deletions(-) diff --git a/addon/ng2/blueprints/route/index.js b/addon/ng2/blueprints/route/index.js index 780de6a19d32..43a8cca7431c 100644 --- a/addon/ng2/blueprints/route/index.js +++ b/addon/ng2/blueprints/route/index.js @@ -6,12 +6,10 @@ const dynamicPathParser = require('../../utilities/dynamic-path-parser'); const stringUtils = require('ember-cli-string-utils'); const Blueprint = require('ember-cli/lib/models/blueprint'); - function _regexEscape(str) { return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); } - function _insertImport(content, symbolName, fileName) { // Check if an import from the same file is there. const importRegex = new RegExp('' + @@ -123,7 +121,6 @@ module.exports = { } this._addRouteToParent(options); - this._verifyParentRoute(options); }, afterUninstall: function (options) { @@ -229,16 +226,15 @@ module.exports = { // Insert the import statement. let content = fs.readFileSync(parentFile, 'utf-8'); - content = _insertImport(content, `${jsComponentName}Component`, - `./${options.isLazyRoute ? '+' : ''}${stringUtils.dasherize(base)}`); + content = _insertImport(content, `${jsComponentName}Component`, `./${options.isLazyRoute ? '+' : ''}${stringUtils.dasherize(base)}`); let defaultReg = options.default ? ', useAsDefault: true' : ''; let routePath = options.path || `/${base}`; - let route = '{' + let route = '{ ' + `path: '${routePath}', ` + `component: ${jsComponentName}Component` + defaultReg - + '}'; + + ' }'; // Add the route configuration. content = _addRoutes(content); @@ -256,7 +252,7 @@ module.exports = { content = content.replace(/(@Component\(\{)([\s\S\n]*?)(\n\}\))/m, function(_, prefix, json, suffix) { const m = json.match(/(^\s+directives:\s*\[)([\s\S\n]*)(\]\s*,?.*$)/m); if (m) { - if (m[2].indexOf('ROUTER_DIRECTIVES') != -1) { + if (m[2].indexOf('ROUTER_DIRECTIVES') !== -1) { // Already there. return _; } @@ -314,6 +310,7 @@ module.exports = { } else { // There's no template, look for the HTML file. const htmlFile = parentFile.replace(/\.ts$/, '.html'); + if (!fs.existsSync(htmlFile)) { // eslint-disable-next-line no-console console.log('Cannot find HTML: ' + htmlFile); @@ -333,45 +330,5 @@ module.exports = { }); fs.writeFileSync(parentFile, content, 'utf-8'); - }, - - _verifyParentRoute: function() { - const parsedPath = this.dynamicPath; - const parentFile = this._findParentRouteFile(parsedPath.dir); - if (!parentFile) { - return; - } - - const gParentDir = path.dirname(path.dirname(parentFile)); - const gParentFile = this._findParentRouteFile(gParentDir); - - if (!gParentFile) { - return; - } - - let parentComponentName = path.basename(parsedPath.dir); - if (parentComponentName[0] == '+') parentComponentName = parentComponentName.substr(1); - const jsComponentName = stringUtils.classify(parentComponentName); - const routeRegex = new RegExp(`^\\s*\\{.*component: ${jsComponentName}.*` - + '\\},?\\s*\\n?', 'm'); - - let content = fs.readFileSync(gParentFile, 'utf-8'); - const m = content.match(routeRegex); - if (m) { - // Replace `path: '/blah'` with the proper `path: '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/blah/...'`. - let json = m[0].replace(/(path:\s*['"])([^'"]+?)(['"])/, function(m, prefix, value, suffix) { - // If the path isn't ending with `...`, add it (with a URL separator). - if (!value.match(/\.\.\.$/)) { - if (!value.match(/\/$/)) { - value += '/'; - } - value += '...'; - } - return prefix + value + suffix; - }); - content = content.substr(0, m.index) + json + content.substr(m.index + m[0].length); - } - - fs.writeFileSync(gParentFile, content, 'utf-8'); } -}; +}; \ No newline at end of file diff --git a/tests/acceptance/generate-route.spec.js b/tests/acceptance/generate-route.spec.js index ce665427a56d..19d4f16289b7 100644 --- a/tests/acceptance/generate-route.spec.js +++ b/tests/acceptance/generate-route.spec.js @@ -72,8 +72,8 @@ describe('Acceptance: ng generate route', function () { const myOtherRouteContent = fs.readFileSync(path.join(testPath, '+my-route/+my-other/my-other.component.ts'), 'utf-8'); const myThirdRouteContent = fs.readFileSync(path.join(testPath, '+my-route/+my-other/+my-third/my-third.component.ts'), 'utf-8'); - expect(appContent).to.match(/@Routes\(\[[\s\S]+\/\+my-route\/\.\.\.[\s\S]+\]\)/m); - expect(myRouteContent).to.match(/@Routes\(\[[\s\S]+\/my-other\/\.\.\.[\s\S]+\]\)/m); + expect(appContent).to.match(/@Routes\(\[[\s\S]+\/\+my-route[\s\S]+\]\)/m); + expect(myRouteContent).to.match(/@Routes\(\[[\s\S]+\/my-other[\s\S]+\]\)/m); expect(myOtherRouteContent).to.match(/@Routes\(\[[\s\S]+\/my-third[^\.][\s\S]+\]\)/m); expect(myThirdRouteContent).to.not.include('@Routes'); }); @@ -102,4 +102,4 @@ describe('Acceptance: ng generate route', function () { expect(afterGenerateParentHtml).to.equal(unmodifiedParentComponentHtml); }); }); -}); +}); \ No newline at end of file