ember-cli-mocha
Advanced tools
Comparing version 0.9.2 to 0.9.3
@@ -14,3 +14,3 @@ /* jshint expr:true */ | ||
var application; | ||
beforeEach(function() { | ||
@@ -17,0 +17,0 @@ application = startApp(); |
@@ -6,15 +6,33 @@ /* jshint expr:true */ | ||
it | ||
} from 'ember-mocha';<%= testImports %> | ||
} from 'ember-mocha';<% if (testType === 'integration') { %> | ||
import hbs from 'htmlbars-inline-precompile';<% } %> | ||
describeComponent( | ||
'<%= dasherizedModuleName %>', | ||
'<%= testPrefix %><%= classifiedModuleName %>Component', | ||
'<% if (testType === "integration") { %>Integration: <% } %><%= classifiedModuleName %>Component', | ||
{ | ||
<%= testOpts %> | ||
<% if (testType === 'integration' ) { %>integration: true<% } else if(testType === 'unit') { %>// Specify the other units that are required for this test | ||
// needs: ['component:foo', 'helper:bar'], | ||
unit: true<% } %> | ||
}, | ||
function() { | ||
it('renders', function() { | ||
<%= testContent %> | ||
<% if (testType === 'integration' ) { %>// Set any properties with this.set('myProperty', 'value'); | ||
// Handle any actions with this.on('myAction', function(val) { ... }); | ||
// Template block usage: | ||
// this.render(hbs` | ||
// {{#<%= dasherizedModuleName %>}} | ||
// template content | ||
// {{/<%= dasherizedModuleName %>}} | ||
// `); | ||
this.render(hbs`{{<%= dasherizedModuleName %>}}`); | ||
expect(this.$()).to.have.length(1);<% } else if(testType === 'unit') { %>// creates the component instance | ||
var component = this.subject(); | ||
// renders the component on the page | ||
this.render(); | ||
expect(component).to.be.ok; | ||
expect(this.$()).to.have.length(1);<% } %> | ||
}); | ||
} | ||
); |
/*jshint node:true*/ | ||
var EOL = require('os').EOL; | ||
module.exports = { | ||
@@ -23,37 +21,6 @@ description: 'Generates a component integration or unit test.', | ||
locals: function(options) { | ||
var testImports, prefix, testOpts, testContent; | ||
if (options.testType === 'unit') { | ||
testImports = ''; | ||
prefix = ''; | ||
testOpts = "// specify the other units that are required for this test" + EOL + | ||
" // needs: ['component:foo', 'helper:bar']"; | ||
testContent = "// creates the component instance" + EOL + | ||
" var component = this.subject();" + EOL + | ||
" // renders the component on the page" + EOL + | ||
" this.render();" + EOL + | ||
" expect(component).to.be.ok;" + EOL + | ||
" expect(this.$()).to.have.length(1);"; | ||
} else { | ||
testImports = EOL + "import hbs from 'htmlbars-inline-precompile';"; | ||
prefix = 'Integration: '; | ||
testOpts = 'integration: true'; | ||
testContent = "// Set any properties with this.set('myProperty', 'value');" + EOL + | ||
" // Handle any actions with this.on('myAction', function(val) { ... });" + EOL + | ||
" // Template block usage:" + EOL + | ||
" // this.render(hbs`" + EOL + | ||
" // {{#" + options.entity.name + "}}" + EOL + | ||
" // template content" + EOL + | ||
" // {{/" + options.entity.name + "}}" + EOL + | ||
" // `);" + EOL + EOL + | ||
" this.render(hbs`{{" + options.entity.name + "}}`);" + EOL + | ||
" expect(this.$()).to.have.length(1);"; | ||
} | ||
var testType = options.testType || "integration"; | ||
return { | ||
testImports: testImports, | ||
testPrefix: prefix, | ||
testOpts: testOpts, | ||
testContent: testContent, | ||
integration: options.integration, | ||
testType: options.testType | ||
testType: testType | ||
}; | ||
@@ -60,0 +27,0 @@ }, |
{ | ||
"name": "ember-cli-mocha", | ||
"version": "0.9.2", | ||
"version": "0.9.3", | ||
"description": "Mocha and Chai tests for ember-cli applications", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
28735
545