mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 02:41:50 +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
63 lines
1.9 KiB
JavaScript
63 lines
1.9 KiB
JavaScript
const should = require('should'),
|
|
path = require('path'),
|
|
settingsCache = require('../../../server/services/settings/cache'),
|
|
helpers = require('../../../frontend/helpers'),
|
|
common = require('../../../server/lib/common'),
|
|
configUtils = require('../../utils/configUtils');
|
|
|
|
describe('{{t}} helper', function () {
|
|
beforeEach(function () {
|
|
settingsCache.set('active_theme', {value: 'casper'});
|
|
configUtils.set('paths:contentPath', path.join(__dirname, '../../utils/fixtures/'));
|
|
});
|
|
|
|
afterEach(function () {
|
|
configUtils.restore();
|
|
settingsCache.shutdown();
|
|
});
|
|
|
|
it('theme translation is DE', function () {
|
|
settingsCache.set('default_locale', {value: 'de'});
|
|
|
|
let rendered = helpers.t.call({}, 'Top left Button', {
|
|
hash: {}
|
|
});
|
|
|
|
rendered.should.eql('Oben Links.');
|
|
});
|
|
|
|
it('theme translation is EN', function () {
|
|
settingsCache.set('default_locale', {value: 'en'});
|
|
common.i18n.loadThemeTranslations();
|
|
|
|
let rendered = helpers.t.call({}, 'Top left Button', {
|
|
hash: {}
|
|
});
|
|
|
|
rendered.should.eql('Left Button on Top');
|
|
});
|
|
|
|
it('[fallback] no theme translation file found for FR', function () {
|
|
settingsCache.set('default_locale', {value: 'fr'});
|
|
common.i18n.loadThemeTranslations();
|
|
|
|
let rendered = helpers.t.call({}, 'Top left Button', {
|
|
hash: {}
|
|
});
|
|
|
|
rendered.should.eql('Left Button on Top');
|
|
});
|
|
|
|
it('[fallback] no theme files at all, use key as translation', function () {
|
|
settingsCache.set('active_theme', {value: 'casper-1.4'});
|
|
settingsCache.set('default_locale', {value: 'de'});
|
|
common.i18n.loadThemeTranslations();
|
|
|
|
let rendered = helpers.t.call({}, 'Top left Button', {
|
|
hash: {}
|
|
});
|
|
|
|
rendered.should.eql('Top left Button');
|
|
});
|
|
});
|