@swisper.ai/web-file-preview 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swisper.ai/web-file-preview",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "In-browser preview for PDF, Word, Excel, PowerPoint, CSV, image, audio and video files",
5
5
  "keywords": [
6
6
  "react",
@@ -63,7 +63,7 @@
63
63
  "@radix-ui/react-slot": "^1.1.0",
64
64
  "@swisper.ai/icons": "0.0.3",
65
65
  "@swisper.ai/tailwind-config": "0.0.3",
66
- "@swisper.ai/ui": "0.1.2",
66
+ "@swisper.ai/ui": "0.2.0",
67
67
  "@swisper.ai/web-core": "0.0.3",
68
68
  "@tanstack/react-virtual": "^3.14.5",
69
69
  "docx-preview": "^0.4.0",
@@ -427,9 +427,10 @@ export const DefaultLoadsAndReveals: Story = {
427
427
  });
428
428
 
429
429
  await step('Reports each step of the load once', async () => {
430
+ // `onLoaded` is reported from an effect, which can run after the status reaches the DOM.
431
+ await waitFor(() => expect(args.onLoaded).toHaveBeenCalledTimes(1));
430
432
  await expect(args.onLoadAvailable).toHaveBeenCalledTimes(1);
431
433
  await expect(args.onLoadStarted).toHaveBeenCalledTimes(1);
432
- await expect(args.onLoaded).toHaveBeenCalledTimes(1);
433
434
  await expect(args.onLoadFailed).not.toHaveBeenCalled();
434
435
  });
435
436
  },
@@ -517,7 +518,8 @@ export const BlobArrivesLaterDrawsOnArrival: DocumentThumbnailStory = {
517
518
  await step('Draws the file once the blob arrives, without asking again', async () => {
518
519
  await waitFor(() => expect(tile).toHaveAttribute('data-status', 'loaded'));
519
520
  await expect(tile).not.toHaveAttribute('aria-busy');
520
- await expect(args.onLoaded).toHaveBeenCalledTimes(1);
521
+ // `onLoaded` is reported from an effect, which can run after the status reaches the DOM.
522
+ await waitFor(() => expect(args.onLoaded).toHaveBeenCalledTimes(1));
521
523
  await expect(args.onFetchDocument).toHaveBeenCalledTimes(1);
522
524
  });
523
525
  },
@@ -544,7 +546,10 @@ export const ScrollingGalleryLoadsOnScroll: DocumentGalleryStory = {
544
546
  last.scrollIntoView();
545
547
  await waitFor(() => expect(last).toHaveAttribute('data-status', 'loaded'));
546
548
  await expect(args.onLoadAvailable).toHaveBeenCalledWith('site-inspection-page-24.png');
547
- await expect(args.onLoaded).toHaveBeenCalledWith('site-inspection-page-24.png');
549
+ // `onLoaded` is reported from an effect, which can run after the status reaches the DOM.
550
+ await waitFor(() =>
551
+ expect(args.onLoaded).toHaveBeenCalledWith('site-inspection-page-24.png'),
552
+ );
548
553
  });
549
554
  },
550
555
  };