diff --git a/site/src/pages/TemplateBuilder/SelectionSummary.stories.tsx b/site/src/pages/TemplateBuilder/SelectionSummary.stories.tsx index c7df9cc2ad..7c83ef57df 100644 --- a/site/src/pages/TemplateBuilder/SelectionSummary.stories.tsx +++ b/site/src/pages/TemplateBuilder/SelectionSummary.stories.tsx @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from "@storybook/react-vite"; -import { fn } from "storybook/test"; +import { expect, fn, within } from "storybook/test"; import { SelectionSummary } from "./SelectionSummary"; const meta: Meta = { @@ -97,6 +97,32 @@ export const WithModules: Story = { }, }; +export const WithLongNameModule: Story = { + args: { + currentStep: 2, + selectedTemplate: { + name: "Docker Containers", + iconUrl: "/icon/docker.svg", + }, + selectedModules: [ + { + id: "git-commit-signing", + name: "A module with a name long enough to cause the text inside the ModuleSelection component to wrap to the next line, showing that the icon on the left remains top-aligned with the first line of the module name", + iconUrl: "/icon/git.svg", + }, + ], + }, + play: async ({ canvasElement }) => { + const canvas = within(canvasElement); + + const deselectModuleButton = await canvas.findByRole("button", { + name: "Deselect module", + }); + deselectModuleButton.focus(); + await expect(deselectModuleButton).toBeVisible(); + }, +}; + export const ManyModules: Story = { args: { currentStep: 2, diff --git a/site/src/pages/TemplateBuilder/SelectionSummary.tsx b/site/src/pages/TemplateBuilder/SelectionSummary.tsx index ec1bcda97a..543e5d514e 100644 --- a/site/src/pages/TemplateBuilder/SelectionSummary.tsx +++ b/site/src/pages/TemplateBuilder/SelectionSummary.tsx @@ -174,24 +174,27 @@ const ModuleSelection: React.FC = ({ {modules.map((module) => (
-
+
{`${module.name} - {module.name}
- + {module.name} +
+ +
))}