Skip to content

Commit e2754a6

Browse files
joejoeruello
authored andcommitted
Export App.Type as app/type/basic
1 parent da6e4a2 commit e2754a6

File tree

5 files changed

+24
-0
lines changed

5 files changed

+24
-0
lines changed

lib/typed-export.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ TypedExport.convertToOutputFilename = function(stringInput) {
9393

9494
TypedExport.filePathForClassname = function(className, type, filePath, exportFiles) {
9595
var newFilePath;
96+
97+
// Check for "App.Type" case, in Globals, Ember would use App.Type instead of Ember.Type for automatically
98+
// generated classes. In modules land, Ember looks for /app/type/basic instead.
99+
if (className && className.toLowerCase() === type) {
100+
className = "basic";
101+
}
102+
96103
if (type === 'unknown') {
97104
newFilePath = filePath;
98105
} else {
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
App.Route = Ember.Route.extend({});
2+
App.FooRoute = App.Route.extend({});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Ember from 'ember';
2+
3+
var Route = Ember.Route.extend({});
4+
5+
export default Route;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Route from '/my-app/routes/basic';
2+
3+
var FooRoute = Route.extend({});
4+
5+
export default FooRoute;

test/models-test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,9 @@ describe('migrating models', function(){
141141
it(migrates('controllers/with-mixin.js'));
142142
});
143143

144+
describe("Migrates App.Route to routes/basic. Imports routes/basic correctly ", function(){
145+
it(migrates('routes/basic.js'));
146+
it(migrates('routes/foo.js'));
147+
});
148+
144149
});

0 commit comments

Comments
 (0)