Skip to content

Commit

Permalink
test(sbb-form-field): enhance test cases for size
Browse files Browse the repository at this point in the history
  • Loading branch information
jeripeierSBB committed Aug 12, 2024
1 parent 644fc0f commit 5fb0061
Showing 1 changed file with 47 additions and 36 deletions.
83 changes: 47 additions & 36 deletions src/elements/form-field/form-field/form-field.visual.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,27 +273,6 @@ describe(`sbb-form-field`, () => {
);
});

// labels
it(
`label=undefined`,
visualDiffDefault.with(async (setup) => {
const noLabel = { ...basicArgs, label: undefined };
await setup.withFixture(html`${formField(noLabel, template(noLabel))}`, {
forcedColors,
});
}),
);

it(
`label=hidden`,
visualDiffDefault.with(async (setup) => {
const hiddenLabel = { ...basicArgs, 'hidden-label': true };
await setup.withFixture(html`${formField(hiddenLabel, template(hiddenLabel))}`, {
forcedColors,
});
}),
);

it(
`label=slotted`,
visualDiffDefault.with(async (setup) => {
Expand All @@ -304,21 +283,6 @@ describe(`sbb-form-field`, () => {
}),
);

it(
`label=floating`,
visualDiffDefault.with(async (setup) => {
const hiddenLabel = {
...basicArgs,
'floating-label': true,
value: undefined,
selectNullValue: true,
};
await setup.withFixture(html`${formField(hiddenLabel, template(hiddenLabel))}`, {
forcedColors,
});
}),
);

it(
`label=ellipsis`,
visualDiffDefault.with(async (setup) => {
Expand Down Expand Up @@ -421,6 +385,53 @@ describe(`sbb-form-field`, () => {
}),
);
});

for (const size of visualProp.size) {
describe(`size=${size}`, () => {
it(
`label=floating`,
visualDiffDefault.with(async (setup) => {
const hiddenLabel = {
...basicArgs,
'floating-label': true,
value: undefined,
selectNullValue: true,
size,
};
await setup.withFixture(
html`${formField(hiddenLabel, template(hiddenLabel))}`,
{
forcedColors,
},
);
}),
);

it(
`label=hidden`,
visualDiffDefault.with(async (setup) => {
const hiddenLabel = { ...basicArgs, 'hidden-label': true, size };
await setup.withFixture(
html`${formField(hiddenLabel, template(hiddenLabel))}`,
{
forcedColors,
},
);
}),
);

// labels
it(
`label=undefined`,
visualDiffDefault.with(async (setup) => {
const noLabel = { ...basicArgs, label: undefined, size };
await setup.withFixture(html`${formField(noLabel, template(noLabel))}`, {
forcedColors,
});
}),
);
});
}
});
}
});
Expand Down

0 comments on commit 5fb0061

Please sign in to comment.