2020-04-29 18:44:27 +03:00
|
|
|
const should = require('should');
|
2014-10-10 18:54:07 +04:00
|
|
|
|
2020-04-29 18:44:27 +03:00
|
|
|
// Stuff we are testing
|
|
|
|
const helpers = require('../../../core/frontend/helpers');
|
2014-10-10 18:54:07 +04:00
|
|
|
|
|
|
|
describe('{{title}} Helper', function () {
|
|
|
|
it('can render title', function () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const title = 'Hello World';
|
|
|
|
const rendered = helpers.title.call({title: title});
|
2014-10-10 18:54:07 +04:00
|
|
|
|
|
|
|
should.exist(rendered);
|
|
|
|
rendered.string.should.equal(title);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('escapes correctly', function () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const rendered = helpers.title.call({title: '<h1>I am a title</h1>'});
|
2014-10-10 18:54:07 +04:00
|
|
|
|
|
|
|
rendered.string.should.equal('<h1>I am a title</h1>');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns a blank string where title is missing', function () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const rendered = helpers.title.call({title: null});
|
2014-10-10 18:54:07 +04:00
|
|
|
|
|
|
|
rendered.string.should.equal('');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('returns a blank string where data missing', function () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const rendered = helpers.title.call({});
|
2014-10-10 18:54:07 +04:00
|
|
|
|
|
|
|
rendered.string.should.equal('');
|
|
|
|
});
|
|
|
|
});
|