Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX beta] Ember.DefaultResolver resolves with hyphens. #11957

Merged
merged 1 commit into from
Aug 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/ember-application/lib/system/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ export default EmberObject.extend({
});
}

if (name.indexOf('-') > -1) {
result = result.replace(/-(.)/g, function(m) {
return m.charAt(1).toUpperCase();
});
}

return type + ':' + result;
} else {
return fullName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ QUnit.test('the default resolver resolves helpers on the namespace', function()
equal(resolvedLegacyHandlebars, LegacyHandlebarsBoundHelper, 'resolves legacy Handlebars bound helper');
});

QUnit.test('the default resolver resolves to the same instance no matter the notation ', function() {
application.NestedPostController = Controller.extend({});

equal(locator.lookup('controller:nested-post'), locator.lookup('controller:nested_post'), 'looks up NestedPost controller on application');
});

QUnit.test('the default resolver throws an error if the fullName to resolve is invalid', function() {
throws(function() { registry.resolve(undefined);}, TypeError, /Invalid fullName/ );
throws(function() { registry.resolve(null); }, TypeError, /Invalid fullName/ );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@ QUnit.test('normalization', function() {
equal(registry.normalize('controller:posts'), 'controller:posts');
equal(registry.normalize('controller:posts_index'), 'controller:postsIndex');
equal(registry.normalize('controller:posts.index'), 'controller:postsIndex');
equal(registry.normalize('controller:posts-index'), 'controller:postsIndex');
equal(registry.normalize('controller:posts.post.index'), 'controller:postsPostIndex');
equal(registry.normalize('controller:posts_post.index'), 'controller:postsPostIndex');
equal(registry.normalize('controller:posts.post_index'), 'controller:postsPostIndex');
equal(registry.normalize('controller:posts.post-index'), 'controller:postsPostIndex');
equal(registry.normalize('controller:postsIndex'), 'controller:postsIndex');
equal(registry.normalize('controller:blogPosts.index'), 'controller:blogPostsIndex');
equal(registry.normalize('controller:blog/posts.index'), 'controller:blog/postsIndex');
equal(registry.normalize('controller:blog/posts-index'), 'controller:blog/postsIndex');
equal(registry.normalize('controller:blog/posts.post.index'), 'controller:blog/postsPostIndex');
equal(registry.normalize('controller:blog/posts_post.index'), 'controller:blog/postsPostIndex');
equal(registry.normalize('controller:blog/posts_post-index'), 'controller:blog/postsPostIndex');

equal(registry.normalize('template:blog/posts_index'), 'template:blog/posts_index');
});
Expand Down