import { Editor } from "@tiptap/react"; import { StarterKit } from "@tiptap/starter-kit"; import { describe, expect, it } from "vitest"; import { NotebookTextDirection, setTextDirection } from "./text-direction"; describe("notebook text direction", () => { it("persists right-to-left direction in the notebook HTML", () => { const editor = new Editor({ content: "

יש לי 16GB

", extensions: [StarterKit, NotebookTextDirection], }); setTextDirection(editor, "rtl").run(); expect(editor.getHTML()).toBe('

יש לי 16GB

'); editor.destroy(); }); it("reads and changes an existing direction attribute", () => { const editor = new Editor({ content: '

Heading

', extensions: [StarterKit, NotebookTextDirection], }); expect(editor.getHTML()).toBe('

Heading

'); editor.commands.setTextSelection(1); setTextDirection(editor, "ltr").run(); expect(editor.getHTML()).toContain('

Heading

'); editor.destroy(); }); });