/*! * template-helpers * * Copyright (c) 2015, Jon Schlinkert. * Licensed under the MIT License. */ 'use strict'; var assert = require('assert'); var helpers = require('..')('html'); var template = require('lodash.template'); var imports = {imports: helpers}; describe('html', function() { describe('escapeHtml', function() { it('should return an empty string when undefined.', function() { assert.equal(template('<%= escapeHtml() %>', imports)(), ''); }); it('should return create a code example from the given file.', function() { assert.equal(template('<%= escapeHtml("foo") %>', imports)(), '<span>foo</span>'); }); }); describe('sanitize', function() { it('should return an empty string when undefined.', function() { assert.equal(template('<%= sanitize() %>', imports)(), ''); }); it('should strip html from a string.', function() { var actual = template('<%= sanitize("foo") %>', imports)(); assert.equal(actual, 'foo'); }); }); });