Skip to content

Commit f02057a

Browse files
authored
test(block-link): add a11y, visual tests (#1344)
* test(block-link): add a11y, visual tests * update visual test screenshots * simplify template * simplify template take 2 * prettier
1 parent 567ebb3 commit f02057a

File tree

86 files changed

+381
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+381
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { html } from "@open-wc/testing";
2+
import { defaultOptions, runComponentTests } from "../../test/test-utils";
3+
import "../../index";
4+
5+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6+
const blockLinkTemplate = ({ component, testid }: any) => html`<div
7+
class="d-inline-flex ai-center jc-center hs1 ws2 p8"
8+
data-testid="${testid}"
9+
>
10+
${component}
11+
</div>`;
12+
13+
describe("block-link", () => {
14+
// Base block link
15+
runComponentTests({
16+
type: "a11y",
17+
baseClass: "s-block-link",
18+
modifiers: {
19+
global: ["is-selected"],
20+
},
21+
children: {
22+
default: `block link`,
23+
},
24+
template: blockLinkTemplate,
25+
});
26+
27+
// Base + danger
28+
runComponentTests({
29+
type: "a11y",
30+
baseClass: "s-block-link",
31+
modifiers: {
32+
primary: ["danger"],
33+
},
34+
children: {
35+
default: `block link`,
36+
},
37+
options: {
38+
...defaultOptions,
39+
includeNullModifier: false,
40+
},
41+
skippedTestids: ["s-block-link-dark-danger"],
42+
template: blockLinkTemplate,
43+
});
44+
45+
// All left and rignt variants
46+
runComponentTests({
47+
type: "a11y",
48+
baseClass: "s-block-link",
49+
variants: ["left is-selected", "right is-selected"],
50+
modifiers: {
51+
primary: ["danger"],
52+
},
53+
children: {
54+
default: `block link`,
55+
},
56+
options: {
57+
...defaultOptions,
58+
includeNullVariant: false,
59+
},
60+
skippedTestids: [
61+
"s-block-link-dark-left-is-selected-danger",
62+
"s-block-link-dark-right-is-selected-danger",
63+
"s-block-link-light-left-is-selected-danger",
64+
"s-block-link-light-right-is-selected-danger",
65+
],
66+
template: blockLinkTemplate,
67+
});
68+
});
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { html } from "@open-wc/testing";
2+
import { defaultOptions, runComponentTests } from "../../test/test-utils";
3+
import "../../index";
4+
5+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6+
const blockLinkTemplate = ({ component, testid }: any) => html`<div
7+
class="d-inline-flex ai-center jc-center hs1 ws2 p8"
8+
data-testid="${testid}"
9+
>
10+
${component}
11+
</div>`;
12+
13+
describe("block-link", () => {
14+
// Base block link
15+
runComponentTests({
16+
type: "visual",
17+
baseClass: "s-block-link",
18+
modifiers: {
19+
global: ["is-selected"],
20+
},
21+
children: {
22+
default: `block link`,
23+
},
24+
template: blockLinkTemplate,
25+
});
26+
27+
// Base + danger
28+
runComponentTests({
29+
type: "visual",
30+
baseClass: "s-block-link",
31+
modifiers: {
32+
primary: ["danger"],
33+
},
34+
children: {
35+
default: `block link`,
36+
},
37+
options: {
38+
...defaultOptions,
39+
includeNullModifier: false,
40+
},
41+
template: blockLinkTemplate,
42+
});
43+
44+
// All left and rignt variants
45+
runComponentTests({
46+
type: "visual",
47+
baseClass: "s-block-link",
48+
variants: ["left is-selected", "right is-selected"],
49+
modifiers: {
50+
primary: ["danger"],
51+
},
52+
children: {
53+
default: `block link`,
54+
},
55+
options: {
56+
...defaultOptions,
57+
includeNullVariant: false,
58+
},
59+
template: blockLinkTemplate,
60+
});
61+
});
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions
Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)