Skip to content

Commit

Permalink
Ensure internal layoutFor lookups for namespaced templates works.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed Aug 29, 2017
1 parent 09363b6 commit ea13f46
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
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

0 comments on commit ea13f46

Please sign in to comment.