From d8bbb5dd6a98271b53e77ea7e36803dcf02c3de1 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Thu, 27 Mar 2025 11:07:17 -0700 Subject: [PATCH] Fix content tests --- packages/content/src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/content/src/index.ts b/packages/content/src/index.ts index 740515d..9980f89 100644 --- a/packages/content/src/index.ts +++ b/packages/content/src/index.ts @@ -421,13 +421,14 @@ export const truncate = ( // Otherwise, truncate more then necessary so that when the user expands the note // they have more than just a tiny bit to look at. Truncating a single word is annoying. sizes.every((size, i) => { + currentSize += size + if (currentSize > minLength) { - content = content.slice(0, i).concat({type: ParsedType.Ellipsis, value: "…", raw: ""}) + content = content.slice(0, Math.max(1, i)).concat({type: ParsedType.Ellipsis, value: "…", raw: ""}) return false } - currentSize += size return true })