Skip to content

Commit

Permalink
Merge 4c6fcfb into 75b8405
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp committed Nov 7, 2018
2 parents 75b8405 + 4c6fcfb commit 9825844
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/templates/src/app.js
Expand Up @@ -8,7 +8,7 @@ if(debug) {
}
//!steal-remove-end

const AppViewModel = DefineMap.extend({
const AppViewModel = DefineMap.extend("AppViewModel", {
env: {
default: () => ({NODE_ENV:'development'})
},
Expand Down
5 changes: 4 additions & 1 deletion component/templates/modlet/component.js
Expand Up @@ -2,7 +2,7 @@ import { Component } from 'can';
import './<%= name %>.less';
import view from './<%= name %>.stache';

export default Component.extend({
export const <%= tagCase %> = Component.extend({
tag: '<%= tag %>',
view,
ViewModel: {
Expand Down Expand Up @@ -30,3 +30,6 @@ export default Component.extend({
}
}
});

export default <%= tagCase %>;
export const ViewModel = <%= tagCase %>.ViewModel;
24 changes: 24 additions & 0 deletions test/component.test.js
Expand Up @@ -56,6 +56,30 @@ describe('generator-donejs', function () {
});
});

it('Exports the component and ViewModel in a modlet', function(done) {
var tmpDir;

helpers.run(path.join(__dirname, '../component'))
.inTmpDir(function (dir) {
tmpDir = dir;
fs.copySync(path.join( __dirname, "tests", 'basics'), dir)
})
.withOptions({
skipInstall: true
})
.withPrompts({
name: 'pages/restaurant/list',
tag: 'pmo-restaurant-list'
})
.on('end', function () {
var compFile = path.join(tmpDir, 'src', 'pages', 'restaurant', 'list', 'list.js');
assert.fileContent(compFile, /export const PmoRestaurantList/);
assert.fileContent(compFile, /export default PmoRestaurantList/);
assert.fileContent(compFile, /export const ViewModel = PmoRestaurantList\.ViewModel/);
done();
});
});

it('can provide a name that includes the package name', function(done) {
var tmpDir;

Expand Down

0 comments on commit 9825844

Please sign in to comment.