2018-06-02 21:48:23 +02:00
|
|
|
var should = require('should'),
|
2014-10-10 15:54:07 +01:00
|
|
|
|
2019-08-19 12:41:09 +01:00
|
|
|
// Stuff we are testing
|
2020-03-30 16:26:47 +01:00
|
|
|
helpers = require('../../../core/frontend/helpers');
|
2014-10-10 15:54:07 +01:00
|
|
|
|
|
|
|
describe('{{post_class}} helper', function () {
|
2015-12-08 14:35:04 +00:00
|
|
|
it('can render class string', function () {
|
|
|
|
var rendered = helpers.post_class.call({});
|
2014-10-10 15:54:07 +01:00
|
|
|
|
2019-11-05 18:02:21 +07:00
|
|
|
should.exist(rendered);
|
|
|
|
rendered.string.should.equal('post no-image');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can render class string without no-image class', function () {
|
|
|
|
var rendered = helpers.post_class.call({feature_image: 'blah'});
|
|
|
|
|
2015-12-08 14:35:04 +00:00
|
|
|
should.exist(rendered);
|
|
|
|
rendered.string.should.equal('post');
|
|
|
|
});
|
2014-10-10 15:54:07 +01:00
|
|
|
|
2015-12-08 14:35:04 +00:00
|
|
|
it('can render featured class', function () {
|
|
|
|
var post = {featured: true},
|
|
|
|
rendered = helpers.post_class.call(post);
|
2014-10-10 15:54:07 +01:00
|
|
|
|
2015-12-08 14:35:04 +00:00
|
|
|
should.exist(rendered);
|
2019-11-05 18:02:21 +07:00
|
|
|
rendered.string.should.equal('post featured no-image');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can render featured class without no-image class', function () {
|
|
|
|
var post = {featured: true, feature_image: 'asdass'},
|
|
|
|
rendered = helpers.post_class.call(post);
|
|
|
|
|
|
|
|
should.exist(rendered);
|
2019-11-06 11:02:50 +07:00
|
|
|
rendered.string.should.equal('post featured');
|
2014-10-10 15:54:07 +01:00
|
|
|
});
|
|
|
|
|
2015-12-08 14:35:04 +00:00
|
|
|
it('can render page class', function () {
|
|
|
|
var post = {page: true},
|
|
|
|
rendered = helpers.post_class.call(post);
|
2014-10-10 15:54:07 +01:00
|
|
|
|
2019-11-05 18:02:21 +07:00
|
|
|
should.exist(rendered);
|
|
|
|
rendered.string.should.equal('post no-image page');
|
|
|
|
});
|
|
|
|
|
2019-11-06 11:02:50 +07:00
|
|
|
it('can render page class without no-image class', function () {
|
|
|
|
var post = {page: true, feature_image: 'asdasdas'},
|
2019-11-05 18:02:21 +07:00
|
|
|
rendered = helpers.post_class.call(post);
|
|
|
|
|
2015-12-08 14:35:04 +00:00
|
|
|
should.exist(rendered);
|
|
|
|
rendered.string.should.equal('post page');
|
2014-10-10 15:54:07 +01:00
|
|
|
});
|
|
|
|
});
|