From b75c4c5587897deff318c245029136dd1a3b7f2f Mon Sep 17 00:00:00 2001 From: Mario Castigliano Date: Wed, 21 Aug 2024 14:24:11 +0200 Subject: [PATCH] feat(datepicker): add size s (#3006) --- .../datepicker/datepicker.stories.ts | 12 ++++++++--- .../datepicker/datepicker.visual.spec.ts | 20 +++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/elements/datepicker/datepicker/datepicker.stories.ts b/src/elements/datepicker/datepicker/datepicker.stories.ts index a85be9f56d..e94bd2bb57 100644 --- a/src/elements/datepicker/datepicker/datepicker.stories.ts +++ b/src/elements/datepicker/datepicker/datepicker.stories.ts @@ -175,7 +175,7 @@ const size: InputType = { control: { type: 'inline-radio', }, - options: ['m', 'l'], + options: ['s', 'm', 'l'], table: { category: 'Form-field attribute', }, @@ -268,7 +268,7 @@ const formFieldBasicArgsTypes: ArgTypes = { const formFieldBasicArgs = { ...basicArgs, label: 'Label', - size: size.options![0], + size: size.options![1], negative: false, optional: false, borderless: false, @@ -446,10 +446,16 @@ export const InFormFieldWithDateParser: StoryObj = { args: { ...formFieldBasicArgs, value: '2023-02-12', dateHandling: dateHandling.options![1] }, }; +export const InFormFieldSmall: StoryObj = { + render: TemplateFormField, + argTypes: { ...formFieldBasicArgsTypes }, + args: { ...formFieldBasicArgs, size: size.options![0] }, +}; + export const InFormFieldLarge: StoryObj = { render: TemplateFormField, argTypes: { ...formFieldBasicArgsTypes }, - args: { ...formFieldBasicArgs, size: size.options![1] }, + args: { ...formFieldBasicArgs, size: size.options![2] }, }; export const InFormFieldOptional: StoryObj = { diff --git a/src/elements/datepicker/datepicker/datepicker.visual.spec.ts b/src/elements/datepicker/datepicker/datepicker.visual.spec.ts index 4cb2d91702..fb911d25da 100644 --- a/src/elements/datepicker/datepicker/datepicker.visual.spec.ts +++ b/src/elements/datepicker/datepicker/datepicker.visual.spec.ts @@ -25,6 +25,8 @@ describe(`sbb-datepicker`, () => { ], }; + const sizes = ['s', 'l']; + describeViewports({ viewports: ['zero', 'medium'] }, () => { describeEach(cases, ({ negative, states }) => { beforeEach(async function () { @@ -71,5 +73,23 @@ describe(`sbb-datepicker`, () => { }), ); }); + + for (const size of sizes) { + it( + `size=${size}`, + visualDiffDefault.with(async (setup) => { + await setup.withFixture(html` + + + + + + + + + `); + }), + ); + } }); });