mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 02:11:44 +03:00
b4140d4310
refs https://github.com/TryGhost/Casper/pull/741 closes https://github.com/TryGhost/Team/issues/524 - Use a local-based format as the default format as suggested in https://github.com/TryGhost/Casper/pull/741 - reworked the helper to be easier to read and follow the different use cases - introduced setting and resetting locale in tests via settingsCache and themei18n - updated tests to cover more cases e.g. passing a date, this.published_at and no date - added validation for user inputted dates because they could literally be anything Co-authored-by: Hannah Wolfe <erisds@gmail.com>
25 lines
755 B
JavaScript
25 lines
755 B
JavaScript
const should = require('should');
|
|
const settingsCache = require('../../../core/server/services/settings/cache');
|
|
const helpers = require('../../../core/frontend/helpers');
|
|
const proxy = require('../../../core/frontend/services/proxy');
|
|
|
|
describe('{{lang}} helper', function () {
|
|
beforeEach(function () {
|
|
settingsCache.set('lang', {value: 'en'});
|
|
proxy.themeI18n._loadLocale();
|
|
});
|
|
|
|
afterEach(function () {
|
|
settingsCache.shutdown();
|
|
proxy.themeI18n._loadLocale();
|
|
});
|
|
|
|
it('returns correct language tag', function () {
|
|
let expected = proxy.themeI18n.locale();
|
|
let rendered = helpers.lang.call();
|
|
|
|
should.exist(rendered);
|
|
rendered.string.should.equal(expected);
|
|
});
|
|
});
|