Skip to content

Commit 5cb73de

Browse files
committed
trans with $t() nesting test
1 parent da4d5e2 commit 5cb73de

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

test/i18n.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ i18n.init({
6363
},
6464
other: {
6565
transTest1: 'Another go <1>there</1>.',
66+
nestingKey1: 'This is key1 value and $t(nestedKey2)',
67+
nestedKey2: 'This is key2 value',
6668
},
6769
},
6870
},

test/trans.render.spec.jsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,3 +1080,18 @@ describe('trans with defaults property and children', () => {
10801080
`);
10811081
});
10821082
});
1083+
1084+
describe('trans with nesting $t()', () => {
1085+
function TestComponent({ parent }) {
1086+
return <Trans i18nKey="nestingKey1" ns="other" parent={parent} />;
1087+
}
1088+
1089+
it('should render correct content', () => {
1090+
const { container } = render(<TestComponent />);
1091+
expect(container.firstChild).toMatchInlineSnapshot(`
1092+
<div>
1093+
This is key1 value and This is key2 value
1094+
</div>
1095+
`);
1096+
});
1097+
});

0 commit comments

Comments
 (0)