From 407962cdb15c565fdd78a6a5439168b74981aed7 Mon Sep 17 00:00:00 2001 From: Jonas Date: Sun, 18 Oct 2026 15:41:32 +0200 Subject: [PATCH] test(comparison): destroy all editor views in decorations spec The tiptap Editor constructor already mounts a view on a detached element, and calling mount() again replaces that view without destroying it. Signed-off-by: Jonas Assisted-by: ClaudeCode:claude-opus-5-5 --- src/tests/comparison/decorations.spec.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tests/comparison/decorations.spec.ts b/src/tests/comparison/decorations.spec.ts index 6310a2687ea..e658b54201e 100644 --- a/src/tests/comparison/decorations.spec.ts +++ b/src/tests/comparison/decorations.spec.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -import { afterEach, beforeEach, describe, expect, it } from 'vitest' +import { afterAll, afterEach, beforeEach, describe, expect, it } from 'vitest' import { compareDocuments } from '../../comparison/compare.ts' import { createComparisonDecorationPlugin, createComparisonSpacerPlugin, setComparisonDecorations, setComparisonSpacers } from '../../comparison/decorations.ts' import { createComparisonEditor } from '../../comparison/editor.ts' @@ -15,8 +15,6 @@ const beforePlugin = createComparisonDecorationPlugin('before') const afterPlugin = createComparisonDecorationPlugin('after') beforeEach(() => { - before.mount(document.createElement('div')) - after.mount(document.createElement('div')) before.registerPlugin(beforePlugin.plugin) after.registerPlugin(afterPlugin.plugin) }) @@ -24,8 +22,11 @@ beforeEach(() => { afterEach(() => { before.unregisterPlugin(beforePlugin.key) after.unregisterPlugin(afterPlugin.key) - before.unmount() - after.unmount() +}) + +afterAll(() => { + before.destroy() + after.destroy() }) function marked(editor: typeof before) { @@ -61,7 +62,6 @@ describe('comparison spacers', () => { it('sets the top margin of a block instead of adding an element', () => { const editor = createComparisonEditor('First\n\n## Second') const spacers = createComparisonSpacerPlugin() - editor.mount(document.createElement('div')) editor.registerPlugin(spacers.plugin) const blocks = () => [...editor.view.dom.children] as HTMLElement[] const count = blocks().length