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

Remove automatic dasherization of modifiers. #542

Merged
merged 1 commit into from Apr 11, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions addon/resolvers/classic/index.js
Expand Up @@ -197,6 +197,7 @@ const Resolver = EmberObject.extend({
if (
type === 'component' ||
type === 'helper' ||
type === 'modifier' ||
(type === 'template' && split[1].indexOf('components/') === 0)
) {
return type + ':' + split[1].replace(/_/g, '-');
Expand Down
28 changes: 28 additions & 0 deletions tests/unit/resolvers/classic/basic-test.js
Expand Up @@ -545,6 +545,34 @@ test('normalization', function(assert) {
assert.equal(resolver.normalize('component:fabulous-component'), 'component:fabulous-component');
assert.equal(resolver.normalize('component:fabulousComponent'), 'component:fabulousComponent');
assert.equal(resolver.normalize('template:components/fabulousComponent'), 'template:components/fabulousComponent');

// and modifiers
assert.equal(resolver.normalize('modifier:fabulous-component'), 'modifier:fabulous-component');

// deprecated when fabulously-missing actually exists, but normalize still returns it
assert.equal(resolver.normalize('modifier:fabulouslyMissing'), 'modifier:fabulouslyMissing');
});

test('camel case modifier is not normalized', function(assert) {
assert.expect(2);

let expected = { };
define('appkit/modifiers/other-thing', [], function(){
assert.ok(false, 'appkit/modifiers/other-thing was accessed');

return { default: 'oh no' };
});

define('appkit/modifiers/otherThing', [], function(){
assert.ok(true, 'appkit/modifiers/otherThing was accessed');

return { default: expected };
});


let modifier = resolver.resolve('modifier:otherThing');

assert.strictEqual(modifier, expected);
});

test('normalization is idempotent', function(assert) {
Expand Down