Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Commit

Permalink
fix(views): correct path for sub views
Browse files Browse the repository at this point in the history
There was a residue from the modularization that caused views with slashes to
appear in the wrong directory.

Fixes #359
  • Loading branch information
passy committed Sep 8, 2013
1 parent 1a176e1 commit 0568e74
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
20 changes: 20 additions & 0 deletions test/test-file-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,25 @@ describe('Angular generator', function () {
});
});
});

it('should generate a new view in subdirectories', function (done) {
var angularView;
var deps = ['../../view'];
angularView = helpers.createGenerator('angular:view', deps, ['foo/bar']);

helpers.mockPrompt(angular, {
bootstrap: true,
compassBoostrap: true,
modules: []
});
angular.run([], function (){
angularView.run([], function () {
helpers.assertFiles([
['app/views/foo/bar.html']
]);
done();
});
});
});
});
});
6 changes: 1 addition & 5 deletions view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,5 @@ function Generator() {
util.inherits(Generator, yeoman.generators.NamedBase);

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

0 comments on commit 0568e74

Please sign in to comment.