Ghost/test/unit/helpers/post_class_spec.js

53 lines
1.6 KiB
JavaScript
Raw Normal View History

const should = require('should');
// Stuff we are testing
const helpers = require('../../../core/frontend/helpers');
describe('{{post_class}} helper', function () {
it('can render class string', function () {
const rendered = helpers.post_class.call({});
should.exist(rendered);
rendered.string.should.equal('post no-image');
});
it('can render class string without no-image class', function () {
const rendered = helpers.post_class.call({feature_image: 'blah'});
should.exist(rendered);
rendered.string.should.equal('post');
});
it('can render featured class', function () {
const post = {featured: true};
const rendered = helpers.post_class.call(post);
should.exist(rendered);
rendered.string.should.equal('post featured no-image');
});
it('can render featured class without no-image class', function () {
const post = {featured: true, feature_image: 'asdass'};
const rendered = helpers.post_class.call(post);
should.exist(rendered);
2019-11-06 07:02:50 +03:00
rendered.string.should.equal('post featured');
});
it('can render page class', function () {
const post = {page: true};
const rendered = helpers.post_class.call(post);
should.exist(rendered);
rendered.string.should.equal('post no-image page');
});
2019-11-06 07:02:50 +03:00
it('can render page class without no-image class', function () {
const post = {page: true, feature_image: 'asdasdas'};
const rendered = helpers.post_class.call(post);
should.exist(rendered);
rendered.string.should.equal('post page');
});
});