mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 11:34:24 +03:00
df7e64fafa
refs #10790 - Moved /core/apps into core/frontend - Moved /core/server/helpers to /core/frontend/helpers along with /core/server/services/themes - Changed helper location in overrides - Moved /core/server/services/routing to /core/frontend/services - Moved /core/server/services/url to /core/frontend/services - Moved /core/server/data/meta to /core/frontend/meta - Moved /core/server/services/rss to /core/frontend/services - Moved /core/server/data/xml to /core/frontend/services
38 lines
1.6 KiB
JavaScript
38 lines
1.6 KiB
JavaScript
var should = require('should'),
|
|
_ = require('lodash'),
|
|
hbs = require.main.require('core/frontend/services/themes/engine'),
|
|
|
|
// Stuff we are testing
|
|
helpers = require.main.require('core/frontend/helpers');
|
|
|
|
describe('Helpers', function () {
|
|
var hbsHelpers = ['each', 'if', 'unless', 'with', 'helperMissing', 'blockHelperMissing', 'log', 'lookup', 'block', 'contentFor'],
|
|
ghostHelpers = [
|
|
'asset', 'author', 'authors', 'body_class', 'content', 'date', 'encode', 'excerpt', 'facebook_url', 'foreach', 'get',
|
|
'ghost_foot', 'ghost_head', 'has', 'img_url', 'is', 'lang', 'meta_description', 'meta_title', 'navigation',
|
|
'next_post', 'page_url', 'pagination', 'plural', 'post_class', 'prev_post', 'reading_time', 't', 'tags', 'title', 'twitter_url',
|
|
'url'
|
|
],
|
|
expectedHelpers = _.concat(hbsHelpers, ghostHelpers);
|
|
|
|
describe('Load Core Helpers', function () {
|
|
before(function () {
|
|
hbs.express4();
|
|
helpers.loadCoreHelpers();
|
|
});
|
|
|
|
// This will work when we finish refactoring
|
|
it('should have exactly the right helpers', function () {
|
|
var foundHelpers, missingHelpers, unexpectedHelpers;
|
|
|
|
foundHelpers = _.keys(hbs.handlebars.helpers);
|
|
|
|
missingHelpers = _.difference(expectedHelpers, foundHelpers);
|
|
unexpectedHelpers = _.difference(foundHelpers, expectedHelpers);
|
|
|
|
missingHelpers.should.be.an.Array().with.lengthOf(0);
|
|
unexpectedHelpers.should.be.an.Array().with.lengthOf(0);
|
|
});
|
|
});
|
|
});
|