mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
test: add translateInPlace test
This commit is contained in:
@@ -555,4 +555,17 @@ describe('Utility Methods', () => {
|
||||
}, 200);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Translator', () => {
|
||||
const shim = require('../src/translator');
|
||||
|
||||
const { Translator } = shim;
|
||||
it('should translate in place', async () => {
|
||||
const translator = Translator.create('en-GB');
|
||||
const el = $(`<div><span id="search" title="[[global:search]]"></span><span id="text">[[global:home]]</span></div>`);
|
||||
await translator.translateInPlace(el.get(0));
|
||||
assert.strictEqual(el.find('#text').text(), 'Home');
|
||||
assert.strictEqual(el.find('#search').attr('title'), 'Search');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user