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