Skip to content

Commit

Permalink
Add test for multi-var case
Browse files Browse the repository at this point in the history
Related to ttag-org#212
  • Loading branch information
valtzu authored and mmso committed Jul 5, 2023
1 parent a08195e commit d3e25f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/fixtures/test-loader.po
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ msgstr "test [translation]"
msgid "test ${ 0 } test"
msgstr "test ${ 0 } test [translation]"

msgid "test ${ 0 } test ${ 0 } test"
msgstr "test ${ 0 } test ${ 0 } test [translation]"

#: tests/fixtures/fixture.js:9
msgid "test with ${ 0 } plural"
msgid_plural "test with ${ 0 } plurals"
Expand Down
4 changes: 4 additions & 0 deletions tests/test_jt.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ describe('jt', () => {
expect(jt`test ${1} test`).to.deep.eql(['test ', 1, ' test [translation]']);
});

it('should resolve translation with expression that is used multiple times', () => {
expect(jt`test ${1} test ${1} test`).to.deep.eql(['test ', 1, ' test ', 1, ' test [translation]']);
});

it('should use the same str if no translation found', () => {
expect(jt`not found`).to.deep.eql(['not found']);
});
Expand Down

0 comments on commit d3e25f2

Please sign in to comment.