Ghost/core/test/unit/helpers/index_spec.js
Nazar Gargol 154366f448 🎨 Added additional parameters to subscribe_form and input_email helpers (#9820)
closes #9134

- Added form_id, input_id, and button_id parameters to subscribe_form helper
- Added id parameter to input_email helper
- Added test coverage to input_email helper
- Added quotes to id attributes for consistency
- Added subscribe_form helper tests
- Updated express to v4 in helper tests
2018-08-30 17:17:27 +01:00

38 lines
1.6 KiB
JavaScript

var should = require('should'),
_ = require('lodash'),
hbs = require.main.require('core/server/services/themes/engine'),
// Stuff we are testing
helpers = require.main.require('core/server/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);
});
});
});