Skip to content

Commit

Permalink
chore: remove the deprecated 'isTranslated' property (#1907)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-bodnar authored Apr 5, 2024
1 parent 1f18e68 commit 4c494ad
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 25 deletions.
19 changes: 0 additions & 19 deletions packages/react/src/Trans.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ describe("Trans component", () => {
message: "Default",
translation: "Translation",
children: "Translation",
isTranslated: true,
})
})

Expand Down Expand Up @@ -369,7 +368,6 @@ describe("Trans component", () => {
expect(element).toEqual(`<div id="Headline">value</div>`)
expect(propsSpy).toHaveBeenCalledWith({
id: "Headline",
isTranslated: false,
message: undefined,
translation: "Headline",
children: "Headline",
Expand All @@ -388,8 +386,6 @@ describe("Trans component", () => {
{props.translation && (
<div data-testid="translation">{props.translation}</div>
)}

<div data-testid="is-translated">{String(props.isTranslated)}</div>
</>
)

Expand All @@ -405,21 +401,6 @@ describe("Trans component", () => {
expect(markup.queryByTestId("translation")?.innerHTML).toEqual(
"Translation"
)
expect(markup.queryByTestId("is-translated")?.innerHTML).toEqual("true")
})

it("should pass isTranslated: false if no translation", () => {
const markup = render(
<I18nProvider i18n={i18n} defaultComponent={DefaultComponent}>
<Trans id="NO_ID" message="Some message" />
</I18nProvider>
)

expect(markup.queryByTestId("id")?.innerHTML).toEqual("NO_ID")
expect(markup.queryByTestId("translation")?.innerHTML).toEqual(
"Some message"
)
expect(markup.queryByTestId("is-translated")?.innerHTML).toEqual("false")
})

describe("TransNoContext", () => {
Expand Down
6 changes: 0 additions & 6 deletions packages/react/src/TransNoContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ export type TransRenderProps = {
translation: React.ReactNode
children: React.ReactNode
message?: string | null
/**
* @deprecated isTranslated prop is undocumented and buggy. It'll be removed in v5 release.
* */
isTranslated: boolean
}

export type TransRenderCallbackOrComponent =
Expand Down Expand Up @@ -110,8 +106,6 @@ export function TransNoContext(
id,
message,
translation,
// TODO vonovak - remove isTranslated prop in v5 release
isTranslated: id !== translation && message !== translation,
children: translation, // for type-compatibility with `component` prop
}

Expand Down

0 comments on commit 4c494ad

Please sign in to comment.