This repository has been archived by the owner on Nov 25, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
4,685 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/*jshint node:true*/ | ||
|
||
var stringUtil = require('ember-cli-string-utils'); | ||
var path = require('path'); | ||
var inflector = require('inflection'); | ||
|
||
module.exports = { | ||
description: 'Generates an import wrapper.', | ||
|
||
fileMapTokens: function() { | ||
return { | ||
__name__: function(options) { | ||
if (options.pod && options.hasPathToken) { | ||
return options.locals.blueprintName; | ||
} | ||
return options.dasherizedModuleName; | ||
}, | ||
__path__: function(options) { | ||
if (options.pod && options.hasPathToken) { | ||
return path.join(options.podPath, options.dasherizedModuleName); | ||
} | ||
return inflector.pluralize(options.locals.blueprintName); | ||
}, | ||
__root__: function(options) { | ||
if (options.inRepoAddon) { | ||
return path.join('lib', options.inRepoAddon, 'app'); | ||
} | ||
return 'app'; | ||
} | ||
}; | ||
}, | ||
|
||
locals: function(options) { | ||
var addonRawName = options.inRepoAddon ? options.inRepoAddon : options.project.name(); | ||
var addonName = stringUtil.dasherize(addonRawName); | ||
var fileName = stringUtil.dasherize(options.entity.name); | ||
var blueprintName = options.originBlueprintName; | ||
var modulePathSegments = [addonName, inflector.pluralize(options.originBlueprintName), fileName]; | ||
|
||
if (blueprintName.match(/-addon/)) { | ||
blueprintName = blueprintName.substr(0,blueprintName.indexOf('-addon')); | ||
modulePathSegments = [addonName, inflector.pluralize(blueprintName), fileName]; | ||
} | ||
|
||
if (options.pod) { | ||
modulePathSegments = [addonName, fileName, blueprintName]; | ||
} | ||
|
||
return { | ||
modulePath: modulePathSegments.join('/'), | ||
blueprintName: blueprintName | ||
}; | ||
} | ||
}; |
21 changes: 0 additions & 21 deletions
21
blueprints/acceptance-test/files/tests/acceptance/__name__-test.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
blueprints/acceptance-test/mocha-files/tests/acceptance/__name__-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* jshint expr:true */ | ||
import { describe, it, beforeEach, afterEach } from 'mocha'; | ||
import { expect } from 'chai'; | ||
import startApp from '../helpers/start-app'; | ||
<% if (destroyAppExists) { %>import destroyApp from '../helpers/destroy-app';<% } else { %>import Ember from 'ember';<% } %> | ||
|
||
describe('<%= friendlyTestName %>', function() { | ||
let application; | ||
|
||
beforeEach(function() { | ||
application = startApp(); | ||
}); | ||
|
||
afterEach(function() { | ||
<% if (destroyAppExists) { %>destroyApp(application);<% } else { %>Ember.run(application, 'destroy');<% } %> | ||
}); | ||
|
||
it('can visit /<%= dasherizedModuleName %>', function() { | ||
visit('/<%= dasherizedModuleName %>'); | ||
|
||
andThen(function() { | ||
expect(currentURL()).to.equal('/<%= dasherizedModuleName %>'); | ||
}); | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
blueprints/acceptance-test/qunit-files/tests/acceptance/__name__-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { test } from 'qunit'; | ||
import moduleForAcceptance from '<%= testFolderRoot %>/tests/helpers/module-for-acceptance'; | ||
|
||
moduleForAcceptance('<%= friendlyTestName %>'); | ||
|
||
test('visiting /<%= dasherizedModuleName %>', function(assert) { | ||
visit('/<%= dasherizedModuleName %>'); | ||
|
||
andThen(function() { | ||
assert.equal(currentURL(), '/<%= dasherizedModuleName %>'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
blueprints/component-test/mocha-files/tests/__testType__/__path__/__test__.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* jshint expr:true */ | ||
import { expect } from 'chai'; | ||
import { describeComponent, it } from 'ember-mocha';<% if (testType === 'integration') { %> | ||
import hbs from 'htmlbars-inline-precompile';<% } %> | ||
|
||
describeComponent('<%= componentPathName %>', '<%= friendlyTestDescription %>', | ||
{ | ||
<% 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() { | ||
<% 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 | ||
let component = this.subject(); | ||
// renders the component on the page | ||
this.render(); | ||
expect(component).to.be.ok; | ||
expect(this.$()).to.have.length(1);<% } %> | ||
}); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
/*jshint node:true*/ | ||
|
||
module.exports = { | ||
description: 'Generates a controller unit test.' | ||
}; | ||
var testInfo = require('ember-cli-test-info'); | ||
var useTestFrameworkDetector = require('../test-framework-detector'); | ||
|
||
module.exports = useTestFrameworkDetector({ | ||
description: 'Generates a controller unit test.', | ||
locals: function(options) { | ||
return { | ||
friendlyTestDescription: testInfo.description(options.entity.name, 'Unit', 'Controller') | ||
}; | ||
} | ||
}); |
17 changes: 17 additions & 0 deletions
17
blueprints/controller-test/mocha-files/tests/unit/__path__/__test__.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* jshint expr:true */ | ||
import { expect } from 'chai'; | ||
import { describeModule, it } from 'ember-mocha'; | ||
|
||
describeModule('controller:<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>', | ||
{ | ||
// Specify the other units that are required for this test. | ||
// needs: ['controller:foo'] | ||
}, | ||
function() { | ||
// Replace this with your real tests. | ||
it('exists', function() { | ||
let controller = this.subject(); | ||
expect(controller).to.be.ok; | ||
}); | ||
} | ||
); |
4 changes: 2 additions & 2 deletions
4
...est/files/tests/unit/__path__/__test__.js → ...nit-files/tests/unit/__path__/__test__.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { moduleFor, test } from 'ember-qunit'; | ||
|
||
moduleFor('controller:<%= dasherizedModuleName %>', { | ||
moduleFor('controller:<%= dasherizedModuleName %>', '<%= friendlyTestDescription %>', { | ||
// Specify the other units that are required for this test. | ||
// needs: ['controller:foo'] | ||
}); | ||
|
||
// Replace this with your real tests. | ||
test('it exists', function(assert) { | ||
var controller = this.subject(); | ||
let controller = this.subject(); | ||
assert.ok(controller); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
/*jshint node:true*/ | ||
|
||
module.exports = require('ember-cli/blueprints/addon-import'); | ||
module.exports = require('../-addon-import'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
/*jshint node:true*/ | ||
|
||
var getDependencyDepth = require('ember-cli-get-dependency-depth'); | ||
var testInfo = require('ember-cli-test-info'); | ||
var stringUtils = require('ember-cli-string-utils'); | ||
var useTestFrameworkDetector = require('../test-framework-detector'); | ||
|
||
module.exports = { | ||
module.exports = useTestFrameworkDetector({ | ||
description: 'Generates a helper unit test.', | ||
locals: function(options) { | ||
return { | ||
friendlyTestName: testInfo.name(options.entity.name, "Unit", "Helper"), | ||
dependencyDepth: getDependencyDepth(options.entity.name) | ||
friendlyTestName: testInfo.name(options.entity.name, 'Unit', 'Helper'), | ||
dasherizedModulePrefix: stringUtils.dasherize(options.project.config().modulePrefix) | ||
}; | ||
} | ||
}; | ||
}); |
12 changes: 12 additions & 0 deletions
12
blueprints/helper-test/mocha-files/tests/unit/helpers/__name__-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* jshint expr:true */ | ||
import { expect } from 'chai'; | ||
import { describe, it } from 'mocha'; | ||
import { <%= camelizedModuleName %> } from '<%= dasherizedPackageName %>/helpers/<%= dasherizedModuleName %>'; | ||
|
||
describe('<%= friendlyTestName %>', function() { | ||
// Replace this with your real tests. | ||
it('works', function() { | ||
let result = <%= camelizedModuleName %>(42); | ||
expect(result).to.be.ok; | ||
}); | ||
}); |
4 changes: 2 additions & 2 deletions
4
...files/tests/unit/helpers/__name__-test.js → ...files/tests/unit/helpers/__name__-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { <%= camelizedModuleName %> } from '<%= dependencyDepth %>/helpers/<%= dasherizedModuleName %>'; | ||
import { <%= camelizedModuleName %> } from '<%= dasherizedModulePrefix %>/helpers/<%= dasherizedModuleName %>'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('<%= friendlyTestName %>'); | ||
|
||
// Replace this with your real tests. | ||
test('it works', function(assert) { | ||
var result = <%= camelizedModuleName %>(42); | ||
let result = <%= camelizedModuleName %>([42]); | ||
assert.ok(result); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
/*jshint node:true*/ | ||
|
||
module.exports = require('ember-cli/blueprints/addon-import'); | ||
module.exports = require('../-addon-import'); |
Oops, something went wrong.