fix(Truncate): fix text duplication in middle position#11417
Conversation
thatblindgeye
left a comment
There was a problem hiding this comment.
The portion that renders the content for truncated middle may also need to be updated as well. Right now what gets rendered (using the content from the issue) is the first and second character of the content string:
Since we're just returning the str param in the sliceContent helper instead of an array.
06a7b4c to
b562114
Compare
|
after some investigation, the real issue with the original logic is that a negative value could be passed to slice, which acts as an offset to the original content string and results in a positive length that the original logic does not assume correctly. it should work now as expected. |
thatblindgeye
left a comment
There was a problem hiding this comment.
Looks much better 👨🏼🍳 🤌 Would be worth adding another middle truncate test when the content length is less than the trailingNumChars prop (currently we only have 2 that are both cases where content is longer than the prop value).
642ce1c to
4ad7168
Compare
|
@thatblindgeye i added a bonus middle truncate test in which the length of the trailing chars exceeds the length of the original string |

What: Closes #10858
Additional issues: