diff --git a/lib/typed-export.js b/lib/typed-export.js index db10e29..d11a4ad 100644 --- a/lib/typed-export.js +++ b/lib/typed-export.js @@ -93,6 +93,13 @@ TypedExport.convertToOutputFilename = function(stringInput) { TypedExport.filePathForClassname = function(className, type, filePath, exportFiles) { var newFilePath; + + // Check for "App.Type" case, in Globals, Ember would use App.Type instead of Ember.Type for automatically + // generated classes. In modules land, Ember looks for /app/type/basic instead. + if (className && className.toLowerCase() === type) { + className = "basic"; + } + if (type === 'unknown') { newFilePath = filePath; } else { diff --git a/test/fixtures/vanilla/input/routes/basic_and_foo_route.js b/test/fixtures/vanilla/input/routes/basic_and_foo_route.js new file mode 100644 index 0000000..b2bf027 --- /dev/null +++ b/test/fixtures/vanilla/input/routes/basic_and_foo_route.js @@ -0,0 +1,2 @@ +App.Route = Ember.Route.extend({}); +App.FooRoute = App.Route.extend({}); diff --git a/test/fixtures/vanilla/output/routes/basic.js b/test/fixtures/vanilla/output/routes/basic.js new file mode 100644 index 0000000..9dc805d --- /dev/null +++ b/test/fixtures/vanilla/output/routes/basic.js @@ -0,0 +1,5 @@ +import Ember from 'ember'; + +var Route = Ember.Route.extend({}); + +export default Route; diff --git a/test/fixtures/vanilla/output/routes/foo.js b/test/fixtures/vanilla/output/routes/foo.js new file mode 100644 index 0000000..092b95d --- /dev/null +++ b/test/fixtures/vanilla/output/routes/foo.js @@ -0,0 +1,5 @@ +import Route from 'my-app/routes/basic'; + +var FooRoute = Route.extend({}); + +export default FooRoute; diff --git a/test/models-test.js b/test/models-test.js index 32b0637..887fc81 100644 --- a/test/models-test.js +++ b/test/models-test.js @@ -141,4 +141,9 @@ describe('migrating models', function(){ it(migrates('controllers/with-mixin.js')); }); + describe("Migrates App.Route to routes/basic. Imports routes/basic correctly ", function(){ + it(migrates('routes/basic.js')); + it(migrates('routes/foo.js')); + }); + });