Files
memos/web/tests/toolbar-compact-width.test.ts
johnnyjoygh deddf71d7b feat(editor): add focus-mode formatting toolbar
Add a rich-text formatting toolbar as the focus-mode header when the
WYSIWYG editor is active: heading dropdown, bold/italic/code, lists, and
link, with a priority+overflow responsive layout and live active-state
highlighting. The toolbar is a self-contained component driven through a
new FormattingController surface routed via EditorContent.

Remove the now-redundant slash-command feature (/todo, /code, /link,
/table) and its "Type / for commands" hint, since the toolbar covers
those actions; the shared suggestion renderer stays for #tag.
2026-06-21 11:57:45 +08:00

18 lines
639 B
TypeScript

import { describe, expect, it } from "vitest";
import { COMPACT_TOOLBAR_WIDTH, isCompactWidth } from "@/components/MemoEditor/hooks/useElementWidth";
describe("isCompactWidth", () => {
it("treats an unmeasured (0) width as not compact (full layout default)", () => {
expect(isCompactWidth(0)).toBe(false);
});
it("is compact below the threshold", () => {
expect(isCompactWidth(COMPACT_TOOLBAR_WIDTH - 1)).toBe(true);
});
it("is not compact at or above the threshold", () => {
expect(isCompactWidth(COMPACT_TOOLBAR_WIDTH)).toBe(false);
expect(isCompactWidth(COMPACT_TOOLBAR_WIDTH + 200)).toBe(false);
});
});