Sha256: 1df4783c15544a5c50b1e5227af4a1e2f176355205d1ba1b75c1cc32b28169f2
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
import { Editor } from "@tiptap/core"; import { createEditorContainer, updateContent } from "../helpers"; describe("createEditor", () => { const ctx = { editorContainer: null }; beforeEach(() => { document.body.innerHTML = ""; }); afterEach(() => (ctx.editorContainer = null)); it("creates the editor toolbar", () => { const toolbar = createEditorContainer().querySelector(".editor-toolbar"); expect(toolbar).toBeInstanceOf(HTMLElement); }); it("creates the contenteditable element inside the editor input", () => { const editorInput = createEditorContainer().querySelector(".editor-input"); expect(editorInput.querySelector(".ProseMirror[contenteditable='true']")).toBeInstanceOf(HTMLElement); }); it("exposes the editor through the contenteditable element", () => { const prosemirror = createEditorContainer().querySelector(".editor-input .ProseMirror"); expect(prosemirror.editor).toBeInstanceOf(Editor); }); it("updates the input content when the content in the editor changes", async () => { const prosemirror = createEditorContainer().querySelector(".editor-input .ProseMirror"); const input = document.querySelector(".editor > input"); await updateContent(prosemirror, "Hello, world!") expect(input.value).toEqual("<p>Hello, world!</p>") }); });
Version data entries
3 entries across 3 versions & 1 rubygems