Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ export default meta;

type Story = StoryObj<typeof AltRadiosListFieldStateful>;

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 () => {
Expand All @@ -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);
Expand All @@ -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);
Expand Down