Skip to content

Commit

Permalink
fix requires registry for main services/components
Browse files Browse the repository at this point in the history
Was ignoring main when it was in the specifier name,
However we should only ignore if it is in the name AND collection.
This is meant to avoid looking up main twice for example /my-app/src/router/main/main
  • Loading branch information
iezer committed Feb 5, 2018
1 parent 9937486 commit 9b5e679
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mu-trees/addon/module-registries/requirejs.js
Expand Up @@ -36,7 +36,7 @@ export default class RequireJSRegistry {
segments.push(s.namespace);
}

if (s.name !== 'main') {
if (s.name !== 'main' || s.collection !== 'main') {
segments.push(s.name);
}

Expand Down
8 changes: 6 additions & 2 deletions mu-trees/tests/unit/module-registries/requirejs-test.js
Expand Up @@ -60,7 +60,7 @@ module('RequireJS Registry', {
});

test('basic get', function(assert) {
assert.expect(8);
assert.expect(11);

[
/*
Expand All @@ -74,7 +74,11 @@ test('basic get', function(assert) {
[ 'template:/my-app/routes/components/my-input', 'my-app/src/ui/components/my-input/template' ],
[ 'template:/my-app/components/my-input', 'my-app/src/ui/components/my-input/template' ],
[ 'component:/my-app/components/my-input/my-button', 'my-app/src/ui/components/my-input/my-button/component' ],
[ 'template:/my-app/components/my-input/my-button', 'my-app/src/ui/components/my-input/my-button/template' ]
[ 'template:/my-app/components/my-input/my-button', 'my-app/src/ui/components/my-input/my-button/template' ],
[ 'service:/my-app/services/main', 'my-app/src/services/main' ],
[ 'component:/my-app/components/main', 'my-app/src/ui/components/main/component' ],
[ 'template:/my-app/components/main', 'my-app/src/ui/components/main/template' ],

]
.forEach(([ lookupString, expected ]) => {
let expectedModule = {};
Expand Down

0 comments on commit 9b5e679

Please sign in to comment.