2020-03-19 14:07:20 +00:00
|
|
|
const should = require('should');
|
2020-03-30 16:26:47 +01:00
|
|
|
const helpers = require('../../../core/frontend/helpers');
|
2018-01-09 14:50:57 +01:00
|
|
|
|
|
|
|
describe('{{lang}} helper', function () {
|
2021-05-04 16:49:35 +01:00
|
|
|
it('returns correct language tag', function () {
|
|
|
|
const locales = [
|
|
|
|
'en',
|
|
|
|
'en-gb',
|
|
|
|
'de'
|
|
|
|
];
|
2018-01-09 14:50:57 +01:00
|
|
|
|
2021-05-04 16:49:35 +01:00
|
|
|
locales.forEach((locale) => {
|
|
|
|
const context = {
|
|
|
|
hash: {},
|
|
|
|
data: {
|
|
|
|
site: {
|
|
|
|
locale
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2018-01-09 14:50:57 +01:00
|
|
|
|
2021-05-04 16:49:35 +01:00
|
|
|
let rendered = helpers.lang.call({}, context);
|
2018-01-09 14:50:57 +01:00
|
|
|
|
2021-05-04 16:49:35 +01:00
|
|
|
should.exist(rendered);
|
|
|
|
rendered.string.should.equal(locale);
|
|
|
|
});
|
2018-01-09 14:50:57 +01:00
|
|
|
});
|
|
|
|
});
|