diff --git a/packages/components/src/components/AltRadio/AltRadiosListField/AltRadiosListField.test.stories.tsx b/packages/components/src/components/AltRadio/AltRadiosListField/AltRadiosListField.test.stories.tsx index 15dc8ab3..3b68a129 100644 --- a/packages/components/src/components/AltRadio/AltRadiosListField/AltRadiosListField.test.stories.tsx +++ b/packages/components/src/components/AltRadio/AltRadiosListField/AltRadiosListField.test.stories.tsx @@ -23,11 +23,10 @@ export default meta; type Story = StoryObj; -export const Default: Story = { - name: 'Default', +export const DefaultClickLastItem: Story = { + name: 'Default / Click last item', play: async ({ canvasElement, step, args }) => { const canvas = within(canvasElement); - const input2 = canvas.getByText('Item 2'); const input3 = canvas.getByText('Item 3'); await step('Click last item', async () => { @@ -37,6 +36,17 @@ export const Default: Story = { await expect(args.onChange).toHaveBeenLastCalledWith('item3'); await expect(input3).toHaveClass('ids-alt-radio__tile--checked'); }); + }, +}; + +export const DefaultClickSecondItem: Story = { + name: 'Default / Click second item', + play: async ({ canvasElement, context, step, args }) => { + await DefaultClickLastItem.play?.(context); + + const canvas = within(canvasElement); + const input2 = canvas.getByText('Item 2'); + const input3 = canvas.getByText('Item 3'); await step('Click second item', async () => { await userEvent.click(input2); @@ -46,6 +56,16 @@ export const Default: Story = { await expect(input2).toHaveClass('ids-alt-radio__tile--checked'); await expect(input3).not.toHaveClass('ids-alt-radio__tile--checked'); }); + }, +}; + +export const DefaultClickSecondItemAgain: Story = { + name: 'Default / Click second item again', + play: async ({ canvasElement, context, step, args }) => { + await DefaultClickSecondItem.play?.(context); + + const canvas = within(canvasElement); + const input2 = canvas.getByText('Item 2'); await step('Click second item once more', async () => { await userEvent.click(input2);