From 40c0afb09d0444ffd819cd905ba77236549b7caf Mon Sep 17 00:00:00 2001 From: patak Date: Wed, 18 Jan 2023 08:01:50 +0100 Subject: [PATCH] chore: fix typo --- composables/content-parse.ts | 12 ++++++------ tests/content-rich.test.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/composables/content-parse.ts b/composables/content-parse.ts index ed008cbc..4e7c0401 100644 --- a/composables/content-parse.ts +++ b/composables/content-parse.ts @@ -453,16 +453,16 @@ function transformCollapseMentions() { return (node: Node, root: Node): Node | Node[] => { if (processed || node.parent !== root || !node.children) return node - const metions: (Node | undefined)[] = [] + const mentions: (Node | undefined)[] = [] const children = node.children as Node[] for (const child of children) { // metion if (isMention(child)) { - metions.push(child) + mentions.push(child) } // spaces in between else if (child.type === TEXT_NODE && !child.value.trim()) { - metions.push(child) + mentions.push(child) } // other content, stop collapsing else { @@ -470,17 +470,17 @@ function transformCollapseMentions() { child.value = child.value.trimStart() // remove
after mention if (child.name === 'br') - metions.push(undefined) + mentions.push(undefined) break } } processed = true - if (metions.length === 0) + if (mentions.length === 0) return node return { ...node, - children: [h('mention-group', null, ...metions.filter(Boolean)), ...children.slice(metions.length)], + children: [h('mention-group', null, ...mentions.filter(Boolean)), ...children.slice(mentions.length)], } } } diff --git a/tests/content-rich.test.ts b/tests/content-rich.test.ts index 67228ba7..56146c7c 100644 --- a/tests/content-rich.test.ts +++ b/tests/content-rich.test.ts @@ -84,7 +84,7 @@ describe('content-rich', () => { expect(formatted).toMatchSnapshot() }) - it('collapse metions', async () => { + it('collapse mentions', async () => { const { formatted } = await render('

@elk @elk content @antfu @daniel @sxzz @patak content

', { collapseMentionLink: true, })