You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-08-09 08:42:50 +03:00
Merge pull request #3339 from matrix-org/t3chguy/substitute_handle_global
Iterate over all instances of variable/tag for _t substitutions
This commit is contained in:
@@ -70,4 +70,15 @@ describe('languageHandler', function() {
|
||||
const text = '%(var1)s %(var2)s';
|
||||
expect(languageHandler._t(text, { var2: 'val2', var1: 'val1' })).toBe('val1 val2');
|
||||
});
|
||||
|
||||
it('multiple replacements of the same variable', function() {
|
||||
const text = '%(var1)s %(var1)s';
|
||||
expect(languageHandler.substitute(text, { var1: 'val1' })).toBe('val1 val1');
|
||||
});
|
||||
|
||||
it('multiple replacements of the same tag', function() {
|
||||
const text = '<a>Click here</a> to join the discussion! <a>or here</a>';
|
||||
expect(languageHandler.substitute(text, {}, { 'a': (sub) => `x${sub}x` }))
|
||||
.toBe('xClick herex to join the discussion! xor herex');
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user