Skip to content

Commit 0568e74

Browse files
committed
fix(views): correct path for sub views
There was a residue from the modularization that caused views with slashes to appear in the wrong directory. Fixes #359
1 parent 1a176e1 commit 0568e74

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

test/test-file-creation.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,5 +144,25 @@ describe('Angular generator', function () {
144144
});
145145
});
146146
});
147+
148+
it('should generate a new view in subdirectories', function (done) {
149+
var angularView;
150+
var deps = ['../../view'];
151+
angularView = helpers.createGenerator('angular:view', deps, ['foo/bar']);
152+
153+
helpers.mockPrompt(angular, {
154+
bootstrap: true,
155+
compassBoostrap: true,
156+
modules: []
157+
});
158+
angular.run([], function (){
159+
angularView.run([], function () {
160+
helpers.assertFiles([
161+
['app/views/foo/bar.html']
162+
]);
163+
done();
164+
});
165+
});
166+
});
147167
});
148168
});

view/index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,5 @@ function Generator() {
2121
util.inherits(Generator, yeoman.generators.NamedBase);
2222

2323
Generator.prototype.createViewFiles = function createViewFiles() {
24-
var targetPath = this.name;
25-
if (this.name.indexOf('/') === -1) {
26-
targetPath = 'views/' + targetPath;
27-
}
28-
this.template('common/view.html', path.join(this.env.options.appPath, targetPath + '.html'));
24+
this.template('common/view.html', path.join(this.env.options.appPath, 'views', this.name + '.html'));
2925
};

0 commit comments

Comments
 (0)