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(menu): add a11y; visual tests #1530

Merged
merged 2 commits into from
Oct 19, 2023
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
40 changes: 40 additions & 0 deletions lib/components/menu/menu.a11y.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { html } from "@open-wc/testing";
import { runComponentTests } from "../../test/test-utils";
import "../../index";

describe("menu", () => {
runComponentTests({
type: "a11y",
baseClass: `s-menu`,
children: {
default: `
<li class="s-menu--title" role="separator">Title 1</li>
<li role="menuitem">
<a href="#" class="s-block-link">Example li</a>
</li>
<li class="s-menu--title" role="separator">Title 2</li>
<li role="menuitem">
<a href="#" class="s-block-link s-block-link__left is-selected">Selected link</a>
</li>
<li role="menuitem">
<a href="#" class="s-block-link">Example li</a>
</li>
<li role="menuitem" class="s-menu--label">Example label</li>
<li role="menuitem">
<a href="#" class="s-block-link">Block link</a>
</li>
<li class="s-menu--divider" role="separator"></li>
<li role="menuitem">
<a href="…" class="s-block-link s-block-link__danger">Danger link</a>
</li>
`,
},
tag: "ul",
attributes: {
role: "menu",
},
template: ({ component, testid }) => html`
<div class="ws2" data-testid="${testid}">${component}</div>
`,
});
});
40 changes: 40 additions & 0 deletions lib/components/menu/menu.visual.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { html } from "@open-wc/testing";
import { runComponentTests } from "../../test/test-utils";
import "../../index";

describe("menu", () => {
runComponentTests({
type: "visual",
baseClass: `s-menu`,
children: {
default: `
<li class="s-menu--title" role="separator">Title 1</li>
<li role="menuitem">
<a href="#" class="s-block-link">Example li</a>
</li>
<li class="s-menu--title" role="separator">Title 2</li>
<li role="menuitem">
<a href="#" class="s-block-link s-block-link__left is-selected">Selected link</a>
</li>
<li role="menuitem">
<a href="#" class="s-block-link">Example li</a>
</li>
<li role="menuitem" class="s-menu--label">Example label</li>
<li role="menuitem">
<a href="#" class="s-block-link">Block link</a>
</li>
<li class="s-menu--divider" role="separator"></li>
<li role="menuitem">
<a href="…" class="s-block-link s-block-link__danger">Danger link</a>
</li>
`,
},
tag: "ul",
attributes: {
role: "menu",
},
template: ({ component, testid }) => html`
<div class="ws2" data-testid="${testid}">${component}</div>
`,
});
});
3 changes: 3 additions & 0 deletions screenshots/Chromium/baseline/s-menu-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions screenshots/Chromium/baseline/s-menu-highcontrast-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions screenshots/Chromium/baseline/s-menu-highcontrast-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions screenshots/Chromium/baseline/s-menu-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions screenshots/Firefox/baseline/s-menu-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions screenshots/Firefox/baseline/s-menu-highcontrast-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions screenshots/Firefox/baseline/s-menu-highcontrast-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions screenshots/Firefox/baseline/s-menu-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions screenshots/Webkit/baseline/s-menu-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions screenshots/Webkit/baseline/s-menu-highcontrast-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions screenshots/Webkit/baseline/s-menu-highcontrast-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions screenshots/Webkit/baseline/s-menu-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.