From ea13f46203c8c9eefce9698ce579072dbb23ab60 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Tue, 29 Aug 2017 14:40:16 -0400 Subject: [PATCH 1/2] Ensure internal `layoutFor` lookups for namespaced templates works. --- addon/resolvers/classic/index.js | 5 +++++ tests/unit/resolvers/classic/basic-test.js | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/addon/resolvers/classic/index.js b/addon/resolvers/classic/index.js index 713dfa9b..6c0f8d7c 100644 --- a/addon/resolvers/classic/index.js +++ b/addon/resolvers/classic/index.js @@ -72,6 +72,11 @@ function parseName(fullName) { type = nameParts[0]; name = nameParts[1]; } + + if (type === 'template' && prefix.lastIndexOf('components/', 0) === 0) { + name = `components/${name}`; + prefix = prefix.slice(11); + } } else { fullNameParts = fullName.split(':'); type = fullNameParts[0]; diff --git a/tests/unit/resolvers/classic/basic-test.js b/tests/unit/resolvers/classic/basic-test.js index 43b7b9b6..fd551a04 100644 --- a/tests/unit/resolvers/classic/basic-test.js +++ b/tests/unit/resolvers/classic/basic-test.js @@ -175,6 +175,21 @@ test("can lookup a view in another namespace with different syntax", function(as assert.equal(view, expected, 'default export was returned'); }); +test("can lookup a component template in another namespace with different syntax", function(assert) { + assert.expect(2); + + let expected = { isTemplate: true }; + define('other/templates/components/foo-bar', [], function(){ + assert.ok(true, "template was looked up properly"); + + return { default: expected }; + }); + + var template = resolver.resolve('template:components/other@foo-bar'); + + assert.equal(template, expected, 'default export was returned'); +}); + test("can lookup a view", function(assert) { assert.expect(3); From fb272445720b8ad453e870acff86c30307d96cd1 Mon Sep 17 00:00:00 2001 From: Robert Jackson Date: Tue, 29 Aug 2017 14:41:08 -0400 Subject: [PATCH 2/2] Update yarn.lock. --- yarn.lock | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index e0d71631..8b76c5f2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -534,6 +534,12 @@ babel-plugin-ember-modules-api-polyfill@^1.5.0: dependencies: ember-rfc176-data "^0.2.0" +babel-plugin-ember-modules-api-polyfill@^1.5.1: + version "1.6.0" + resolved "https://registry.yarnpkg.com/babel-plugin-ember-modules-api-polyfill/-/babel-plugin-ember-modules-api-polyfill-1.6.0.tgz#abd1afa4237b3121cb51222f9bf3283cad8990aa" + dependencies: + ember-rfc176-data "^0.2.0" + babel-plugin-eval@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/babel-plugin-eval/-/babel-plugin-eval-1.0.1.tgz#a2faed25ce6be69ade4bfec263f70169195950da" @@ -1830,7 +1836,7 @@ ember-cli-babel@^5.1.6: ember-cli-version-checker "^1.0.2" resolve "^1.1.2" -ember-cli-babel@^6.0.0-beta.7, ember-cli-babel@^6.8.0: +ember-cli-babel@^6.0.0-beta.7: version "6.8.0" resolved "https://registry.yarnpkg.com/ember-cli-babel/-/ember-cli-babel-6.8.0.tgz#8f8d65e38439e4d343b701bcc0ac6ebd785a0e98" dependencies: @@ -1847,6 +1853,23 @@ ember-cli-babel@^6.0.0-beta.7, ember-cli-babel@^6.8.0: clone "^2.0.0" ember-cli-version-checker "^2.0.0" +ember-cli-babel@^6.8.1: + version "6.8.1" + resolved "https://registry.yarnpkg.com/ember-cli-babel/-/ember-cli-babel-6.8.1.tgz#695f94c57a9375c2a0e219306a41105d6b937991" + dependencies: + amd-name-resolver "0.0.7" + babel-plugin-debug-macros "^0.1.11" + babel-plugin-ember-modules-api-polyfill "^1.5.1" + babel-plugin-transform-es2015-modules-amd "^6.24.0" + babel-polyfill "^6.16.0" + babel-preset-env "^1.5.1" + broccoli-babel-transpiler "^6.1.2" + broccoli-debug "^0.6.2" + broccoli-funnel "^1.0.0" + broccoli-source "^1.1.0" + clone "^2.0.0" + ember-cli-version-checker "^2.0.0" + ember-cli-broccoli-sane-watcher@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/ember-cli-broccoli-sane-watcher/-/ember-cli-broccoli-sane-watcher-2.0.4.tgz#f43f42f75b7509c212fb926cd9aea86ae19264c6"