Skip to content

Commit cf94df7

Browse files
committed
Fix tests
1 parent 6e91867 commit cf94df7

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

packages/streamdown/__tests__/image.test.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ describe("ImageComponent", () => {
7878
/>
7979
);
8080

81+
const img = container.querySelector('img[data-streamdown="image"]');
82+
if (img) fireEvent.load(img);
83+
8184
const button = container.querySelector('button[title="Download image"]');
8285
expect(button).toBeTruthy();
8386
});
@@ -112,6 +115,9 @@ describe("ImageComponent", () => {
112115
/>
113116
);
114117

118+
const img = container.querySelector('img[data-streamdown="image"]');
119+
if (img) fireEvent.load(img);
120+
115121
const button = container.querySelector('button[title="Download image"]');
116122
expect(button).toBeTruthy();
117123
if (button) {
@@ -139,6 +145,9 @@ describe("ImageComponent", () => {
139145
/>
140146
);
141147

148+
const img = container.querySelector('img[data-streamdown="image"]');
149+
if (img) fireEvent.load(img);
150+
142151
const button = container.querySelector('button[title="Download image"]');
143152
expect(button).toBeTruthy();
144153
if (button) {
@@ -168,6 +177,9 @@ describe("ImageComponent", () => {
168177
/>
169178
);
170179

180+
const img = container.querySelector('img[data-streamdown="image"]');
181+
if (img) fireEvent.load(img);
182+
171183
const button = container.querySelector('button[title="Download image"]');
172184
expect(button).toBeTruthy();
173185
if (button) {
@@ -207,6 +219,9 @@ describe("ImageComponent", () => {
207219
/>
208220
);
209221

222+
const img = container.querySelector('img[data-streamdown="image"]');
223+
if (img) fireEvent.load(img);
224+
210225
const button = container.querySelector('button[title="Download image"]');
211226
expect(button).toBeTruthy();
212227
if (button) {
@@ -238,6 +253,9 @@ describe("ImageComponent", () => {
238253
/>
239254
);
240255

256+
const img = container.querySelector('img[data-streamdown="image"]');
257+
if (img) fireEvent.load(img);
258+
241259
const button = container.querySelector('button[title="Download image"]');
242260
expect(button).toBeTruthy();
243261
if (button) {
@@ -265,6 +283,9 @@ describe("ImageComponent", () => {
265283
<ImageComponent node={null as any} src="https://example.com/" />
266284
);
267285

286+
const img = container.querySelector('img[data-streamdown="image"]');
287+
if (img) fireEvent.load(img);
288+
268289
const button = container.querySelector('button[title="Download image"]');
269290
expect(button).toBeTruthy();
270291
if (button) {
@@ -290,6 +311,9 @@ describe("ImageComponent", () => {
290311
/>
291312
);
292313

314+
const img = container.querySelector('img[data-streamdown="image"]');
315+
if (img) fireEvent.load(img);
316+
293317
const button = container.querySelector('button[title="Download image"]');
294318
expect(button).toBeTruthy();
295319
if (button) {
@@ -340,6 +364,9 @@ describe("ImageComponent", () => {
340364
/>
341365
);
342366

367+
const img = container.querySelector('img[data-streamdown="image"]');
368+
if (img) fireEvent.load(img);
369+
343370
const button = container.querySelector('button[title="Download image"]');
344371
expect(button).toBeTruthy();
345372
if (button) {

0 commit comments

Comments
 (0)