mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-03 04:31:46 +02:00
Merge pull request #10313 from streetwriters/editor/fix-failing-editor-tests
editor: fix three failing editor tests
This commit is contained in:
@@ -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" })])
|
||||
);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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" })])
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user