From 2f9c7b2c084d81a5b25dd3a74623d011e74e0291 Mon Sep 17 00:00:00 2001 From: Davide Mininni Date: Fri, 14 Jun 2024 15:34:46 +0200 Subject: [PATCH] fix: tests --- .../breadcrumb/breadcrumb.visual.spec.ts | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/elements/breadcrumb/breadcrumb/breadcrumb.visual.spec.ts b/src/elements/breadcrumb/breadcrumb/breadcrumb.visual.spec.ts index 5a872a7e21..bda102fd03 100644 --- a/src/elements/breadcrumb/breadcrumb/breadcrumb.visual.spec.ts +++ b/src/elements/breadcrumb/breadcrumb/breadcrumb.visual.spec.ts @@ -12,32 +12,36 @@ describe('sbb-breadcrumb', () => { let root: HTMLElement; const cases = [ - { name: 'text', icon: undefined, text: 'Breadcrumb' }, - { name: 'icon', icon: 'house-small', text: undefined }, - { name: 'both', icon: 'house-small', text: 'Breadcrumb' }, + { case: 'only label', icon: undefined, text: 'Breadcrumb' }, + { case: 'only icon', icon: 'house-small', text: undefined }, + { case: 'label and icon', icon: 'house-small', text: 'Breadcrumb' }, ]; describeViewports({ viewports: ['wide'] }, () => { - describe('combination', () => { - for (const singleCase of cases) { + for (const singleCase of cases) { + describe(`${singleCase.case}`, () => { + beforeEach(async function () { + root = await visualRegressionFixture(html` + ${singleCase.text || nothing} + `); + }); + for (const state of visualDiffStandardStates) { it( - `${singleCase.name} ${state.name}`, + `${state.name}`, state.with((setup) => { - setup.withFixture(html` - ${singleCase.text ? singleCase.text : nothing} - `); + setup.withSnapshotElement(root); }), ); } - } - }); + }); + } describe('slotted icon', () => { beforeEach(async function () {