Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

composerFooterLayout.test.ts

35 lines1.2 KB

1import { describe, expect, it } from "vitest";
2​
3import {
4 COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX,
5 COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX,
6 shouldUseCompactComposerFooter,
7} from "./composerFooterLayout";
8​
9describe("shouldUseCompactComposerFooter", () => {
10 it("stays expanded without a measured width", () => {
11 expect(shouldUseCompactComposerFooter(null)).toBe(false);
12 });
13​
14 it("switches to compact mode below the breakpoint", () => {
15 expect(shouldUseCompactComposerFooter(COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX - 1)).toBe(true);
16 });
17​
18 it("stays expanded at and above the breakpoint", () => {
19 expect(shouldUseCompactComposerFooter(COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX)).toBe(false);
20 expect(shouldUseCompactComposerFooter(COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX + 48)).toBe(false);
21 });
22​
23 it("uses a higher breakpoint for wide action states", () => {
24 expect(
25 shouldUseCompactComposerFooter(COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX - 1, {
26 hasWideActions: true,
27 }),
28 ).toBe(true);
29 expect(
30 shouldUseCompactComposerFooter(COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX, {
31 hasWideActions: true,
32 }),
33 ).toBe(false);
34 });
35});