Skip to content

Commit

Permalink
Fixing toInitials bug that truncates custom initials (#6346)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardtorres314 authored Nov 7, 2022
1 parent 83d7a6d commit c0255a5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/avatar/__snapshots__/avatar.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ exports[`EuiAvatar props initials is rendered 1`] = `
<span
aria-hidden="true"
>
l
lo
</span>
</div>
`;
Expand Down
2 changes: 1 addition & 1 deletion src/services/string/to_initials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function toInitials(
): string | null {
// Calculate the number of initials to show, maxing out at MAX_INITIALS
let calculatedInitialsLength: number = initials
? initials.split(' ').length
? initials.split('').length
: name.split(' ').length;

calculatedInitialsLength =
Expand Down
3 changes: 3 additions & 0 deletions upcoming_changelogs/6346.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Bug fixes**

- Fixed bug in `to_initials` that truncates custom initials

0 comments on commit c0255a5

Please sign in to comment.