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
|
2021-10-06 12:52:46 +03:00
|
|
|
const post_class = require('../../../../core/frontend/helpers/post_class');
|
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 () {
|
2021-10-04 18:30:54 +03:00
|
|
|
const rendered = 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 () {
|
2021-10-04 18:30:54 +03:00
|
|
|
const rendered = 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};
|
2021-10-04 18:30:54 +03:00
|
|
|
const rendered = 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'};
|
2021-10-04 18:30:54 +03:00
|
|
|
const rendered = 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};
|
2021-10-04 18:30:54 +03:00
|
|
|
const rendered = 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'};
|
2021-10-04 18:30:54 +03:00
|
|
|
const rendered = 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
|
|
|
});
|
|
|
|
});
|