forked from emberjs/ember.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] module unification controller & controller-test blueprints
Remove missed comment Remove packagelock.json Remove uneeded file are per PR comments Add tests for nested components
- Loading branch information
Dexter Edwards
committed
May 18, 2018
1 parent
2d6579a
commit 8caa131
Showing
13 changed files
with
395 additions
and
1 deletion.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,29 @@ | ||
'use strict'; | ||
|
||
const isModuleUnificationProject = require('../module-unification').isModuleUnificationProject; | ||
const path = require('path'); | ||
|
||
module.exports = { | ||
description: 'Generates a controller.', | ||
fileMapTokens() { | ||
if (isModuleUnificationProject(this.project)) { | ||
return { | ||
__root__(options) { | ||
if (options.pod) { | ||
throw "Pods aren't supported within a module unification app"; | ||
} | ||
if (options.inDummy) { | ||
return path.join('tests', 'dummy', 'src'); | ||
} | ||
return 'src'; | ||
}, | ||
__path__(options) { | ||
return path.join('ui', 'routes', options.dasherizedModuleName); | ||
}, | ||
__name__() { | ||
return '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
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 |
---|---|---|
|
@@ -11,6 +11,7 @@ const expect = chai.expect; | |
|
||
const generateFakePackageManifest = require('../helpers/generate-fake-package-manifest'); | ||
const fixture = require('../helpers/fixture'); | ||
const fs = require('fs-extra'); | ||
|
||
describe('Blueprint: controller-test', function() { | ||
setupTestHooks(this); | ||
|
@@ -28,6 +29,14 @@ describe('Blueprint: controller-test', function() { | |
}); | ||
}); | ||
|
||
it('controller-test foo/bar', function() { | ||
return emberGenerateDestroy(['controller-test', 'foo/bar'], _file => { | ||
expect(_file('tests/unit/controllers/foo/bar-test.js')).to.equal( | ||
fixture('controller-test/default-nested.js') | ||
); | ||
}); | ||
}); | ||
|
||
describe('with [email protected]', function() { | ||
beforeEach(function() { | ||
generateFakePackageManifest('ember-cli-qunit', '4.2.0'); | ||
|
@@ -40,6 +49,14 @@ describe('Blueprint: controller-test', function() { | |
); | ||
}); | ||
}); | ||
|
||
it('controller-test foo/bar', function() { | ||
return emberGenerateDestroy(['controller-test', 'foo/bar'], _file => { | ||
expect(_file('tests/unit/controllers/foo/bar-test.js')).to.equal( | ||
fixture('controller-test/rfc232-nested.js') | ||
); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('with [email protected]', function() { | ||
|
@@ -58,6 +75,14 @@ describe('Blueprint: controller-test', function() { | |
); | ||
}); | ||
}); | ||
|
||
it('controller-test foo/bar for mocha', function() { | ||
return emberGenerateDestroy(['controller-test', 'foo/bar'], _file => { | ||
expect(_file('tests/unit/controllers/foo/bar-test.js')).to.equal( | ||
fixture('controller-test/mocha-nested.js') | ||
); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('with [email protected]', function() { | ||
|
@@ -76,6 +101,110 @@ describe('Blueprint: controller-test', function() { | |
); | ||
}); | ||
}); | ||
|
||
it('controller-test foo/bar', function() { | ||
return emberGenerateDestroy(['controller-test', 'foo/bar'], _file => { | ||
expect(_file('tests/unit/controllers/foo/bar-test.js')).to.equal( | ||
fixture('controller-test/mocha-0.12-nested.js') | ||
); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('in app - module unification', function() { | ||
beforeEach(function() { | ||
return emberNew().then(() => fs.ensureDirSync('src')); | ||
}); | ||
|
||
it('controller-test foo', function() { | ||
return emberGenerateDestroy(['controller-test', 'foo'], _file => { | ||
expect(_file('src/ui/routes/foo/controller-test.js')).to.equal( | ||
fixture('controller-test/default.js') | ||
); | ||
}); | ||
}); | ||
|
||
it('controller-test foo/bar', function() { | ||
return emberGenerateDestroy(['controller-test', 'foo/bar'], _file => { | ||
expect(_file('src/ui/routes/foo/bar/controller-test.js')).to.equal( | ||
fixture('controller-test/default-nested.js') | ||
); | ||
}); | ||
}); | ||
|
||
describe('with [email protected]', function() { | ||
beforeEach(function() { | ||
generateFakePackageManifest('ember-cli-qunit', '4.2.0'); | ||
}); | ||
|
||
it('controller-test foo', function() { | ||
return emberGenerateDestroy(['controller-test', 'foo'], _file => { | ||
expect(_file('src/ui/routes/foo/controller-test.js')).to.equal( | ||
fixture('controller-test/rfc232.js') | ||
); | ||
}); | ||
}); | ||
|
||
it('controller-test foo/bar', function() { | ||
return emberGenerateDestroy(['controller-test', 'foo/bar'], _file => { | ||
expect(_file('src/ui/routes/foo/bar/controller-test.js')).to.equal( | ||
fixture('controller-test/rfc232-nested.js') | ||
); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('with [email protected]', function() { | ||
beforeEach(function() { | ||
modifyPackages([ | ||
{ name: 'ember-cli-qunit', delete: true }, | ||
{ name: 'ember-cli-mocha', dev: true }, | ||
]); | ||
generateFakePackageManifest('ember-cli-mocha', '0.11.0'); | ||
}); | ||
|
||
it('controller-test foo for mocha', function() { | ||
return emberGenerateDestroy(['controller-test', 'foo'], _file => { | ||
expect(_file('src/ui/routes/foo/controller-test.js')).to.equal( | ||
fixture('controller-test/mocha.js') | ||
); | ||
}); | ||
}); | ||
|
||
it('controller-test foo/bar for mocha', function() { | ||
return emberGenerateDestroy(['controller-test', 'foo/bar'], _file => { | ||
expect(_file('src/ui/routes/foo/bar/controller-test.js')).to.equal( | ||
fixture('controller-test/mocha-nested.js') | ||
); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('with [email protected]', function() { | ||
beforeEach(function() { | ||
modifyPackages([ | ||
{ name: 'ember-cli-qunit', delete: true }, | ||
{ name: 'ember-cli-mocha', dev: true }, | ||
]); | ||
generateFakePackageManifest('ember-cli-mocha', '0.12.0'); | ||
}); | ||
|
||
it('controller-test foo', function() { | ||
return emberGenerateDestroy(['controller-test', 'foo'], _file => { | ||
expect(_file('src/ui/routes/foo/controller-test.js')).to.equal( | ||
fixture('controller-test/mocha-0.12.js') | ||
); | ||
}); | ||
}); | ||
|
||
it('controller-test foo/bar', function() { | ||
return emberGenerateDestroy(['controller-test', 'foo/bar'], _file => { | ||
expect(_file('src/ui/routes/foo/bar/controller-test.js')).to.equal( | ||
fixture('controller-test/mocha-0.12-nested.js') | ||
); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
|
@@ -91,5 +220,35 @@ describe('Blueprint: controller-test', function() { | |
); | ||
}); | ||
}); | ||
|
||
it('controller-test foo/bar', function() { | ||
return emberGenerateDestroy(['controller-test', 'foo/bar'], _file => { | ||
expect(_file('tests/unit/controllers/foo/bar-test.js')).to.equal( | ||
fixture('controller-test/default-nested.js') | ||
); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('in addon - module unification', function() { | ||
beforeEach(function() { | ||
return emberNew().then(() => fs.ensureDirSync('src')); | ||
}); | ||
|
||
it('controller-test foo', function() { | ||
return emberGenerateDestroy(['controller-test', 'foo'], _file => { | ||
expect(_file('src/ui/routes/foo/controller-test.js')).to.equal( | ||
fixture('controller-test/default.js') | ||
); | ||
}); | ||
}); | ||
|
||
it('controller-test foo/bar', function() { | ||
return emberGenerateDestroy(['controller-test', 'foo/bar'], _file => { | ||
expect(_file('src/ui/routes/foo/bar/controller-test.js')).to.equal( | ||
fixture('controller-test/default-nested.js') | ||
); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.