Skip to content

Commit bd167da

Browse files
committed
Run linter/formatter
1 parent 32a2a98 commit bd167da

File tree

3 files changed

+21
-52
lines changed

3 files changed

+21
-52
lines changed

packages/streamdown/__tests__/show-controls.test.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,7 @@ graph TD
295295
const fullscreenBtn = tableWrapper?.querySelector(
296296
'button[title="View fullscreen"]'
297297
);
298-
const copyBtn = tableWrapper?.querySelector(
299-
'button[title="Copy table"]'
300-
);
298+
const copyBtn = tableWrapper?.querySelector('button[title="Copy table"]');
301299
const downloadBtn = tableWrapper?.querySelector(
302300
'button[title="Download table"]'
303301
);
@@ -322,9 +320,7 @@ graph TD
322320
const fullscreenBtn = tableWrapper?.querySelector(
323321
'button[title="View fullscreen"]'
324322
);
325-
const copyBtn = tableWrapper?.querySelector(
326-
'button[title="Copy table"]'
327-
);
323+
const copyBtn = tableWrapper?.querySelector('button[title="Copy table"]');
328324
const downloadBtn = tableWrapper?.querySelector(
329325
'button[title="Download table"]'
330326
);
@@ -336,9 +332,7 @@ graph TD
336332

