Skip to content

Commit 2ffcfed

Browse files
committed
test(sheet): add full size variant test and document in changeset/JSDoc
1 parent 843b4e4 commit 2ffcfed

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

.changeset/improve-sheet-customizability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Improve Sheet component customizability:
66

7-
- Add `size` prop to `Sheet.Content` for width variations (`sm`, `md`, `lg`, `xl`)
7+
- Add `size` prop to `Sheet.Content` for width variations (`sm`, `md`, `lg`, `xl`, `full`)
88
- Add `action` prop to `Sheet.Header` for placing action buttons to the right of the title
99
- Increase `Sheet.Title` font size to `text-lg` for better visibility
1010
- Move close button to the left side of the header, with title inline next to it

packages/core/src/components/sheet.test.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,29 @@ describe("Sheet", () => {
343343
expect(content.className).toContain("max-w-[60rem]");
344344
});
345345
});
346+
347+
it("applies full width when size is full", async () => {
348+
const user = userEvent.setup();
349+
350+
render(
351+
<Sheet.Root>
352+
<Sheet.Trigger data-testid="trigger">Open</Sheet.Trigger>
353+
<Sheet.Content data-testid="content" size="full">
354+
<Sheet.Header>
355+
<Sheet.Title>Sheet Title</Sheet.Title>
356+
</Sheet.Header>
357+
</Sheet.Content>
358+
</Sheet.Root>,
359+
);
360+
361+
await user.click(screen.getByTestId("trigger"));
362+
363+
await waitFor(() => {
364+
const content = screen.getByTestId("content");
365+
expect(content.className).toContain("w-full");
366+
expect(content.className).toContain("max-w-full");
367+
});
368+
});
346369
});
347370

348371
describe("action prop on Header", () => {

packages/core/src/components/sheet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function Overlay({ className, ...props }: React.ComponentProps<typeof Drawer.Bac
9898
Overlay.displayName = "Sheet.Overlay";
9999

100100
type SheetContentProps = React.ComponentProps<typeof Drawer.Popup> & {
101-
/** Controls the max-width of the sheet panel (applies to left/right sides). @default "sm" */
101+
/** Controls the max-width of the sheet panel (`sm` | `md` | `lg` | `xl` | `full`). Applies to left/right sides. @default "sm" */
102102
size?: Size;
103103
};
104104

0 commit comments

Comments
 (0)