Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

839 B
Raw Blame
import { fireEvent, render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import { FocusModeExitButton } from "@/components/MemoEditor/edit/components/FocusModeOverlay";

vi.mock("@/utils/i18n", () => ({ useTranslate: () => (key: string) => key }));

describe("FocusModeExitButton", () => {
  it("minimizes inline focus mode", () => {
    const onExit = vi.fn();
    render(<FocusModeExitButton action="minimize" onExit={onExit} />);
    fireEvent.click(screen.getByRole("button", { name: "editor.exit-focus-mode" }));
    expect(onExit).toHaveBeenCalledTimes(1);
  });

  it("reads as Close when a host owns the frame", () => {
    render(<FocusModeExitButton action="close" onExit={vi.fn()} />);
    expect(screen.getByRole("button", { name: "common.close" })).toBeInTheDocument();
  });
});