Commit 31f0ff78 authored by Philipp Nowinski's avatar Philipp Nowinski
Browse files

[FEATURE] add test cases for typo3 frontend

parent 9b50c474
/*global describe, beforeEach, it */
'use strict';
var path = require('path'),
assert = assert = require('yeoman-generator').assert,
helpers = require('yeoman-generator').test,
os = require('os'),
fs = require('fs');
describe('sgalinski generator:typo3-frontend', function() {
before(function(done) {
helpers.run(path.join(__dirname, '../app'))
.inDir(path.join(os.tmpdir(), './temp-test'))
.withOptions({ 'skip-install': true })
.withPrompt({
projectType: 'typo3Frontend',
projectName: 'test',
autoprefixerBrowserSelection: '\'last 1 version\''
})
.on('end', done);
});
it('creates config files', function() {
assert.file([
'.editorconfig',
'.jshintrc',
'package.json',
]);
assert.noFile([
'bower.json',
'config.rb',
]);
});
it('creates gulp files', function() {
assert.file([
'gulpfile.js',
'gulp/browser-sync.js',
'gulp/css.js',
'gulp/images.js',
'gulp/javascript.js',
'gulp/settings.js'
]);
});
it('creates basic asset files', function() {
assert.noFile([
'index.html',
'js/main.js',
'sass/main.scss'
]);
});
it('creates correct gulp settings', function(done) {
fs.readFile(path.join(__dirname, 'typo3-frontend-settings.txt'), 'utf-8', function(err, expected) {
if (err) {
throw err;
}
assert.fileContent('gulp/settings.js', expected);
done();
});
});
});
module.exports = (function() {
'use strict';
var argv = require('yargs').argv,
path = require('path'),
chalk = require('chalk'),
extension = (function() {
if (typeof argv.ext === 'undefined') {
throw new Error(
chalk.red('You have to specify the extension you want to work on with the') +
chalk.yellow(' --ext ') +
chalk.red('option.')
);
}
return argv.ext;
}()),
extensionPath = path.join('typo3conf', 'ext', extension),
assetPaths = require('../' + path.join(extensionPath, 'asset-paths.json'));
return {
path: {
css: path.join(extensionPath, assetPaths.css),
sass: path.join(extensionPath, assetPaths.sass),
javascript: path.join(extensionPath, assetPaths.javascript),
compassConfig: path.join(extensionPath, assetPaths.compassConfig),
images: path.join(extensionPath, assetPaths.images)
}
};
})();
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment