Merge pull request #10313 from streetwriters/editor/fix-failing-editor-tests

editor: fix three failing editor tests
This commit is contained in:
Ammar Ahmed
2026-09-02 08:51:06 +05:00
committed by GitHub
3 changed files with 10 additions and 10 deletions

View File

@@ -21,7 +21,6 @@ import { describe, expect, test } from "vitest";
import {
createEditor,
h,
p,
checkList,
checkListItem
} from "../../../../test-utils/index.js";
@@ -36,7 +35,7 @@ describe("check list item", () => {
*/
test("inline image as first child in check list item", async () => {
const el = checkList(
checkListItem([p(["item 1"])]),
checkListItem(["item 1"]),
checkListItem([h("img", [], { src: "image.png" })])
);

View File

@@ -55,17 +55,19 @@ test("copy image to clipboard when Ctrl+C is pressed on selected image", async (
const editorElement = h("div");
const { editor } = createEditor({
element: editorElement,
// the image is put there as content rather than with `insertImage`, which
// needs the attachment extension: what is under test is the copying
initialContent: h("img", [], {
src: "test.png",
"data-hash": testHash,
"data-mime": "image/png",
"data-filename": "test.png"
}).outerHTML,
extensions: {
image: ImageNode
}
});
editor.storage.getAttachmentData = vi.fn().mockResolvedValue(mockImageData);
editor.commands.insertImage({
src: "test.png",
hash: testHash,
mime: "image/png",
filename: "test.png"
});
editor.commands.setNodeSelection(0);
expect(editor.isActive("image")).toBe(true);

View File

@@ -21,7 +21,6 @@ import { describe, expect, test } from "vitest";
import {
createEditor,
h,
p,
taskList,
taskItem
} from "../../../../test-utils/index.js";
@@ -36,7 +35,7 @@ describe("task list item", () => {
*/
test("inline image as first child in task list item", async () => {
const el = taskList(
taskItem([p(["item 1"])]),
taskItem(["item 1"]),
taskItem([h("img", [], { src: "image.png" })])
);