Skip to content
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

## [Unreleased]

### Added

* @ts-ignore component template import.

### Changed

* Improve instructions for setting up [Linked Addons](README.md#linking-addons) and [In-repo Addons](README.md#in-repo-addons).

### Fixed

* Addon components need to manually set their layout property to the imported compiled template.

## [1.1.6] - 2018-02-23

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion blueprints/component/files/__root__/__path__/__name__.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import Component from '@ember/component';
<%= importTemplate %>
export default class <%= classifiedModuleName %> extends Component.extend({
// anything which *must* be merged to prototype here
}) {
}) {<%= contents %>
// normal class body definition here
};
4 changes: 2 additions & 2 deletions blueprints/component/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ module.exports = {
templatePath = pathUtil.getRelativeParentPath(options.entity.name) +
'templates/components/' + stringUtil.dasherize(options.entity.name);
}
importTemplate = 'import layout from \'' + templatePath + '\';\n';
contents = '\n layout';
importTemplate = '// @ts-ignore: Ignore import of compiled template\nimport layout from \'' + templatePath + '\';\n';
contents = '\n layout = layout;';
}

return {
Expand Down
12 changes: 12 additions & 0 deletions node-tests/blueprints/component-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,16 @@ describe('Acceptance: ember generate and destroy component', function() {
expect(file('app/components/foo-bar.ts')).to.contain('export default class FooBar extends Component.extend');
}));
});

it('addon component foo-bar', function() {
let args = ['component', 'foo-bar'];

return emberNew({ target: 'addon' })
.then(() => emberGenerateDestroy(args, (file) => {
expect(file('addon/components/foo-bar.ts'))
.to.contain('// @ts-ignore: Ignore import of compiled template\nimport layout from \'../templates/components/foo-bar\';\n');
expect(file('addon/components/foo-bar.ts'))
.to.contain('layout = layout;');
}));
});
});