fix(ai-toolbar): honor AI state in shortcuts and clipboard dedup
This commit is contained in:
@@ -488,6 +488,30 @@ describe("AI toolbar paste capture", () => {
|
||||
expect(onAiCreate).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test("Mod+Enter does not trigger AI generation while loading", async () => {
|
||||
const onAiCreate = mock();
|
||||
|
||||
const { textareaProps } = await renderToolbarBoundary({
|
||||
aiPrompt: "Draft a kickoff",
|
||||
aiLoading: true,
|
||||
onAiCreate,
|
||||
});
|
||||
const event = createTextareaKeydownEvent({ ctrlKey: true });
|
||||
|
||||
textareaProps.onKeyDown?.(event);
|
||||
|
||||
expect(event.preventDefault).not.toHaveBeenCalled();
|
||||
expect(onAiCreate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("AI unavailable state removes the composer so generate shortcuts are not exposed", async () => {
|
||||
const markup = await renderToolbarMarkup({ aiEnabled: false });
|
||||
|
||||
expect(markup).toContain("AI integrations are unavailable");
|
||||
expect(markup).not.toContain("Type or paste event details...");
|
||||
expect(markup).not.toContain("Generate event");
|
||||
});
|
||||
|
||||
test("Shift+Mod+A opens the image picker when the composer is idle", async () => {
|
||||
const { textareaProps, imageTriggerOpen } = await renderToolbarBoundary();
|
||||
const ctrlEvent = createTextareaKeydownEvent({
|
||||
|
||||
Reference in New Issue
Block a user