Skip to content

Commit

Permalink
fix: add visual regression tests for states
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideMininni-Fincons committed Aug 12, 2024
1 parent e50fbd0 commit 6eba538
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { html, nothing, type TemplateResult } from 'lit';

import { describeEach, describeViewports, visualDiffDefault } from '../../core/testing/private.js';
import {
describeEach,
describeViewports,
visualDiffActive,
visualDiffDefault,
visualDiffFocus,
visualDiffHover,
visualRegressionFixture,
} from '../../core/testing/private.js';

import './link-list-anchor.js';
import '../../link/block-link.js';
Expand All @@ -24,13 +32,29 @@ const listAnchor = (
`;

describe(`sbb-link-list-anchor`, () => {
const cases = {
negative: [false, true],
size: ['xs', 's', 'm'],
};
const cases = { negative: [false, true] };

describeViewports({ viewports: ['zero', 'medium', 'wide'] }, () => {
describeEach(cases, ({ negative, size }) => {
describeEach(cases, ({ negative }) => {
let root: HTMLElement;

beforeEach(async function () {
root = await visualRegressionFixture(listAnchor(negative, 's', true), {
backgroundColor: negative ? 'var(--sbb-color-charcoal)' : undefined,
});
});

for (const state of [visualDiffActive, visualDiffHover, visualDiffFocus]) {
it(
state.name,
state.with((setup) => {
setup.withSnapshotElement(root);
}),
);
}
});

describeEach({ ...cases, size: ['xs', 's', 'm'] }, ({ negative, size }) => {
it(
'title',
visualDiffDefault.with(async (setup) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}

.app-scroll-container {
@include sbb.scrollbar;

overflow: auto;

@include sbb.scrollbar;
}

0 comments on commit 6eba538

Please sign in to comment.