Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(skiplink-list): add visual spec #2888

Merged
merged 3 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/elements/skiplink-list/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ and it can be set using the `title-content` property.

## Slots

| Name | Description |
| ---- | --------------------------------------------------------------------------------------------------------- |
| | Use the unnamed slot to add `sbb-block-link`/`sbb-block-link-button` elements to the `sbb-skiplink-list`. |
| Name | Description |
| ------- | --------------------------------------------------------------------------------------------------------- |
| | Use the unnamed slot to add `sbb-block-link`/`sbb-block-link-button` elements to the `sbb-skiplink-list`. |
| `title` | Use this to provide a title for the skiplink-list (optional). |
1 change: 1 addition & 0 deletions src/elements/skiplink-list/skiplink-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import '../title.js';
* It displays a list of `sbb-block-link`/`sbb-block-link-button` which are visible only when focused.
*
* @slot - Use the unnamed slot to add `sbb-block-link`/`sbb-block-link-button` elements to the `sbb-skiplink-list`.
* @slot title - Use this to provide a title for the skiplink-list (optional).
* @cssprop [--sbb-skiplink-list-z-index=var(--sbb-overlay-default-z-index)] - To specify a custom stack order,
* the `z-index` can be overridden by defining this CSS variable. The default `z-index` of the
* component is set to `var(--sbb-overlay-default-z-index)` with a value of `1000`.
Expand Down
34 changes: 34 additions & 0 deletions src/elements/skiplink-list/skiplink-list.visual.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { html, nothing, type TemplateResult } from 'lit';

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

import './skiplink-list.js';
import '../link/block-link.js';

const template = (title?: string): TemplateResult => html`
<sbb-skiplink-list title-content=${title || nothing}>
<sbb-block-link href="#">Link 1</sbb-block-link>
<sbb-block-link href="#">Link 2</sbb-block-link>
<sbb-block-link href="#">Link 3</sbb-block-link>
</sbb-skiplink-list>
`;

describe(`sbb-skiplink-list`, () => {
describeViewports({ viewports: ['zero', 'medium'] }, () => {
for (const state of [visualDiffDefault, visualDiffFocus]) {
it(
state.name,
state.with(async (setup) => {
await setup.withFixture(template(), { minHeight: '100px' });
}),
);
}

it(
`title content`,
visualDiffFocus.with(async (setup) => {
await setup.withFixture(template('Skip to'), { minHeight: '100px' });
}),
);
});
});
Loading