Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehdy Dara committed Sep 2, 2015
1 parent 4b56a2e commit fd0cb95
Show file tree
Hide file tree
Showing 37 changed files with 76 additions and 76 deletions.
6 changes: 3 additions & 3 deletions app/src/bower.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = function(GulpAngularGenerator) {

}

if (this.props.cssPreprocessor.key === 'none') {
if (this.props.cssPreprocessor.key === 'noCssPrepro') {
bowerOverrides.bootstrap.main.unshift('dist/css/bootstrap.css');
}

Expand Down Expand Up @@ -78,7 +78,7 @@ module.exports = function(GulpAngularGenerator) {
*/
GulpAngularGenerator.prototype.computeWiredepExclusions = function computeWiredepExclusions() {
this.wiredepExclusions = [];
if (this.props.jQuery.key === 'none' || this.props.jQuery.key === 'zepto') {
if (this.props.jQuery.key === 'jqLite' || this.props.jQuery.key === 'zepto') {
this.wiredepExclusions.push('/jquery/');
}
if (this.props.ui.key === 'bootstrap') {
Expand All @@ -88,7 +88,7 @@ module.exports = function(GulpAngularGenerator) {
this.wiredepExclusions.push('/bootstrap-sass\\/.*\\.js/');
}
}
if(this.props.cssPreprocessor.key !== 'none') {
if(this.props.cssPreprocessor.key !== 'noCssPrepro') {
this.wiredepExclusions.push('/bootstrap\\.css/');
}
} else if (this.props.ui.key === 'foundation') {
Expand Down
6 changes: 3 additions & 3 deletions app/src/mock-prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ module.exports = {
router: model.router.values['ui-router'],
ui: model.ui.values.bootstrap,
bootstrapComponents: model.bootstrapComponents.values['ui-bootstrap'],
foundationComponents: model.foundationComponents.values.none,
foundationComponents: model.foundationComponents.values.noFoundationComponents,
cssPreprocessor: model.cssPreprocessor.values['node-sass'],
jsPreprocessor: model.jsPreprocessor.values.none,
htmlPreprocessor: model.htmlPreprocessor.values.none
jsPreprocessor: model.jsPreprocessor.values.noJsPrepro,
htmlPreprocessor: model.htmlPreprocessor.values.noHtmlPrepro
}
};
8 changes: 4 additions & 4 deletions app/src/preprocessors.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = function(GulpAngularGenerator) {
this.watchTaskDeps.push('\'scripts:watch\'');
}

if (this.props.htmlPreprocessor.key !== 'none') {
if (this.props.htmlPreprocessor.key !== 'noHtmlPrepro') {
this.watchTaskDeps.push('\'markups\'');
}

Expand All @@ -55,7 +55,7 @@ module.exports = function(GulpAngularGenerator) {
* depending on options. This step reject these files.
*/
GulpAngularGenerator.prototype.rejectFiles = function rejectFiles() {
if(this.props.cssPreprocessor.key === 'none') {
if(this.props.cssPreprocessor.key === 'noCssPrepro') {
rejectWithRegexp.call(this, /styles\.js/);
}

Expand All @@ -69,11 +69,11 @@ module.exports = function(GulpAngularGenerator) {
rejectWithRegexp.call(this, /index\.constants\.js/);
}

if(this.props.htmlPreprocessor.key === 'none') {
if(this.props.htmlPreprocessor.key === 'noHtmlPrepro') {
rejectWithRegexp.call(this, /markups\.js/);
}

if(this.props.jsPreprocessor.key !== 'none') {
if(this.props.jsPreprocessor.key !== 'noJsPrepro') {
rejectWithRegexp.call(this, /^(?!^e2e\/).*spec\.js/);
}
};
Expand Down
2 changes: 1 addition & 1 deletion app/src/techs.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = function(GulpAngularGenerator) {
])
.filter(_.isString)
.filter(function(tech) {
return tech !== 'default' && tech !== 'css' && tech !== 'official' && tech !== 'none';
return listTechs[tech] !== undefined;
});

var techsContent = _.map(usedTechs, function(value) {
Expand Down
10 changes: 5 additions & 5 deletions app/templates/_karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function listFiles() {

return wiredep(wiredepOptions).js
.concat([
<% if (props.jsPreprocessor.key === 'none') { -%>
<% if (props.jsPreprocessor.key === 'noJsPrepro') { -%>
path.join(conf.paths.src, '/app/**/*.module.js'),
path.join(conf.paths.src, '/app/**/*.js'),
path.join(conf.paths.src, '/**/*.spec.js'),
Expand Down Expand Up @@ -53,11 +53,11 @@ module.exports = function(config) {

logLevel: 'WARN',

<% if (props.jsPreprocessor.key === 'none' || props.jsPreprocessor.key === 'coffee') { -%>
<% if (props.jsPreprocessor.key === 'noJsPrepro' || props.jsPreprocessor.key === 'coffee') { -%>
frameworks: ['jasmine', 'angular-filesort'],

angularFilesort: {
<% if (props.jsPreprocessor.key === 'none') { -%>
<% if (props.jsPreprocessor.key === 'noJsPrepro') { -%>
whitelist: [path.join(conf.paths.src, '/**/!(*.html|*.spec|*.mock).js')]
<% } else { -%>
whitelist: [path.join(conf.paths.tmp, '/**/!(*.html|*.spec|*.mock).js')]
Expand All @@ -68,7 +68,7 @@ module.exports = function(config) {

preprocessors: {
'src/**/*.html': ['ng-html2js'],
<% if (props.jsPreprocessor.key === 'none') { -%>
<% if (props.jsPreprocessor.key === 'noJsPrepro') { -%>
'src/**/!(*.spec).js': ['coverage']
<% } else { -%>
'.tmp/**/!(*.spec).js': ['coverage']
Expand Down Expand Up @@ -96,7 +96,7 @@ module.exports = function(config) {
plugins : [
'karma-phantomjs-launcher',
<% } if (props.jsPreprocessor.key === 'none' || props.jsPreprocessor.key === 'coffee') { -%>
<% } if (props.jsPreprocessor.key === 'noJsPrepro' || props.jsPreprocessor.key === 'coffee') { -%>
'karma-angular-filesort',
'karma-coverage',
<% } -%>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"tsd": "~0.6.1",
<% } else if (props.jsPreprocessor.srcExtension !== 'es6') { -%>
"gulp-angular-filesort": "~1.1.1",
<% } if (props.htmlPreprocessor.key !== 'none') { -%>
<% } if (props.htmlPreprocessor.key !== 'noHtmlPrepro') { -%>
"gulp-consolidate": "~0.1.2",
<% } if (props.htmlPreprocessor.key === 'jade') { -%>
"jade": "~1.11.0",
Expand Down
2 changes: 1 addition & 1 deletion app/templates/gulp/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var $ = require('gulp-load-plugins')({
pattern: ['gulp-*', 'main-bower-files', 'uglify-save-license', 'del']
});

<% if (props.htmlPreprocessor.key === 'none') { -%>
<% if (props.htmlPreprocessor.key === 'noHtmlPrepro') { -%>
gulp.task('partials', function () {
<% } else { -%>
gulp.task('partials', ['markups'], function () {
Expand Down
2 changes: 1 addition & 1 deletion app/templates/gulp/_inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var $ = require('gulp-load-plugins')();
var wiredep = require('wiredep').stream;
var _ = require('lodash');

<% if (props.cssPreprocessor.key !== 'none') { -%>
<% if (props.cssPreprocessor.key !== 'noCssPrepro') { -%>
gulp.task('inject', ['scripts', 'styles'], function () {
var injectStyles = gulp.src([
path.join(conf.paths.tmp, '/serve/app/**/*.css'),
Expand Down
4 changes: 2 additions & 2 deletions app/templates/gulp/_scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ gulp.task('scripts', function () {
<% if (props.jsPreprocessor.extension === 'js') { -%>
.pipe($.eslint())
.pipe($.eslint.format())
<% } if (props.jsPreprocessor.key !== 'none') { -%>
<% } if (props.jsPreprocessor.key !== 'noJsPrepro') { -%>
.pipe($.sourcemaps.init())
<% } if (props.jsPreprocessor.key === 'coffee') { -%>
.pipe($.coffeelint())
.pipe($.coffeelint.reporter())
.pipe($.coffee()).on('error', conf.errorHandler('CoffeeScript'))
<% } if (props.jsPreprocessor.key !== 'none') { -%>
<% } if (props.jsPreprocessor.key !== 'noJsPrepro') { -%>
.pipe($.sourcemaps.write())
.pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/app')))
<% } -%>
Expand Down
4 changes: 2 additions & 2 deletions app/templates/gulp/_watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ gulp.task('watch', [<%- watchTaskDeps.join(', ') %>], function () {
], function(event) {
<% } -%>
if(isOnlyChange(event)) {
<% if (props.cssPreprocessor.key === 'none') { -%>
<% if (props.cssPreprocessor.key === 'noCssPrepro') { -%>
browserSync.reload(event.path);
<% } else { -%>
gulp.start('styles');
Expand All @@ -50,7 +50,7 @@ gulp.task('watch', [<%- watchTaskDeps.join(', ') %>], function () {
});
<% } -%>

<% if (props.htmlPreprocessor.key !== 'none') { -%>
<% if (props.htmlPreprocessor.key !== 'noHtmlPrepro') { -%>
gulp.watch(path.join(conf.paths.src, '/app/**/*.<%- props.htmlPreprocessor.extension %>'), ['markups']);

<% } -%>
Expand Down
4 changes: 2 additions & 2 deletions app/templates/src/app/_index.module.es6
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import config from './index.config';
<% if (props.router.key === 'new-router') { -%>
import { routerConfig, RouterController } from './index.route';
<% } else if (props.router.key !== 'none') { -%>
<% } else if (props.router.key !== 'noRouter') { -%>
import routerConfig from './index.route';
<% } -%>
import runBlock from './index.run';
Expand All @@ -17,7 +17,7 @@ angular.module('<%- appName %>', [<%- modulesDependencies %>])
.constant('malarkey', malarkey)
.constant('moment', moment)
.config(config)
<% if (props.router.key !== 'none') { -%>
<% if (props.router.key !== 'noRouter') { -%>
.config(routerConfig)
<% } -%>
.run(runBlock)
Expand Down
4 changes: 2 additions & 2 deletions app/templates/src/app/_index.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { config } from './index.config';
<% if (props.router.key === 'new-router') { -%>
import { routerConfig, RouterController } from './index.route';
<% } else if (props.router.key !== 'none') { -%>
<% } else if (props.router.key !== 'noRouter') { -%>
import { routerConfig } from './index.route';
<% } -%>
import { runBlock } from './index.run';
Expand All @@ -23,7 +23,7 @@ module <%- appName %> {
.constant('malarkey', malarkey)
.constant('moment', moment)
.config(config)
<% if (props.router.key !== 'none') { -%>
<% if (props.router.key !== 'noRouter') { -%>
.config(routerConfig)
<% } -%>
.run(runBlock)
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions test/inception/test-inception.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('gulp-angular generator inception tests', function () {
router: prompts.router.values['ui-router'],
ui: prompts.ui.values.foundation,
foundationComponents: prompts.foundationComponents.values['angular-foundation'],
cssPreprocessor: prompts.cssPreprocessor.values.none,
cssPreprocessor: prompts.cssPreprocessor.values.noCssPrepro,
jsPreprocessor: prompts.jsPreprocessor.values.coffee,
htmlPreprocessor: prompts.htmlPreprocessor.values.jade
}).then(function(generator) {
Expand All @@ -70,8 +70,8 @@ describe('gulp-angular generator inception tests', function () {
before(function() {
return inception.prepare({}, {
jQuery: prompts.jQuery.values['zeptojs 1.1'],
resource: prompts.resource.values.none,
router: prompts.router.values.none,
resource: prompts.resource.values['$http'],
router: prompts.router.values.noRouter,
ui: prompts.ui.values.bootstrap,
bootstrapComponents: prompts.bootstrapComponents.values['ui-bootstrap'],
cssPreprocessor: prompts.cssPreprocessor.values.less,
Expand Down
14 changes: 7 additions & 7 deletions test/node/test-bower.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('gulp-angular generator bower script', function () {
generator.props = {
ui: { key: 'bootstrap' },
bootstrapComponents: { key: 'something' },
cssPreprocessor: { key: 'none' },
cssPreprocessor: { key: 'noCssPrepro' },
router: { key: 'notnewrouter' }
};
generator.prepareBowerOverrides();
Expand Down Expand Up @@ -185,7 +185,7 @@ describe('gulp-angular generator bower script', function () {
it('should exclude nothing if no ui', function() {
generator.props = {
jQuery: { key: 'jquery1' },
ui: { key: 'none' }
ui: { key: 'noUI' }
};
generator.computeWiredepExclusions();
generator.wiredepExclusions.length.should.be.equal(0);
Expand All @@ -196,7 +196,7 @@ describe('gulp-angular generator bower script', function () {
jQuery: { key: 'jquery1' },
ui: { key: 'bootstrap' },
bootstrapComponents: { key: 'official' },
cssPreprocessor: { key: 'none' }
cssPreprocessor: { key: 'noCssPrepro' }
};
generator.computeWiredepExclusions();
generator.wiredepExclusions.length.should.be.equal(0);
Expand All @@ -207,18 +207,18 @@ describe('gulp-angular generator bower script', function () {
jQuery: { key: 'jquery1' },
ui: { key: 'foundation' },
foundationComponents: { key: 'official' },
cssPreprocessor: { key: 'none' }
cssPreprocessor: { key: 'noCssPrepro' }
};
generator.computeWiredepExclusions();
generator.wiredepExclusions.length.should.be.equal(0);
});

it('should exclude jQuery if select "None"', function() {
generator.props = {
jQuery: { key: 'none' },
jQuery: { key: 'jqLite' },
ui: { key: 'foundation' },
foundationComponents: { key: 'official' },
cssPreprocessor: { key: 'none' }
cssPreprocessor: { key: 'noCssPrepro' }
};
generator.computeWiredepExclusions();
generator.wiredepExclusions[0].should.be.equal('/jquery/');
Expand All @@ -229,7 +229,7 @@ describe('gulp-angular generator bower script', function () {
jQuery: { key: 'zepto' },
ui: { key: 'foundation' },
foundationComponents: { key: 'official' },
cssPreprocessor: { key: 'none' }
cssPreprocessor: { key: 'noCssPrepro' }
};
generator.computeWiredepExclusions();
generator.wiredepExclusions[0].should.be.equal('/jquery/');
Expand Down
8 changes: 4 additions & 4 deletions test/node/test-preprocessors.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('gulp-angular generator preprocessors script', function () {
it('should be inject if no es6 or html prepro', function() {
generator.props = {
jsPreprocessor: { srcExtension: 'notes6' },
htmlPreprocessor: { key: 'none' }
htmlPreprocessor: { key: 'noHtmlPrepro' }
};
generator.computeWatchTaskDeps();
generator.watchTaskDeps.length.should.be.equal(1);
Expand All @@ -73,9 +73,9 @@ describe('gulp-angular generator preprocessors script', function () {
describe('reject files depending on preprocessors choices', function() {
it('should reject preprocessors gulp files if no preprocessors', function() {
generator.props = {
cssPreprocessor: { key: 'none' },
jsPreprocessor: { key: 'none' },
htmlPreprocessor: { key: 'none' }
cssPreprocessor: { key: 'noCssPrepro' },
jsPreprocessor: { key: 'noJsPrepro' },
htmlPreprocessor: { key: 'noHtmlPrepro' }
};
generator.rejectFiles();
generator.files.length.should.be.equal(2);
Expand Down
2 changes: 1 addition & 1 deletion test/node/test-prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('gulp-angular generator prompts script', function () {

describe('ask for all standard questions', function () {
it('should ask all questions', function() {
sinon.stub(generator, 'prompt').callsArgWith(1, { ui: { key: 'none' } });
sinon.stub(generator, 'prompt').callsArgWith(1, { ui: { key: 'noUI' } });
generator.askQuestions();
generator.prompt.should.have.been.called;
generator.props.bootstrapComponents.should.be.an('object');
Expand Down
2 changes: 1 addition & 1 deletion test/node/test-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('gulp-angular generator router script', function () {
generator.files = [];
read.withArgs('template/src/app/main/__testUi.html')
.returns('<div class="container">');
generator.props.router.key = 'none';
generator.props.router.key = 'noRouter';
generator.computeRouter();
generator.routerHtml.should.match(/MainController/);
generator.files.length.should.equal(0);
Expand Down
2 changes: 1 addition & 1 deletion test/node/test-techs.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('gulp-angular generator techs script', function () {
jQuery: { name: 'tech-name-1' },
ui: { key: 'tech-name-2' },
bootstrapComponents: { key: null },
foundationComponents: { key: 'none' },
foundationComponents: { key: 'noFoundationComponents' },
cssPreprocessor: { extension: 'default' },
jsPreprocessor: { extension: 'css' },
htmlPreprocessor: { extension: 'official' }
Expand Down
8 changes: 4 additions & 4 deletions test/node/test-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ describe('gulp-angular generator ui script', function () {
it('should add only navbar and index.scss for no router and no ui', function() {
generator.props = {
router: { module: null },
ui: { key: 'none' },
cssPreprocessor: { key: 'none', extension: 'css' }
ui: { key: 'noUI' },
cssPreprocessor: { key: 'noCssPrepro', extension: 'css' }
};
generator.files = [];
generator.uiFiles();
generator.files[0].src.should.be.equal('src/app/components/navbar/__none-navbar.html');
generator.files[1].src.should.be.equal('src/app/_none/__none-index.css');
generator.files[0].src.should.be.equal('src/app/components/navbar/__noUI-navbar.html');
generator.files[1].src.should.be.equal('src/app/_noUI/__noUI-index.css');
generator.files[2].src.should.be.equal('src/app/components/malarkey/__malarkey.css');
generator.files[3].src.should.be.equal('src/app/components/navbar/__navbar.css');
generator.files.length.should.be.equal(4);
Expand Down

0 comments on commit fd0cb95

Please sign in to comment.