Skip to content

Commit

Permalink
Merge pull request #213 from rwjblue/fix-template-lookup-with-other-n…
Browse files Browse the repository at this point in the history
…amespace

Ensure internal `layoutFor` lookups for namespaced templates works.
  • Loading branch information
rwjblue committed Aug 29, 2017
2 parents 09363b6 + fb27244 commit bea3e86
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
5 changes: 5 additions & 0 deletions addon/resolvers/classic/index.js
Expand Up @@ -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];
Expand Down
15 changes: 15 additions & 0 deletions tests/unit/resolvers/classic/basic-test.js
Expand Up @@ -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);

Expand Down
25 changes: 24 additions & 1 deletion yarn.lock
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand All @@ -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"
Expand Down

0 comments on commit bea3e86

Please sign in to comment.