Permalink
Browse files

Add yo polymer:element alias. Close Gh-87

  • Loading branch information...
1 parent 7e1748a commit b0d5102a228e4ec158e2b708e07b003c14d9dd31 @robdodson robdodson committed Nov 27, 2014
Showing with 46 additions and 2 deletions.
  1. +2 −2 el/index.js
  2. +2 −0 element/index.js
  3. +42 −0 test/element-test.js
View
@@ -55,9 +55,9 @@ module.exports = yeoman.generators.Base.extend({
var el = path.join(this.elementName, this.elementName);
// pathToEl = "app/elements/x-foo/x-foo"
var pathToEl = path.join('app/elements', el);
- this.template('_element.html', pathToEl + '.html');
+ this.template(path.join(__dirname, 'templates/_element.html'), pathToEl + '.html');
if (this.externalStyle) {
- this.template('_element.css',
+ this.template(path.join(__dirname, 'templates/_element.css'),
this.includeSass ? pathToEl + '.scss':
pathToEl + '.css');
}
View
@@ -0,0 +1,2 @@
+// alias yo polymer:el and yo polymer:element
+module.exports = require('../el');
View
@@ -0,0 +1,42 @@
+/*global describe, beforeEach, it*/
+
+var path = require('path');
+var helpers = require('yeoman-generator').test;
+var assert = require('yeoman-generator').assert;
+
+describe('yo polymer:element test', function () {
+
+ before(function (done) {
+ helpers.run(path.join(__dirname, '../app'))
+ .inDir(path.join(__dirname, './tmp'))
+ .withArguments(['--skip-install'])
+ .withPrompt({
+ includeCore: false,
+ includePaper: false,
+ includeSass: false,
+ includeLibSass: false
+ })
+ .on('end', done);
+ });
+
+ before(function (done) {
+ helpers.run(path.join(__dirname, '../element'))
+ .inDir(path.join(__dirname, './tmp'))
+ .withArguments(['x-foo'])
+ .withPrompt({
+ externalStyle: true,
+ includeImport: false
+ })
+ .on('end', done);
+ });
+
+ it('creates expected files', function () {
+ var expected = [
+ 'app/elements/x-foo/x-foo.html',
+ 'app/elements/x-foo/x-foo.css'
+ ];
+
+ assert.file(expected);
+ });
+
+});

0 comments on commit b0d5102

Please sign in to comment.