Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formatElements fails with multiple uses of same tag in same scope #593

Closed
dannysellers opened this issue Nov 20, 2019 · 2 comments
Closed

Comments

@dannysellers
Copy link
Contributor

Bug Description
When formatting a string with multiple usages of the same component in the same scope, formatElements only considers the outermost opening and closing tags

To Reproduce
Use a Trans tag like <Trans id="<0>Superscript</0> regular <0>super</0>" components=[{<sup />}] />, observe rendered HTML is <sup>Superscript&lt;/0&gt; regular &lt;0&gt;super</sup>

it("should format multiple usages of same element in the same scope", function() {
  expect(
    html(formatElements("<0>First</0> second <0>third</0> <0>fourth</0>", [<sup />]))
  ).toEqual(
   wrap("<sup>First</sup> second <sup>third</sup> <sup>fourth</sup>")
  )
})

Expected behavior
The formatter should correctly replace multiple instances of the same component

  • jsLingui version 2.8.3
  • Babel version 6.26.3
  • This issue affects a project created with simple-react-app, but also affects Lingui's master
@tricoder42
Copy link
Contributor

Fixed in #594

@tricoder42
Copy link
Contributor

It has just been released in 2.9.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants