@argos-ci/storybook 5.0.4 → 5.0.5
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/dist/vitest-plugin.js +26 -17
- package/package.json +2 -2
package/dist/vitest-plugin.js
CHANGED
|
@@ -252,25 +252,34 @@ var createArgosScreenshotCommand = (pluginOptions) => {
|
|
|
252
252
|
...testContext,
|
|
253
253
|
playwrightLibraries: ["@storybook/addon-vitest"],
|
|
254
254
|
setViewportSize: async (size) => {
|
|
255
|
-
await ctx.page.evaluate(
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
iframe.style.width = iframe.dataset.defaultWidth;
|
|
263
|
-
iframe.style.height = iframe.dataset.defaultHeight;
|
|
255
|
+
await ctx.page.evaluate(
|
|
256
|
+
({ size: size2, fullPage }) => {
|
|
257
|
+
const iframe = document.querySelector(
|
|
258
|
+
'iframe[data-vitest="true"]'
|
|
259
|
+
);
|
|
260
|
+
if (!(iframe instanceof HTMLIFrameElement)) {
|
|
261
|
+
throw new Error("Vitest iframe not found");
|
|
264
262
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
iframe.dataset.defaultWidth = iframe.style.width;
|
|
268
|
-
iframe.dataset.defaultHeight = iframe.style.height;
|
|
263
|
+
if (!iframe.contentDocument) {
|
|
264
|
+
throw new Error("Vitest iframe contentDocument not found");
|
|
269
265
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
266
|
+
if (size2 === "default") {
|
|
267
|
+
if (iframe.dataset.defaultWidth && iframe.dataset.defaultHeight) {
|
|
268
|
+
iframe.style.width = iframe.dataset.defaultWidth;
|
|
269
|
+
iframe.style.height = iframe.dataset.defaultHeight;
|
|
270
|
+
}
|
|
271
|
+
} else {
|
|
272
|
+
if (!iframe.dataset.defaultWidth && !iframe.dataset.defaultHeight) {
|
|
273
|
+
iframe.dataset.defaultWidth = iframe.style.width;
|
|
274
|
+
iframe.dataset.defaultHeight = iframe.style.height;
|
|
275
|
+
}
|
|
276
|
+
iframe.style.height = "auto";
|
|
277
|
+
iframe.style.width = `${size2.width}px`;
|
|
278
|
+
iframe.style.height = fullPage ? `${iframe.contentDocument.body.offsetHeight}px` : `${size2.height}px`;
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
{ size, fullPage: screenshotOptions.fullPage ?? !fitToContent }
|
|
282
|
+
);
|
|
274
283
|
}
|
|
275
284
|
},
|
|
276
285
|
applyFitToContent(screenshotOptions, fitToContent)
|
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": "5.0.
|
|
4
|
+
"version": "5.0.5",
|
|
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": "
|
|
101
|
+
"gitHead": "9437efd6cefa301411b44bc7955ae8df1a14e9f7"
|
|
102
102
|
}
|