Skip to content

Commit

Permalink
test(sbb-navigation-button): optimize visual spec
Browse files Browse the repository at this point in the history
  • Loading branch information
TomMenga committed Jul 1, 2024
1 parent fd024f5 commit 81bb0fb
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,28 @@ describe(`sbb-navigation-button`, () => {
const sizeCases = ['s', 'm', 'l'];

describeViewports({ viewports: ['zero', 'medium'] }, () => {
for (const state of [visualDiffDefault, visualDiffHover, visualDiffFocus]) {
it(
state.name,
state.with(async (setup) => {
await setup.withFixture(html` <sbb-navigation-button>Label</sbb-navigation-button> `, {
backgroundColor: 'var(--sbb-color-midnight)',
focusOutlineDark: true,
});
}),
);
}

for (const size of sizeCases) {
for (const state of [visualDiffDefault, visualDiffHover, visualDiffFocus]) {
it(
`size=${size} ${state.name}`,
state.with(async (setup) => {
await setup.withFixture(
html` <sbb-navigation-button size=${size}>Label</sbb-navigation-button> `,
{ backgroundColor: 'var(--sbb-color-midnight)', focusOutlineDark: true },
);
}),
);
}
it(
`size=${size}`,
visualDiffDefault.with(async (setup) => {
await setup.withFixture(
html` <sbb-navigation-button size=${size}>Label</sbb-navigation-button> `,
{ backgroundColor: 'var(--sbb-color-midnight)', focusOutlineDark: true },
);
}),
);
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,28 @@ describe(`sbb-navigation-link`, () => {
const sizeCases = ['s', 'm', 'l'];

describeViewports({ viewports: ['zero', 'medium'] }, () => {
for (const state of [visualDiffDefault, visualDiffHover, visualDiffFocus]) {
it(
state.name,
state.with(async (setup) => {
await setup.withFixture(
html` <sbb-navigation-link href="#">Label</sbb-navigation-link> `,
{ backgroundColor: 'var(--sbb-color-midnight)', focusOutlineDark: true },
);
}),
);
}

for (const size of sizeCases) {
for (const state of [visualDiffDefault, visualDiffHover, visualDiffFocus]) {
it(
`size=${size} ${state.name}`,
state.with(async (setup) => {
await setup.withFixture(
html` <sbb-navigation-link size=${size} href="#">Label</sbb-navigation-link> `,
{ backgroundColor: 'var(--sbb-color-midnight)', focusOutlineDark: true },
);
}),
);
}
it(
`size=${size}`,
visualDiffDefault.with(async (setup) => {
await setup.withFixture(
html` <sbb-navigation-link href="#" size=${size}>Label</sbb-navigation-link> `,
{ backgroundColor: 'var(--sbb-color-midnight)', focusOutlineDark: true },
);
}),
);
}
});
});

0 comments on commit 81bb0fb

Please sign in to comment.