Skip to content

Commit

Permalink
Merge pull request #224 from 201-created/isaac/fallback-normalization
Browse files Browse the repository at this point in the history
Normalize specifiers before passing to fallback
  • Loading branch information
mixonic committed Mar 5, 2018
2 parents 13f05eb + e38f353 commit d7dc4dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mu-trees/addon/resolvers/fallback/index.js
Expand Up @@ -11,6 +11,6 @@ export default Resolver.extend({
},
resolve(name, referrer, targetNamespace) {
let result = this._super(name, referrer, targetNamespace);
return result || this._fallback.resolve(name);
return result || this._fallback.resolve(this._fallback.normalize(name));
}
});
8 changes: 8 additions & 0 deletions mu-trees/tests/unit/resolvers/fallback/basic-test.js
Expand Up @@ -44,6 +44,14 @@ test('resolves from classic resolver', function(assert) {
assert.equal(this.resolver.resolve('router:/app/main/classic', 'referrer'), this.classic, 'returns classic resolver result');
});

test('resolves normalized specifiers classic resolver', function(assert) {
this.resolver._fallback.resolve = (specifier) => {
return specifier === 'router:classic-router' ? this.classic : null;
};

assert.equal(this.resolver.resolve('router:classicRouter'), this.classic, 'returns classic resolver result');
});

test('returns null if neither resolver resolves', function(assert) {
let specifier = 'router:/app/main/nowhere';
let referrer = 'router:/app/main/referrer';
Expand Down

0 comments on commit d7dc4dd

Please sign in to comment.