Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/typed-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/vanilla/input/routes/basic_and_foo_route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
App.Route = Ember.Route.extend({});
App.FooRoute = App.Route.extend({});
5 changes: 5 additions & 0 deletions test/fixtures/vanilla/output/routes/basic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Ember from 'ember';

var Route = Ember.Route.extend({});

export default Route;
5 changes: 5 additions & 0 deletions test/fixtures/vanilla/output/routes/foo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Route from 'my-app/routes/basic';

var FooRoute = Route.extend({});

export default FooRoute;
5 changes: 5 additions & 0 deletions test/models-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
});

});