diff --git a/package.json b/package.json index 640d65bd..971085ff 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "start": "microbundle-crl watch --no-compress --format modern,cjs --jsxFragment React.Fragment", "storybook": "storybook dev -p 6006", "storybook:build": "storybook build", - "storybook:serve:start": "pm2 start ./serve-storybook.js --name storybook", + "storybook:serve:start": "pm2 delete storybook -s 2> /dev/null || true && pm2 start ./serve-storybook.js --name storybook", "storybook:serve:stop": "pm2 delete storybook", "test": "run-s test:unit test:lint test:playwright", "test:playwright": "npm run storybook:build && npm run storybook:serve:start && npx playwright test && npm run storybook:serve:stop", diff --git a/playwright.config.ts b/playwright.config.ts index f7b48c20..f4f4148d 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -30,7 +30,7 @@ export default defineConfig({ use: { ...devices["Desktop Safari"] } } ], - reporter: "html", + reporter: [["html", { open: "never" }]], /* Retry on CI only */ retries: process.env.CI ? 2 : 0, testDir: "./src", diff --git a/src/NoWrapTypography/NoWrapTypography.stories.tsx b/src/NoWrapTypography/NoWrapTypography.stories.tsx index ee6427fe..e0bd4555 100644 --- a/src/NoWrapTypography/NoWrapTypography.stories.tsx +++ b/src/NoWrapTypography/NoWrapTypography.stories.tsx @@ -29,10 +29,14 @@ const Template: StoryFn = props => { ); }; -export const Default = { +export const Default: { + args: NoWrapTypographyProps; + render: StoryFn; +} = { args: { children: "text that is too long to fit in the box", - sx: { fontSize: "18px", maxWidth: "250px" } + sx: { maxWidth: "250px" }, + variant: "body1" }, render: Template diff --git a/src/NoWrapTypography/NoWrapTypography.test.tsx b/src/NoWrapTypography/NoWrapTypography.test.tsx new file mode 100644 index 00000000..777132e3 --- /dev/null +++ b/src/NoWrapTypography/NoWrapTypography.test.tsx @@ -0,0 +1,14 @@ +import { describe, test } from "vitest"; +import { render, screen } from "@testing-library/react"; + +import NoWrapTypography from "./NoWrapTypography"; +import React from "react"; + +describe("NoWrapTypography", () => { + test("can pass 'sx' prop", () => { + render( + Some text + ); + expect(screen.getByText("Some text")).toHaveStyle("color: rgb(255, 0, 0)"); + }); +}); diff --git a/src/NoWrapTypography/NoWrapTypography.tsx b/src/NoWrapTypography/NoWrapTypography.tsx index 98cd6dbd..64902051 100644 --- a/src/NoWrapTypography/NoWrapTypography.tsx +++ b/src/NoWrapTypography/NoWrapTypography.tsx @@ -33,14 +33,17 @@ export default function NoWrapTypography({ {children}