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