<|start_filename|>lib/element/templates/_element.coffee<|end_filename|>
###global Polymer###
'use strict'

element = new Polymer
  is: '<%= hyphenName %>'
  ready: ->
    console.log '<%= hyphenName %>'

element


<|start_filename|>lib/route/templates/page_test.js<|end_filename|>
/* global describe, beforeEach, it, browser<% if (e2eTestFramework === 'jasmine') { %>, expect<% } %> */
'use strict';

var <% if (e2eTestFramework === 'mocha') { %>chai = require('chai')
  , chaiAsPromised = require('chai-as-promised')
  , expect = chai.expect
  , <% } %><%= upperCamel %>PagePo = require('./<%= hyphenName %>.po');<% if (e2eTestFramework === 'mocha') { %>

chai.use(chaiAsPromised);<% } %>

describe('<%= humanName %> page', function () {
  var <%= lowerCamel %>Page;

  beforeEach(function () {
    <%= lowerCamel %>Page = new <%= upperCamel %>PagePo();
    browser.get('/#<%= url %>');
  });

  it('should say <%= ctrlName %>', function () {
    expect(<%= lowerCamel %>Page.heading.getText()).<% if (e2eTestFramework === 'mocha') { %>to.eventually.equal<% } else { %>toEqual<% } %>('<%= lowerCamel %>');
    expect(<%= lowerCamel %>Page.text.getText()).<% if (e2eTestFramework === 'mocha') { %>to.eventually.equal<% } else { %>toEqual<% } %>('<%= ctrlName %>');
  });
});


<|start_filename|>lib/app/templates/gulp/_test.js<|end_filename|>
'use strict';

var karmaConf = require('../karma.config.js');

// karmaConf.files get populated in karmaFiles
karmaConf.files = [
  'node_modules/karma-babel-preprocessor/node_modules/babel-core/browser-polyfill.js'
];

module.exports = function (gulp, $, config) {
  gulp.task('clean:test', function (cb) {
    return $.del(config.buildTestDir, cb);
  });

  gulp.task('buildTests', ['lint', 'clean:test'], function () {
    return gulp.src([config.unitTestFiles])<% if (testScript === 'es6') { %>
      .pipe($.babel())
      .pipe($.rename(function (filePath) {
        filePath.extname = '.js';
      }))<% } else if (testScript === 'ts') { %>
      .pipe($.typescript(config.tsTestProject))<% } else if (testScript === 'coffee') { %>
      .pipe($.coffee())<% } %>
      .pipe(gulp.dest(config.buildUnitTestsDir));
  });

  // inject scripts in karma.config.js
  gulp.task('karmaFiles', ['build', 'buildTests'], function () {
    var stream = $.streamqueue({objectMode: true});

    // add bower javascript
    stream.queue(gulp.src($.wiredep({
      devDependencies: true<% if (polymer) { %>,
      exclude: [/polymer/, /webcomponents/]<% } %>
    }).js));

    // add application templates
    stream.queue(gulp.src([config.buildTestDirectiveTemplateFiles]));

    // add application javascript
    stream.queue(gulp.src([
      config.buildJsFiles<% if (polymer) { %>,
      '!**/webcomponents.js'<% } %>,
      '!**/*_test.*'
    ])
      .pipe($.angularFilesort()));

    // add unit tests
    stream.queue(gulp.src([config.buildUnitTestFiles]));

    return stream.done()
      .on('data', function (file) {
        karmaConf.files.push(file.path);
      });
  });

  // run unit tests
  gulp.task('unitTest', ['lint', 'karmaFiles'], function (done) {
    var server = new $.karma.Server(karmaConf, done);
    server.start();
  });

  gulp.task('build:e2eTest', function () {
    return gulp.src([config.e2eFiles])<% if (testScript === 'es6') { %>
      .pipe($.babel())
      .pipe($.rename(function (filePath) {
        filePath.extname = '.js';
      }))<% } else if (testScript === 'coffee') { %>
      .pipe($.coffee())<% } %>
      .pipe(gulp.dest(config.buildE2eTestsDir));
  });

  // run e2e tests - SERVER MUST BE RUNNING FIRST
  gulp.task('e2eTest', ['lint', 'build:e2eTest'], function () {
    return gulp.src(config.buildE2eTests)
      .pipe($.protractor.protractor({
        configFile: 'protractor.config.js'
      }))
      .on('error', function (e) {
        console.log(e);
      });
  });

  // jscs:disable requireCamelCaseOrUpperCaseIdentifiers
  /* jshint -W106 */
  gulp.task('webdriverUpdate', $.protractor.webdriver_update);
  /* jshint +W106 */
  // jscs:enable requireCamelCaseOrUpperCaseIdentifiers
};


<|start_filename|>lib/controller/templates/_spec.js<|end_filename|>
/* global describe, beforeEach, it, expect, inject, module */
'use strict';

describe('<%= ctrlName %>', function () {
  <% if (controllerAs) { %>var ctrl;<% } else { %>var scope;<% } %>

  beforeEach(module('<% if (parentModuleName) { %><%= parentModuleName %>.<% } %><%= moduleName %>'));

  beforeEach(inject(function ($rootScope, $controller) {
    <% if (controllerAs) { %>ctrl = $controller('<%= ctrlName %>');<% } else { %>scope = $rootScope.$new();
    $controller('<%= ctrlName %>', {$scope: scope});<% } %>
  }));

  it('should have ctrlName as <%= ctrlName %>', function () {
    <% if (controllerAs) { %>expect(ctrl.ctrlName).<% if (testFramework === 'mocha') { %>to.equal<% } else { %>toEqual<% } %>('<%= ctrlName %>');<% } else { %>expect(scope.<%= lowerCamel %>.ctrlName).<% if (testFramework === 'mocha') { %>to.equal<% } else { %>toEqual<% } %>('<%= ctrlName %>');<% } %>
  });
});


<|start_filename|>lib/directive/templates/_directive.coffee<|end_filename|>
'use strict'
###*
 # @ngdoc directive
 # @name <% if (parentModuleName) { %><%= parentModuleName %>.<% } %><%= moduleName %>.directive:<%= lowerCamel %>
 # @restrict EA
 # @element

 # @description

 # @example
   <example module="<% if (parentModuleName) { %><%= parentModuleName %>.<% } %><%= moduleName %>">
     <file name="index.html">
      <<%= hyphenName %>></<%= hyphenName %>>
     </file>
   </example>

###
class <%= upperCamel %>
  constructor: ->
    return {
      restrict: 'AE'
      scope: {}<% if (directiveTemplateUrl) { %>
      templateUrl: '<%= templateUrl %>/<%= hyphenName %>-directive.tpl.html'<% } else { %>
      template: '<div>{{<%= lowerCamel %>.name}}</div>'<% } %>
      replace: false<% if (controllerAs) { %>
      controllerAs: '<%= lowerCamel %>'<% } %>
      controller:<% if (!controllerAs) { %> ($scope)<% } %> ->
        <% if (controllerAs) { %>vm = @
        vm.name = '<%= lowerCamel %>'<% } else { %>$scope.<%= lowerCamel %> = {}
        $scope.<%= lowerCamel %>.name = '<%= lowerCamel %>'<% } %>
      link: (scope, element, attrs) ->
        ###jshint unused:false ###
        ###eslint "no-unused-vars": [2, {"args": "none"}]###
    }

angular
  .module '<% if (parentModuleName) { %><%= parentModuleName %>.<% } %><%= moduleName %>'
  .directive '<%= lowerCamel %>', <%= upperCamel %>
