Skip to content

Commit

Permalink
fix most react-web storybook tests
Browse files Browse the repository at this point in the history
Change-Id: I5c3db102b883ab9718df3016506629c0ab3b5099
GitOrigin-RevId: 816f574410aa3f4a2fe91ee319b2466edf2516ec
  • Loading branch information
jaslong authored and actions-user committed Feb 14, 2025
1 parent 6ac18cf commit b52ae89
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 289 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
module.exports = {
import type { StorybookConfig } from "@storybook/react-webpack5";

const config: StorybookConfig = {
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
"@storybook/addon-webpack5-compiler-swc",
],
framework: {
name: "@storybook/react-webpack5",
options: {},
},
features: {
interactionsDebugger: true,
},
};

export default config;
File renamed without changes.
9 changes: 9 additions & 0 deletions packages/react-web/.storybook/test-runner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { TestRunnerConfig } from "@storybook/test-runner";

const config: TestRunnerConfig = {
tags: {
skip: ["skip-test"],
},
};

export default config;
19 changes: 13 additions & 6 deletions packages/react-web/src/stories/PlasmicImg.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import { ComponentMeta, ComponentStory } from "@storybook/react";
import { Meta, StoryFn } from "@storybook/react";
import React from "react";
import { PlasmicImg } from "../render/PlasmicImg";
import "../styles/plasmic.css";

const Template: ComponentStory<typeof PlasmicImg> = (args: any) => {
const { containerWidth, containerHeight, ...rest } = args;
type PlasmicImgTemplateProps = React.ComponentProps<typeof PlasmicImg> & {
containerWidth?: number;
containerHeight?: number;
};

const Template: StoryFn<PlasmicImgTemplateProps> = ({
containerWidth,
containerHeight,
...rest
}) => {
return (
<div style={{ width: containerWidth, height: containerHeight }}>
<PlasmicImg {...rest} />
Expand Down Expand Up @@ -38,11 +46,10 @@ export default {
},
args: {
src: {
src:
"https://img.plasmic.app/img-optimizer/v1/img/07a7153536a89fef14e0075c7632d6b3.jpg",
src: "https://img.plasmic.app/img-optimizer/v1/img/07a7153536a89fef14e0075c7632d6b3.jpg",
fullWidth: 3840,
fullHeight: 2160,
},
loader: "plasmic",
},
} as ComponentMeta<typeof PlasmicImg>;
} satisfies Meta<PlasmicImgTemplateProps>;
Loading

0 comments on commit b52ae89

Please sign in to comment.