More tests

This commit is contained in:
Ticruz
2025-02-04 13:21:23 +01:00
committed by Jon Staab
parent 191cdbc098
commit 8c638a7d8f
28 changed files with 3781 additions and 40 deletions
+5 -3
View File
@@ -421,14 +421,16 @@ 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)) // do not truncate the first element in profit of an ellipsis
.concat({type: ParsedType.Ellipsis, value: "…", raw: ""})
return false
}
currentSize += size
return true
})