mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-08-23 14:52:18 +10:00
fix(web): restore Tiptap Enter and list editing
This commit is contained in:
@@ -1,6 +1,33 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { Editor } from "@tiptap/react";
|
||||
import StarterKit from "@tiptap/starter-kit";
|
||||
import { resolveHighlightToolbarState } from "./rich-input.utils";
|
||||
|
||||
describe("Tiptap editing", () => {
|
||||
it("creates a new paragraph when Enter is pressed", () => {
|
||||
const editor = new Editor({ extensions: [StarterKit], content: "<p>First</p>" });
|
||||
|
||||
editor.commands.setTextSelection(editor.state.doc.content.size - 1);
|
||||
editor.commands.enter();
|
||||
|
||||
expect(editor.getHTML()).toBe("<p>First</p><p></p>");
|
||||
editor.destroy();
|
||||
});
|
||||
|
||||
it("creates and splits list items", () => {
|
||||
const editor = new Editor({ extensions: [StarterKit], content: "<p>First</p>" });
|
||||
|
||||
editor.commands.setTextSelection(editor.state.doc.content.size - 1);
|
||||
editor.commands.toggleBulletList();
|
||||
editor.commands.enter();
|
||||
|
||||
expect(editor.getHTML()).toBe("<ul><li><p>First</p></li><li><p></p></li></ul><p></p>");
|
||||
editor.destroy();
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveHighlightToolbarState", () => {
|
||||
it("shows legacy colorless highlights as default yellow and clearable", () => {
|
||||
expect(resolveHighlightToolbarState(true, null)).toEqual({
|
||||
|
||||
Reference in New Issue
Block a user