@argos-ci/storybook 6.0.17 → 6.0.18

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.
@@ -276,13 +276,17 @@ const createArgosScreenshotCommand = (pluginOptions) => {
276
276
  ...options,
277
277
  beforeScreenshot: async (api) => {
278
278
  await userBeforeScreenshot?.(api);
279
- await ctx.page.evaluate(() => {
279
+ await ctx.page.evaluate(({ fitWidth }) => {
280
280
  const iframe = document.querySelector("iframe[data-vitest=\"true\"]");
281
281
  if (!(iframe instanceof HTMLIFrameElement) || !iframe.contentDocument) return;
282
282
  const { body, documentElement } = iframe.contentDocument;
283
283
  const contentHeight = Math.max(body.scrollHeight, body.offsetHeight, documentElement.scrollHeight);
284
284
  if (contentHeight > iframe.clientHeight) iframe.style.height = `${contentHeight}px`;
285
- });
285
+ if (fitWidth) {
286
+ const contentWidth = Math.max(body.scrollWidth, body.offsetWidth, documentElement.scrollWidth);
287
+ if (contentWidth > iframe.clientWidth) iframe.style.width = `${contentWidth}px`;
288
+ }
289
+ }, { fitWidth: Boolean(fitToContent) });
286
290
  }
287
291
  };
288
292
  const attachments = await storybookArgosScreenshot(frame, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@argos-ci/storybook",
3
3
  "description": "Visual testing for Storybook test runner.",
4
- "version": "6.0.17",
4
+ "version": "6.0.18",
5
5
  "author": "Smooth Code",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -98,5 +98,5 @@
98
98
  "check-format": "prettier --check --ignore-unknown --ignore-path=./.gitignore --ignore-path=../../.gitignore --ignore-path=../../.prettierignore .",
99
99
  "lint": "eslint ."
100
100
  },
101
- "gitHead": "3502fe8f348376405f56703b351037150d2c9136"
101
+ "gitHead": "caaf0f8f6389199e4b94ea43cd014ff72becec94"
102
102
  }