Skip to content

Commit

Permalink
Merge pull request #542 from ember-cli/modifier-dasherization
Browse files Browse the repository at this point in the history
Remove automatic dasherization of modifiers.
  • Loading branch information
rwjblue committed Apr 11, 2020
2 parents 8362044 + edc8377 commit a7c14df
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
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

0 comments on commit a7c14df

Please sign in to comment.