shaman-website-compiler
Version:
Compile raw HTML, CSS and Javascript into the smallest possible, SEO friendly website.
41 lines • 2.98 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("mocha");
var chai_1 = require("chai");
var models_1 = require("../models");
var handlebars_functions_1 = require("./handlebars.functions");
describe('HandlebarsFunctions', function () {
it('CreateBundleTags should create tags for css files in bundle', function () {
var bundle1 = new models_1.Bundle({ name: 'a', type: 'css', files: ['a.css'], path: 'a.css' });
var bundle2 = new models_1.Bundle({ name: 'b', type: 'css', files: ['b.css'], path: 'b.css' });
var result = (0, handlebars_functions_1.CreateBundleTags)([bundle1, bundle2]);
var bundle1String = '<link rel="stylesheet" type="text/css" href="/a.css">';
var bundle2String = '<link rel="stylesheet" type="text/css" href="/b.css">';
(0, chai_1.expect)(result).to.equal("".concat(bundle1String, "\r\n").concat(bundle2String));
});
it('CreateBundleTags should create tags for files in bundle', function () {
var bundle1 = new models_1.Bundle({ name: 'a', type: 'js', files: ['a.js'], path: 'a.js' });
var bundle2 = new models_1.Bundle({ name: 'b', type: 'js', files: ['b.js'], path: 'b.js' });
var result = (0, handlebars_functions_1.CreateBundleTags)([bundle1, bundle2]);
var bundle1String = '<script type="text/javascript" src="/a.js"></script>';
var bundle2String = '<script type="text/javascript" src="/b.js"></script>';
(0, chai_1.expect)(result).to.equal("".concat(bundle1String, "\r\n").concat(bundle2String));
});
it('CreateMinifiedBundleTags should create minified css bundle tag', function () {
var bundle1 = new models_1.Bundle({ name: 'a', type: 'css', files: ['a.css'], path: 'a.css' });
var bundle2 = new models_1.Bundle({ name: 'b', type: 'css', files: ['b.css'], path: 'b.css' });
var result = (0, handlebars_functions_1.CreateMinifiedBundleTags)([bundle1, bundle2]);
var bundle1String = '<link rel="stylesheet" type="text/css" href="/a.min.css">';
var bundle2String = '<link rel="stylesheet" type="text/css" href="/b.min.css">';
(0, chai_1.expect)(result).to.equal("".concat(bundle1String, "\r\n").concat(bundle2String));
});
it('CreateMinifiedBundleTags should create minified js bundle tag', function () {
var bundle1 = new models_1.Bundle({ name: 'a', type: 'js', files: ['a.js'], path: 'a.js' });
var bundle2 = new models_1.Bundle({ name: 'b', type: 'js', files: ['b.js'], path: 'b.js' });
var result = (0, handlebars_functions_1.CreateMinifiedBundleTags)([bundle1, bundle2]);
var bundle1String = '<script type="text/javascript" src="/a.min.js"></script>';
var bundle2String = '<script type="text/javascript" src="/b.min.js"></script>';
(0, chai_1.expect)(result).to.equal("".concat(bundle1String, "\r\n").concat(bundle2String));
});
});
//# sourceMappingURL=handlebars.functions.spec.js.map