Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it, vi } from "vitest";

import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
import { getDefaultSlashMenuItems } from "./getDefaultSlashMenuItems.js";
import { SuggestionMenu } from "./SuggestionMenu.js";

/**
Expand Down Expand Up @@ -140,6 +141,25 @@ describe("SuggestionMenu", () => {
editor._tiptapEditor.destroy();
});

it("should expose an emoji slash menu item that opens the emoji picker", () => {
const editor = createEditor();
const sm = editor.getExtension(SuggestionMenu)!;
const openSuggestionMenuSpy = vi.spyOn(sm, "openSuggestionMenu");

const items = getDefaultSlashMenuItems(editor);
const emojiItem = items.find((item) => item.key === "emoji");

expect(emojiItem).toBeDefined();
emojiItem!.onItemClick();

expect(openSuggestionMenuSpy).toHaveBeenCalledWith(":", {
deleteTriggerCharacter: true,
ignoreQueryLength: true,
});

editor._tiptapEditor.destroy();
});

it("should still allow suggestion menus without shouldTrigger in table content", () => {
const editor = createEditor();
const sm = editor.getExtension(SuggestionMenu)!;
Expand Down