grunt-contrib-jasmine/test/jasmine_test.js
Scott Davis 2e735b34e0 Added jasmine favicon to default html runner template.
This will allow this project to be used with the [jasmine-favicon-reporter](https://github.com/simsalabim/jasmine-favicon-reporter) project as well as make the spec runner look a bit nicer.
2014-04-11 14:55:18 -06:00

46 lines
1.2 KiB
JavaScript

'use strict';
var grunt = require('grunt');
// Majority of test benefit comes from running the task itself.
function runTemplate(src,context) {
var source = grunt.file.read(src);
return grunt.util._.template(source, context);
}
// Just strips whitespace for now. Should do a proper min of everything
// but this is working well enough for now.
function normalize(html) {
return html.replace(/\s*/g,'');
}
exports.jasmine = {
defaultTemplate: function(test) {
test.expect(1);
var context = {
css : ['css/a.css'],
scripts : {
polyfills : ['p1.js'],
jasmine : ['J1.js','J2.js'],
helpers : ['H1.js','H2.js'],
specs : ['SPEC1.js','SPEC2.js'],
src : ['SRC1.js','SRC2.js'],
vendor : ['V1.js','V2.js'],
reporters : ['R1.js'],
boot : ['BOOT.js']
},
temp: 'path/to/temp/folder',
options : {}
};
var actual = runTemplate('./tasks/jasmine/templates/DefaultRunner.tmpl', context);
var expected = grunt.file.read('./test/expected/defaultTemplate.html');
test.equal(normalize(actual),normalize(expected), 'default test runner template');
test.done();
}
};