Sha256: 318b182aa3d89d67aaf62692e09b9a52b7b4eac58d1d8110d26a164f9f11a792
Contents?: true
Size: 1.33 KB
Versions: 10
Compression:
Stored size: 1.33 KB
Contents
import { Editor } from "@tiptap/core"; import { createEditorContainer, updateContent } from "src/decidim/editor/test/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
10 entries across 10 versions & 1 rubygems