Skip to content

Commit

Permalink
add useLingui test for multiple react components in the same file
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-dr authored and timofei-iatsenko committed Feb 26, 2024
1 parent d73dded commit 5ace8d1
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions packages/macro/test/js-useLingui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,44 @@ function MyComponent() {
}
);
}
`,
},
{
name: "work with multiple react components",
input: `
import { useLingui } from '@lingui/macro';
function MyComponent() {
const { t } = useLingui();
const a = t\`Text\`;
}
function MyComponent2() {
const { t } = useLingui();
const b = t\`Text\`;
}`,
expected: `
import { useLingui } from "@lingui/react";
function MyComponent() {
const { _: _t } = useLingui();
const a = _t(
/*i18n*/
{
id: "xeiujy",
message: "Text",
}
);
}
function MyComponent2() {
const { _: _t } = useLingui();
const b = _t(
/*i18n*/
{
id: "xeiujy",
message: "Text",
}
);
}
`,
},
]
Expand Down

0 comments on commit 5ace8d1

Please sign in to comment.