337333
it("should show all table controls with empty object config", () => {
338334
const { container } = render(
339-
<Streamdown controls={{ table: {} }}>
340-
{markdownWithTable}
341-
</Streamdown>
335+
<Streamdown controls={{ table: {} }}>{markdownWithTable}</Streamdown>
342336
);
343337

344338
const tableWrapper = container.querySelector(
@@ -347,9 +341,7 @@ graph TD
347341
const fullscreenBtn = tableWrapper?.querySelector(
348342
'button[title="View fullscreen"]'
349343
);
350-
const copyBtn = tableWrapper?.querySelector(
351-
'button[title="Copy table"]'
352-
);
344+
const copyBtn = tableWrapper?.querySelector('button[title="Copy table"]');
353345
const downloadBtn = tableWrapper?.querySelector(
354346
'button[title="Download table"]'
355347
);

packages/streamdown/__tests__/table-fullscreen.test.tsx

Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { fireEvent, render } from "@testing-library/react";
22
import { describe, expect, it } from "vitest";
3-
import { Streamdown, StreamdownContext } from "../index";
3+
import { Streamdown } from "../index";
44

55
const markdownWithTable = `
66
| Name | Age |
@@ -11,9 +11,7 @@ const markdownWithTable = `
1111

1212
describe("TableFullscreenButton", () => {
1313
it("should render fullscreen button when controls are enabled", () => {
14-
const { container } = render(
15-
<Streamdown>{markdownWithTable}</Streamdown>
16-
);
14+
const { container } = render(<Streamdown>{markdownWithTable}</Streamdown>);
1715

1816
const btn = container.querySelector('button[title="View fullscreen"]');
1917
expect(btn).toBeTruthy();
@@ -40,9 +38,7 @@ describe("TableFullscreenButton", () => {
4038
});
4139

4240
it("should open fullscreen overlay on click", () => {
43-
const { container } = render(
44-
<Streamdown>{markdownWithTable}</Streamdown>
45-
);
41+
const { container } = render(<Streamdown>{markdownWithTable}</Streamdown>);
4642

4743
const btn = container.querySelector(
4844
'button[title="View fullscreen"]'
@@ -58,9 +54,7 @@ describe("TableFullscreenButton", () => {
5854
});
5955

6056
it("should close fullscreen overlay on close button click", () => {
61-
const { container } = render(
62-
<Streamdown>{markdownWithTable}</Streamdown>
63-
);
57+
const { container } = render(<Streamdown>{markdownWithTable}</Streamdown>);
6458

6559
const btn = container.querySelector(
6660
'button[title="View fullscreen"]'
@@ -81,9 +75,7 @@ describe("TableFullscreenButton", () => {
8175
});
8276

8377
it("should close fullscreen overlay on Escape key", () => {
84-
const { container } = render(
85-
<Streamdown>{markdownWithTable}</Streamdown>
86-
);
78+
const { container } = render(<Streamdown>{markdownWithTable}</Streamdown>);
8779

8880
const btn = container.querySelector(
8981
'button[title="View fullscreen"]'
@@ -102,9 +94,7 @@ describe("TableFullscreenButton", () => {
10294
});
10395

10496
it("should lock body scroll when fullscreen is open", () => {
105-
const { container } = render(
106-
<Streamdown>{markdownWithTable}</Streamdown>
107-
);
97+
const { container } = render(<Streamdown>{markdownWithTable}</Streamdown>);
10898

10999
const btn = container.querySelector(
110100
'button[title="View fullscreen"]'
@@ -134,9 +124,7 @@ describe("TableFullscreenButton", () => {
134124
});
135125

136126
it("should render table content inside fullscreen overlay", () => {
137-
const { container } = render(
138-
<Streamdown>{markdownWithTable}</Streamdown>
139-
);
127+
const { container } = render(<Streamdown>{markdownWithTable}</Streamdown>);
140128

141129
const btn = container.querySelector(
142130
'button[title="View fullscreen"]'
@@ -151,9 +139,7 @@ describe("TableFullscreenButton", () => {
151139
});
152140

153141
it("should show copy and download controls in fullscreen", () => {
154-
const { container } = render(
155-
<Streamdown>{markdownWithTable}</Streamdown>
156-
);
142+
const { container } = render(<Streamdown>{markdownWithTable}</Streamdown>);
157143

158144
const btn = container.querySelector(
159145
'button[title="View fullscreen"]'
@@ -172,9 +158,7 @@ describe("TableFullscreenButton", () => {
172158
});
173159

174160
it("should not close fullscreen when clicking controls inside overlay", () => {
175-
const { container } = render(
176-
<Streamdown>{markdownWithTable}</Streamdown>
177-
);
161+
const { container } = render(<Streamdown>{markdownWithTable}</Streamdown>);
178162

179163
const btn = container.querySelector(
180164
'button[title="View fullscreen"]'
@@ -198,9 +182,7 @@ describe("TableFullscreenButton", () => {
198182
});
199183

200184
it("should not close fullscreen when clicking table content", () => {
201-
const { container } = render(
202-
<Streamdown>{markdownWithTable}</Streamdown>
203-
);
185+
const { container } = render(<Streamdown>{markdownWithTable}</Streamdown>);
204186

205187
const btn = container.querySelector(
206188
'button[title="View fullscreen"]'
@@ -222,9 +204,7 @@ describe("TableFullscreenButton", () => {
222204
});
223205

224206
it("should close fullscreen overlay on backdrop click", () => {
225-
const { container } = render(
226-
<Streamdown>{markdownWithTable}</Streamdown>
227-
);
207+
const { container } = render(<Streamdown>{markdownWithTable}</Streamdown>);
228208

229209
const btn = container.querySelector(
230210
'button[title="View fullscreen"]'
@@ -236,17 +216,17 @@ describe("TableFullscreenButton", () => {
236216
);
237217
expect(overlay).toBeTruthy();
238218

239-
fireEvent.click(overlay!);
219+
if (overlay) {
220+
fireEvent.click(overlay);
221+
}
240222

241223
expect(
242224
document.querySelector('[data-streamdown="table-fullscreen"]')
243225
).toBeFalsy();
244226
});
245227

246228
it("should have aria attributes on fullscreen overlay", () => {
247-
const { container } = render(
248-
<Streamdown>{markdownWithTable}</Streamdown>
249-
);
229+
const { container } = render(<Streamdown>{markdownWithTable}</Streamdown>);
250230

251231
const btn = container.querySelector(
252232
'button[title="View fullscreen"]'

packages/streamdown/lib/table/fullscreen-button.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,11 @@ export const TableFullscreenButton = ({
7070

7171
{isFullscreen
7272
? createPortal(
73-
// biome-ignore lint/a11y/useSemanticElements: "div is used as a fullscreen overlay"
73+
// biome-ignore lint/a11y/noNoninteractiveElementInteractions: "dialog overlay needs click-to-dismiss"
7474
<div
7575
aria-label={t.viewFullscreen}
7676
aria-modal="true"
77-
className={cn(
78-
"fixed inset-0 z-50 flex flex-col bg-background"
79-
)}
77+
className={cn("fixed inset-0 z-50 flex flex-col bg-background")}
8078
data-streamdown="table-fullscreen"
8179
onClick={handleClose}
8280
onKeyDown={(e) => {
@@ -85,7 +83,6 @@ export const TableFullscreenButton = ({
8583
}
8684
}}
8785
role="dialog"
88-
tabIndex={0}
8986
>
9087
{/* biome-ignore lint/a11y/noStaticElementInteractions: "div with role=presentation is used for event propagation control" */}
9188
<div

0 commit comments

Comments
 (0)