email-templates
Advanced tools
Comparing version 1.1.1 to 1.1.2
{ | ||
"name": "email-templates", | ||
"description": "Node.js module for rendering beautiful emails with ejs, jade, swig, hbs, or handlebars templates and email-friendly inline CSS using juice.", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"author": "Nick Baugh <niftylettuce@gmail.com>", | ||
@@ -53,3 +53,6 @@ "contributors": [ | ||
"scripts": { | ||
"test": "./node_modules/.bin/mocha --reporter spec --ui bdd" | ||
"prepublish": "npm prune", | ||
"test": "mocha --reporter spec --bail --require test/support/should test/", | ||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --require test/support/should test/", | ||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --require test/support/should test/" | ||
}, | ||
@@ -79,3 +82,6 @@ "dependencies": { | ||
"styl": "^0.2.7", | ||
"node-sass": "^0.9.3" | ||
"node-sass": "^0.9.3", | ||
"sinon": "^1.10.2", | ||
"sinon-chai": "^2.5.0", | ||
"istanbul": "^0.3.2" | ||
}, | ||
@@ -82,0 +88,0 @@ "bugs": { |
@@ -38,3 +38,3 @@ var emailTemplates = require('../lib/main') | ||
}) | ||
it('html file with custom name', function(done) { | ||
@@ -68,3 +68,3 @@ var html = '<h4><%= item%></h4>' | ||
}) | ||
it('html and text files with custom names', function(done) { | ||
@@ -104,3 +104,3 @@ var html = '<h4><%= item%></h4>' | ||
}) | ||
it('html with inline CSS and text file with custom names', function(done) { | ||
@@ -147,2 +147,15 @@ var html = '<h4><%= item%></h4>' | ||
}) | ||
it('html file with custom open and close tags', function(done) { | ||
var html = '<h4>{{= item }}</h4>' | ||
fs.writeFileSync(path.join(templateDir, templateName, 'html.ejs'), html) | ||
emailTemplates(templateDir, {open: '{{', close: '}}'}, function(err, template) { | ||
template(templateName, {item: 'test'}, function(err, html, text) { | ||
expect(err).to.be.null | ||
expect(text).to.be.false | ||
expect(html).to.equal('<h4>test</h4>') | ||
done() | ||
}) | ||
}) | ||
}) | ||
}) | ||
@@ -149,0 +162,0 @@ |
var tm = require('../lib/templateManager') | ||
, path = require('path') | ||
, expect = require('chai').expect | ||
, fs = require('fs') | ||
, fs = require('fs') | ||
, tmpDir = path.join(__dirname, '..', '.tmproj') | ||
@@ -39,2 +39,20 @@ , mkdirp = require('mkdirp') | ||
it('should render ejs with custom opening and closing tags', function (done) { | ||
var opts = { | ||
locals: { | ||
item: 'test', | ||
open: '{{', | ||
close: '}}' | ||
}, | ||
filename: 'test.ejs', | ||
source: '<h1>{{=item}} {{=engine}}</h1>' | ||
} | ||
tm.render(opts, function(err, res) { | ||
expect(err).to.be.null | ||
expect(res).to.equal('<h1>test .ejs</h1>') | ||
done() | ||
}) | ||
}) | ||
it('should render jade', function(done) { | ||
@@ -85,2 +103,20 @@ var opts = { | ||
it ('should render handlebars with helpers', function(done) { | ||
var opts = { | ||
locals: { | ||
item: 'test', | ||
helpers: { | ||
uppercase: function(context) {return context.toUpperCase()} | ||
} | ||
}, | ||
filename: 'test.hbs', | ||
source: '<h1>{{uppercase item}} {{engine}}</h1>', | ||
} | ||
tm.render(opts, function(err, res) { | ||
expect(err).to.be.null | ||
expect(res).to.equal('<h1>TEST .hbs</h1>') | ||
done() | ||
}) | ||
}) | ||
it('should render emblem', function(done) { | ||
@@ -87,0 +123,0 @@ var opts = { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58066
21
921
528
19