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('{{post_class}} helper', function () {
|
2015-12-08 17:35:04 +03:00
|
|
|
it('can render class string', function () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const rendered = helpers.post_class.call({});
|
2014-10-10 18:54:07 +04:00
|
|
|
|
2019-11-05 14:02:21 +03:00
|
|
|
should.exist(rendered);
|
|
|
|
rendered.string.should.equal('post no-image');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can render class string without no-image class', function () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const rendered = helpers.post_class.call({feature_image: 'blah'});
|
2019-11-05 14:02:21 +03:00
|
|
|
|
2015-12-08 17:35:04 +03:00
|
|
|
should.exist(rendered);
|
|
|
|
rendered.string.should.equal('post');
|
|
|
|
});
|
2014-10-10 18:54:07 +04:00
|
|
|
|
2015-12-08 17:35:04 +03:00
|
|
|
it('can render featured class', function () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const post = {featured: true};
|
|
|
|
const rendered = helpers.post_class.call(post);
|
2014-10-10 18:54:07 +04:00
|
|
|
|
2015-12-08 17:35:04 +03:00
|
|
|
should.exist(rendered);
|
2019-11-05 14:02:21 +03:00
|
|
|
rendered.string.should.equal('post featured no-image');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can render featured class without no-image class', function () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const post = {featured: true, feature_image: 'asdass'};
|
|
|
|
const rendered = helpers.post_class.call(post);
|
2019-11-05 14:02:21 +03:00
|
|
|
|
|
|
|
should.exist(rendered);
|
2019-11-06 07:02:50 +03:00
|
|
|
rendered.string.should.equal('post featured');
|
2014-10-10 18:54:07 +04:00
|
|
|
});
|
|
|
|
|
2015-12-08 17:35:04 +03:00
|
|
|
it('can render page class', function () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const post = {page: true};
|
|
|
|
const rendered = helpers.post_class.call(post);
|
2014-10-10 18:54:07 +04:00
|
|
|
|
2019-11-05 14:02:21 +03:00
|
|
|
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 () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const post = {page: true, feature_image: 'asdasdas'};
|
|
|
|
const rendered = helpers.post_class.call(post);
|
2019-11-05 14:02:21 +03:00
|
|
|
|
2015-12-08 17:35:04 +03:00
|
|
|
should.exist(rendered);
|
|
|
|
rendered.string.should.equal('post page');
|
2014-10-10 18:54:07 +04:00
|
|
|
});
|
|
|
|
});
|