mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 01:41:46 +03:00
95d27e7f58
- this is a small part of a bit of cleanup of our test files - the goal is to make the existing tests clearer with a view to making it easier to write more tests - this makes the test structure follow the codebase structure more closely - eventually we will colocate the frontend tests with the frontend code
53 lines
1.6 KiB
JavaScript
53 lines
1.6 KiB
JavaScript
const should = require('should');
|
|
|
|
// Stuff we are testing
|
|
const post_class = require('../../../../core/frontend/helpers/post_class');
|
|
|
|
describe('{{post_class}} helper', function () {
|
|
it('can render class string', function () {
|
|
const rendered = 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 = 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 = 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 = post_class.call(post);
|
|
|
|
should.exist(rendered);
|
|
rendered.string.should.equal('post featured');
|
|
});
|
|
|
|
it('can render page class', function () {
|
|
const post = {page: true};
|
|
const rendered = post_class.call(post);
|
|
|
|
should.exist(rendered);
|
|
rendered.string.should.equal('post no-image page');
|
|
});
|
|
|
|
it('can render page class without no-image class', function () {
|
|
const post = {page: true, feature_image: 'asdasdas'};
|
|
const rendered = post_class.call(post);
|
|
|
|
should.exist(rendered);
|
|
rendered.string.should.equal('post page');
|
|
});
|
|
});
|