Permalink
Browse files

added ember-cli-htmlbars-inline-precompile for use in component integ…

…ration tests
  • Loading branch information...
trabus committed Jun 20, 2015
1 parent 94e718a commit a186b60703b42699d3e87a55b8fb35ab0505b85c
@@ -26,6 +26,7 @@
"ember-cli-content-security-policy": "0.4.0",
"ember-cli-dependency-checker": "^1.0.0",
"ember-cli-htmlbars": "0.7.9",
"ember-cli-htmlbars-inline-precompile": "^0.1.1",
"ember-cli-ic-ajax": "0.1.1",
"ember-cli-inject-live-reload": "^1.3.0",
"ember-cli-qunit": "0.3.13",
@@ -1,7 +1,7 @@
import { moduleForComponent, test } from 'ember-qunit';
import { moduleForComponent, test } from 'ember-qunit';<%= testImports %>
moduleForComponent('<%= componentPathName %>', '<%= friendlyTestDescription %>', {
<%= testTypeDefinition %>
<%= testOptions %>
});
test('it renders', function(assert) {
@@ -39,21 +39,22 @@ module.exports = {
locals: function(options) {
var dasherizedModuleName = stringUtil.dasherize(options.entity.name);
var componentPathName = dasherizedModuleName;
var testTypeDefinition = "integration: true";
var testImports = EOL + "import hbs from 'htmlbars-inline-precompile';" + EOL;
var testOptions = "integration: true";
var friendlyTestDescription = testInfo.description(options.entity.name, "Integration", "Component");
var testContent = "assert.expect(1);" + EOL + EOL +
" // Set any properties with this.set('myProperty', 'value');" + EOL +
" // Handle any actions with this.on('myAction', function(val) { ... });" + EOL + EOL +
" // Provide a template (string or precompiled) for this.render()" + EOL +
" this.render();" + EOL + EOL +
" assert.equal(this.$().text(), '')";
" this.render(hbs`{{" + options.entity.name + "}}`);" + EOL + EOL +
" assert.equal(this.$().text(), '" + options.entity.name + "')";
if (options.pod && options.path !== 'components' && options.path !== '') {
componentPathName = [options.path, dasherizedModuleName].join('/');
}
if (options.testType === 'unit') {
testTypeDefinition = "// Specify the other units that are required for this test" +
testImports = "";
testOptions = "// Specify the other units that are required for this test" +
EOL + " // needs: ['component:foo', 'helper:bar']," + EOL + " unit: true";
testContent = "assert.expect(2);" + EOL + EOL +
@@ -70,9 +71,10 @@ module.exports = {
return {
path: getPathOption(options),
testType: options.testType,
testImports: testImports,
testContent: testContent,
componentPathName: componentPathName,
testTypeDefinition: testTypeDefinition,
testOptions: testOptions,
friendlyTestDescription: friendlyTestDescription
};
}

0 comments on commit a186b60

Please sign in to comment.