@stackoverflow/stacks 2.4.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/stacks.css +24 -65
- package/dist/css/stacks.min.css +1 -1
- package/lib/components/tag/tag.less +21 -68
- package/lib/exports/color-sets.less +4 -4
- package/package.json +10 -9
- package/lib/atomic/__snapshots__/color-new.less.test.ts.snap +0 -3015
- package/lib/atomic/__snapshots__/color.less.test.ts.snap +0 -3132
- package/lib/atomic/__snapshots__/misc.less.test.ts.snap +0 -893
- package/lib/atomic/__snapshots__/spacing.less.test.ts.snap +0 -1928
- package/lib/atomic/color.less.test.ts +0 -12
- package/lib/atomic/misc.less.test.ts +0 -12
- package/lib/atomic/spacing.less.test.ts +0 -12
- package/lib/components/activity-indicator/activity-indicator.a11y.test.ts +0 -13
- package/lib/components/activity-indicator/activity-indicator.visual.test.ts +0 -22
- package/lib/components/anchor/anchor.a11y.test.ts +0 -35
- package/lib/components/anchor/anchor.visual.test.ts +0 -47
- package/lib/components/avatar/avatar.a11y.test.ts +0 -35
- package/lib/components/avatar/avatar.visual.test.ts +0 -50
- package/lib/components/award-bling/award-bling.a11y.test.ts +0 -15
- package/lib/components/award-bling/award-bling.visual.test.ts +0 -24
- package/lib/components/badge/badge.a11y.test.ts +0 -143
- package/lib/components/badge/badge.visual.test.ts +0 -165
- package/lib/components/banner/banner.a11y.test.ts +0 -36
- package/lib/components/banner/banner.test.ts +0 -73
- package/lib/components/banner/banner.visual.test.ts +0 -36
- package/lib/components/block-link/block-link.a11y.test.ts +0 -57
- package/lib/components/block-link/block-link.visual.test.ts +0 -57
- package/lib/components/breadcrumbs/breadcrumbs.a11y.test.ts +0 -36
- package/lib/components/breadcrumbs/breadcrumbs.visual.test.ts +0 -36
- package/lib/components/button/button.a11y.test.ts +0 -21
- package/lib/components/button/button.test.setup.ts +0 -36
- package/lib/components/button/button.visual.test.ts +0 -18
- package/lib/components/button-group/button-group.a11y.test.ts +0 -12
- package/lib/components/button-group/button-group.test.setup.ts +0 -77
- package/lib/components/button-group/button-group.visual.test.ts +0 -7
- package/lib/components/card/card.a11y.test.ts +0 -12
- package/lib/components/card/card.visual.test.ts +0 -52
- package/lib/components/check-control/check-control.a11y.test.ts +0 -33
- package/lib/components/check-control/check-control.visual.test.ts +0 -36
- package/lib/components/check-group/check-group.a11y.test.ts +0 -49
- package/lib/components/check-group/check-group.visual.test.ts +0 -56
- package/lib/components/checkbox_radio/checkbox_radio.a11y.test.ts +0 -37
- package/lib/components/checkbox_radio/checkbox_radio.visual.test.ts +0 -33
- package/lib/components/code-block/code-block.a11y.test.ts +0 -27
- package/lib/components/code-block/code-block.visual.test.ts +0 -18
- package/lib/components/description/description.a11y.test.ts +0 -28
- package/lib/components/description/description.visual.test.ts +0 -28
- package/lib/components/empty-state/empty-state.a11y.test.ts +0 -16
- package/lib/components/empty-state/empty-state.visual.test.ts +0 -16
- package/lib/components/expandable/expandable.a11y.test.ts +0 -26
- package/lib/components/expandable/expandable.test.ts +0 -51
- package/lib/components/expandable/expandable.visual.test.ts +0 -26
- package/lib/components/input-fill/input-fill.a11y.test.ts +0 -21
- package/lib/components/input-fill/input-fill.visual.test.ts +0 -21
- package/lib/components/input-icon/input-icon.a11y.test.ts +0 -81
- package/lib/components/input-icon/input-icon.visual.test.ts +0 -92
- package/lib/components/input-message/input-message.a11y.test.ts +0 -57
- package/lib/components/input-message/input-message.visual.test.ts +0 -58
- package/lib/components/input_textarea/input_textarea.a11y.test.ts +0 -109
- package/lib/components/input_textarea/input_textarea.visual.test.ts +0 -95
- package/lib/components/label/label.a11y.test.ts +0 -47
- package/lib/components/label/label.visual.test.ts +0 -65
- package/lib/components/link/link.a11y.test.ts +0 -27
- package/lib/components/link/link.visual.test.ts +0 -31
- package/lib/components/link-preview/link-preview.a11y.test.ts +0 -47
- package/lib/components/link-preview/link-preview.visual.test.ts +0 -52
- package/lib/components/menu/menu.a11y.test.ts +0 -39
- package/lib/components/menu/menu.visual.test.ts +0 -39
- package/lib/components/modal/modal.a11y.test.ts +0 -41
- package/lib/components/modal/modal.test.ts +0 -155
- package/lib/components/modal/modal.visual.test.ts +0 -41
- package/lib/components/navigation/navigation.a11y.test.ts +0 -81
- package/lib/components/navigation/navigation.visual.test.ts +0 -98
- package/lib/components/notice/notice.a11y.test.ts +0 -16
- package/lib/components/notice/notice.visual.test.ts +0 -25
- package/lib/components/page-title/page-title.a11y.test.ts +0 -28
- package/lib/components/page-title/page-title.visual.test.ts +0 -58
- package/lib/components/pagination/pagination.a11y.test.ts +0 -21
- package/lib/components/pagination/pagination.visual.test.ts +0 -25
- package/lib/components/popover/tooltip.test.ts +0 -62
- package/lib/components/post-summary/post-summary.a11y.test.ts +0 -25
- package/lib/components/post-summary/post-summary.test.setup.ts +0 -435
- package/lib/components/post-summary/post-summary.visual.test.ts +0 -17
- package/lib/components/progress-bar/progress-bar.a11y.test.ts +0 -189
- package/lib/components/progress-bar/progress-bar.visual.test.ts +0 -188
- package/lib/components/select/select.a11y.test.ts +0 -72
- package/lib/components/select/select.visual.test.ts +0 -72
- package/lib/components/spinner/spinner.a11y.test.ts +0 -14
- package/lib/components/spinner/spinner.visual.test.ts +0 -40
- package/lib/components/table/table.a11y.test.ts +0 -112
- package/lib/components/table/table.test.ts +0 -366
- package/lib/components/table/table.visual.test.ts +0 -104
- package/lib/components/tag/tag.a11y.test.ts +0 -28
- package/lib/components/tag/tag.visual.test.ts +0 -43
- package/lib/components/toast/toast.a11y.test.ts +0 -29
- package/lib/components/toast/toast.test.ts +0 -64
- package/lib/components/toast/toast.visual.test.ts +0 -30
- package/lib/components/toggle-switch/toggle-switch.a11y.test.ts +0 -66
- package/lib/components/toggle-switch/toggle-switch.visual.test.ts +0 -70
- package/lib/components/topbar/topbar.visual.test.ts +0 -217
- package/lib/exports/__snapshots__/color-mixins.less.test.ts.snap +0 -558
- package/lib/exports/__snapshots__/color.less.test.ts.snap +0 -819
- package/lib/exports/color-mixins.less.test.ts +0 -150
- package/lib/exports/color.less.test.ts +0 -12
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { html, fixture, expect } from "@open-wc/testing";
|
|
2
|
-
import { screen } from "@testing-library/dom";
|
|
3
|
-
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import "../../index";
|
|
5
|
-
import { showBanner, hideBanner } from "../../controllers";
|
|
6
|
-
|
|
7
|
-
const user = userEvent.setup();
|
|
8
|
-
|
|
9
|
-
describe("banner", () => {
|
|
10
|
-
it("trigger should make banner visible", async () => {
|
|
11
|
-
await fixture(html`
|
|
12
|
-
<button data-toggle="s-banner" data-target="#test-banner">
|
|
13
|
-
Show test banner
|
|
14
|
-
</button>
|
|
15
|
-
<aside
|
|
16
|
-
role="alert"
|
|
17
|
-
id="test-banner"
|
|
18
|
-
class="s-banner"
|
|
19
|
-
aria-labelledby="banner-message"
|
|
20
|
-
aria-hidden="true"
|
|
21
|
-
data-controller="s-banner"
|
|
22
|
-
data-s-banner-target="banner"
|
|
23
|
-
data-testid="test-banner"
|
|
24
|
-
>
|
|
25
|
-
Test banner
|
|
26
|
-
</aside>
|
|
27
|
-
`);
|
|
28
|
-
|
|
29
|
-
const button = screen.getByRole("button");
|
|
30
|
-
const banner = screen.getByTestId("test-banner");
|
|
31
|
-
|
|
32
|
-
expect(banner).to.have.attribute("aria-hidden", "true");
|
|
33
|
-
button.addEventListener("click", () => showBanner(banner));
|
|
34
|
-
|
|
35
|
-
await user.click(button);
|
|
36
|
-
expect(banner).to.have.attribute("aria-hidden", "false");
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it("trigger should hide banner", async () => {
|
|
40
|
-
await fixture(html`
|
|
41
|
-
<aside
|
|
42
|
-
role="alert"
|
|
43
|
-
id="test-banner"
|
|
44
|
-
class="s-banner"
|
|
45
|
-
aria-labelledby="banner-message"
|
|
46
|
-
aria-hidden="false"
|
|
47
|
-
data-controller="s-banner"
|
|
48
|
-
data-s-banner-target="banner"
|
|
49
|
-
data-testid="test-banner"
|
|
50
|
-
>
|
|
51
|
-
Test banner
|
|
52
|
-
<button
|
|
53
|
-
type="button"
|
|
54
|
-
class="s-btn s-banner--btn"
|
|
55
|
-
aria-label="Dismiss"
|
|
56
|
-
data-toggle="s-banner"
|
|
57
|
-
data-target="#test-banner"
|
|
58
|
-
>
|
|
59
|
-
Close banner
|
|
60
|
-
</button>
|
|
61
|
-
</aside>
|
|
62
|
-
`);
|
|
63
|
-
|
|
64
|
-
const button = screen.getByRole("button");
|
|
65
|
-
const banner = screen.getByTestId("test-banner");
|
|
66
|
-
|
|
67
|
-
expect(banner).to.have.attribute("aria-hidden", "false");
|
|
68
|
-
button.addEventListener("click", () => hideBanner(banner));
|
|
69
|
-
|
|
70
|
-
await user.click(button);
|
|
71
|
-
expect(banner).to.have.attribute("aria-hidden", "true");
|
|
72
|
-
});
|
|
73
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
2
|
-
import "../../index";
|
|
3
|
-
|
|
4
|
-
const bannerChild = `
|
|
5
|
-
<div
|
|
6
|
-
class="d-flex flex__center jc-space-between s-banner--container"
|
|
7
|
-
role="alertdialog"
|
|
8
|
-
aria-labelledby="banner-title"
|
|
9
|
-
aria-describedby="banner-description"
|
|
10
|
-
>
|
|
11
|
-
<div aria-label="banner message">
|
|
12
|
-
<h2 id="banner-title">Banner heading</h2>
|
|
13
|
-
<p id="banner-description">Banner description</p>
|
|
14
|
-
</div>
|
|
15
|
-
<div class="ml-auto myn8">
|
|
16
|
-
<span class="s-btn s-banner--btn">Close</span>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
describe("banner", () => {
|
|
22
|
-
runVisualTests({
|
|
23
|
-
baseClass: "s-banner",
|
|
24
|
-
variants: ["info", "success", "warning", "danger"],
|
|
25
|
-
modifiers: {
|
|
26
|
-
primary: ["important"],
|
|
27
|
-
},
|
|
28
|
-
attributes: {
|
|
29
|
-
role: "alert",
|
|
30
|
-
ariaHidden: "false",
|
|
31
|
-
},
|
|
32
|
-
children: {
|
|
33
|
-
default: bannerChild,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
-
const blockLinkTemplate = ({ component, testid }: any) =>
|
|
7
|
-
html`<div
|
|
8
|
-
class="d-inline-flex ai-center jc-center hs1 ws2 p8"
|
|
9
|
-
data-testid="${testid}"
|
|
10
|
-
>
|
|
11
|
-
${component}
|
|
12
|
-
</div>`;
|
|
13
|
-
|
|
14
|
-
describe("block-link", () => {
|
|
15
|
-
// Base block link
|
|
16
|
-
runA11yTests({
|
|
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
|
-
runA11yTests({
|
|
29
|
-
baseClass: "s-block-link",
|
|
30
|
-
modifiers: {
|
|
31
|
-
primary: ["danger"],
|
|
32
|
-
},
|
|
33
|
-
children: {
|
|
34
|
-
default: `block link`,
|
|
35
|
-
},
|
|
36
|
-
options: {
|
|
37
|
-
includeNullModifier: false,
|
|
38
|
-
},
|
|
39
|
-
template: blockLinkTemplate,
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
// All left and rignt variants
|
|
43
|
-
runA11yTests({
|
|
44
|
-
baseClass: "s-block-link",
|
|
45
|
-
variants: ["left is-selected", "right is-selected"],
|
|
46
|
-
modifiers: {
|
|
47
|
-
primary: ["danger"],
|
|
48
|
-
},
|
|
49
|
-
children: {
|
|
50
|
-
default: `block link`,
|
|
51
|
-
},
|
|
52
|
-
options: {
|
|
53
|
-
includeNullVariant: false,
|
|
54
|
-
},
|
|
55
|
-
template: blockLinkTemplate,
|
|
56
|
-
});
|
|
57
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
-
const blockLinkTemplate = ({ component, testid }: any) =>
|
|
7
|
-
html`<div
|
|
8
|
-
class="d-inline-flex ai-center jc-center hs1 ws2 p8"
|
|
9
|
-
data-testid="${testid}"
|
|
10
|
-
>
|
|
11
|
-
${component}
|
|
12
|
-
</div>`;
|
|
13
|
-
|
|
14
|
-
describe("block-link", () => {
|
|
15
|
-
// Base block link
|
|
16
|
-
runVisualTests({
|
|
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
|
-
runVisualTests({
|
|
29
|
-
baseClass: "s-block-link",
|
|
30
|
-
modifiers: {
|
|
31
|
-
primary: ["danger"],
|
|
32
|
-
},
|
|
33
|
-
children: {
|
|
34
|
-
default: `block link`,
|
|
35
|
-
},
|
|
36
|
-
options: {
|
|
37
|
-
includeNullModifier: false,
|
|
38
|
-
},
|
|
39
|
-
template: blockLinkTemplate,
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
// All left and rignt variants
|
|
43
|
-
runVisualTests({
|
|
44
|
-
baseClass: "s-block-link",
|
|
45
|
-
variants: ["left is-selected", "right is-selected"],
|
|
46
|
-
modifiers: {
|
|
47
|
-
primary: ["danger"],
|
|
48
|
-
},
|
|
49
|
-
children: {
|
|
50
|
-
default: `block link`,
|
|
51
|
-
},
|
|
52
|
-
options: {
|
|
53
|
-
includeNullVariant: false,
|
|
54
|
-
},
|
|
55
|
-
template: blockLinkTemplate,
|
|
56
|
-
});
|
|
57
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
2
|
-
import { html } from "@open-wc/testing";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("breadcrumbs", () => {
|
|
6
|
-
runA11yTests({
|
|
7
|
-
baseClass: "s-breadcrumbs",
|
|
8
|
-
children: {
|
|
9
|
-
default: `
|
|
10
|
-
<div class="s-breadcrumbs--item">
|
|
11
|
-
<a class="s-breadcrumbs--link" href="#">Stacks</a>
|
|
12
|
-
<span class="s-breadcrumbs--divider" aria-hidden="true">|</span>
|
|
13
|
-
</div>
|
|
14
|
-
<div class="s-breadcrumbs--item">
|
|
15
|
-
<a class="s-breadcrumbs--link" href="#">Help center</a>
|
|
16
|
-
<span class="s-breadcrumbs--divider" aria-hidden="true">|</span>
|
|
17
|
-
</div>
|
|
18
|
-
<div class="s-breadcrumbs--item">
|
|
19
|
-
<a class="s-breadcrumbs--link" href="#">Icons</a>
|
|
20
|
-
</div>
|
|
21
|
-
`,
|
|
22
|
-
},
|
|
23
|
-
attributes: {
|
|
24
|
-
"aria-label": "Breadcrumb navigation",
|
|
25
|
-
},
|
|
26
|
-
tag: "nav",
|
|
27
|
-
template: ({ component, testid }) => html`
|
|
28
|
-
<div
|
|
29
|
-
class="d-inline-flex ai-center jc-center hs1 ws2 p8"
|
|
30
|
-
data-testid="${testid}"
|
|
31
|
-
>
|
|
32
|
-
${component}
|
|
33
|
-
</div>
|
|
34
|
-
`,
|
|
35
|
-
});
|
|
36
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
2
|
-
import { html } from "@open-wc/testing";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("breadcrumbs", () => {
|
|
6
|
-
runVisualTests({
|
|
7
|
-
baseClass: "s-breadcrumbs",
|
|
8
|
-
children: {
|
|
9
|
-
default: `
|
|
10
|
-
<div class="s-breadcrumbs--item">
|
|
11
|
-
<a class="s-breadcrumbs--link" href="#">Stacks</a>
|
|
12
|
-
<span class="s-breadcrumbs--divider" aria-hidden="true">|</span>
|
|
13
|
-
</div>
|
|
14
|
-
<div class="s-breadcrumbs--item">
|
|
15
|
-
<a class="s-breadcrumbs--link" href="#">Help center</a>
|
|
16
|
-
<span class="s-breadcrumbs--divider" aria-hidden="true">|</span>
|
|
17
|
-
</div>
|
|
18
|
-
<div class="s-breadcrumbs--item">
|
|
19
|
-
<a class="s-breadcrumbs--link" href="#">Icons</a>
|
|
20
|
-
</div>
|
|
21
|
-
`,
|
|
22
|
-
},
|
|
23
|
-
attributes: {
|
|
24
|
-
"aria-label": "Breadcrumb navigation",
|
|
25
|
-
},
|
|
26
|
-
tag: "nav",
|
|
27
|
-
template: ({ component, testid }) => html`
|
|
28
|
-
<div
|
|
29
|
-
class="d-inline-flex ai-center jc-center hs1 ws2 p8"
|
|
30
|
-
data-testid="${testid}"
|
|
31
|
-
>
|
|
32
|
-
${component}
|
|
33
|
-
</div>
|
|
34
|
-
`,
|
|
35
|
-
});
|
|
36
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import testArgs from "./button.test.setup";
|
|
2
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("button", () => {
|
|
6
|
-
runA11yTests({
|
|
7
|
-
...testArgs,
|
|
8
|
-
excludedTestids: [
|
|
9
|
-
/^s-btn-(?=.*unset).*badge$/, // s-btn with badge and unset variant not supported
|
|
10
|
-
],
|
|
11
|
-
skippedTestids: [
|
|
12
|
-
// TODO resolve btn badge contrast issues
|
|
13
|
-
// matches tests with a badge in light and dark modes
|
|
14
|
-
/s-btn-(light|dark).*?badge/,
|
|
15
|
-
// matches tests with a badge in highcontrast-light modes, excluding filled, danger, github, facebook, sm, or xs
|
|
16
|
-
/s-btn-highcontrast-light-(?!.*(filled|danger|github|facebook|sm|xs)).*?badge/,
|
|
17
|
-
// matches tests with a badge in highcontrast-light modes, are muted and/or outlined, and are sm or xs
|
|
18
|
-
/s-btn-highcontrast-light-(?:muted-outlined-|muted-|outlined-)?(?:sm|xs).*?badge/,
|
|
19
|
-
],
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { TestVariationArgs } from "../../test/test-utils";
|
|
2
|
-
import "../../index";
|
|
3
|
-
|
|
4
|
-
const getChild = (child?: string): string => {
|
|
5
|
-
switch (child) {
|
|
6
|
-
case "badge":
|
|
7
|
-
return `Ask question
|
|
8
|
-
<span class="s-btn--badge">
|
|
9
|
-
<span class="s-btn--number">198</span>
|
|
10
|
-
</span>`;
|
|
11
|
-
default:
|
|
12
|
-
return "Ask question";
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
// TODO test disabled states, interaction pseudo-classes
|
|
17
|
-
const testArgs: TestVariationArgs = {
|
|
18
|
-
baseClass: "s-btn",
|
|
19
|
-
variants: ["danger", "muted"],
|
|
20
|
-
modifiers: {
|
|
21
|
-
primary: ["filled", "outlined"],
|
|
22
|
-
secondary: [...["xs", "sm", "md"], ...["dropdown", "icon"]],
|
|
23
|
-
global: ["is-loading"],
|
|
24
|
-
standalone: [...["link", "unset"], ...["facebook", "github", "google"]],
|
|
25
|
-
},
|
|
26
|
-
attributes: {
|
|
27
|
-
type: "button",
|
|
28
|
-
},
|
|
29
|
-
children: {
|
|
30
|
-
default: getChild(),
|
|
31
|
-
badge: getChild("badge"),
|
|
32
|
-
},
|
|
33
|
-
tag: "button",
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export default testArgs;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import testArgs from "./button.test.setup";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
import { html } from "@open-wc/testing";
|
|
5
|
-
|
|
6
|
-
describe("button", () => {
|
|
7
|
-
runVisualTests({
|
|
8
|
-
...testArgs,
|
|
9
|
-
template: ({ component, testid }) => html`
|
|
10
|
-
<div
|
|
11
|
-
class="bg-black-225 d-inline-flex ai-center jc-center hs1 ws2 p8"
|
|
12
|
-
data-testid="${testid}"
|
|
13
|
-
>
|
|
14
|
-
${component}
|
|
15
|
-
</div>
|
|
16
|
-
`,
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { testArgs } from "./button-group.test.setup";
|
|
2
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("button group", () => {
|
|
6
|
-
runA11yTests({
|
|
7
|
-
...testArgs,
|
|
8
|
-
// TODO remove skipped tests once btn badge contrast issues are resolved
|
|
9
|
-
// see also https://github.com/StackExchange/Stacks/pull/1663
|
|
10
|
-
skippedTestids: [/s-btn-group-(light|dark|highcontrast-light)-badge/],
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import type { TestVariationArgs } from "../../test/test-utils";
|
|
3
|
-
|
|
4
|
-
const btns = [
|
|
5
|
-
{ name: "Newest", isSelected: true },
|
|
6
|
-
{ name: "Frequent" },
|
|
7
|
-
{ name: "Active" },
|
|
8
|
-
];
|
|
9
|
-
|
|
10
|
-
const getBtn = ({
|
|
11
|
-
name = "",
|
|
12
|
-
isRadio,
|
|
13
|
-
isSelected,
|
|
14
|
-
hasBadge,
|
|
15
|
-
}: {
|
|
16
|
-
name: string;
|
|
17
|
-
isRadio?: boolean;
|
|
18
|
-
isSelected?: boolean;
|
|
19
|
-
hasBadge?: boolean;
|
|
20
|
-
}): string => {
|
|
21
|
-
const baseClasses = "s-btn s-btn__muted";
|
|
22
|
-
const btnChildren = `
|
|
23
|
-
<span class="s-btn--text" data-text="${name}">${name}</span>
|
|
24
|
-
${
|
|
25
|
-
hasBadge
|
|
26
|
-
? `<span class="s-btn--badge"><span class="s-btn--number">123</span></span>`
|
|
27
|
-
: ""
|
|
28
|
-
}
|
|
29
|
-
`;
|
|
30
|
-
|
|
31
|
-
return isRadio
|
|
32
|
-
? `<input
|
|
33
|
-
class="s-btn--radio"
|
|
34
|
-
type="radio"
|
|
35
|
-
name="test-btn-radio-group"
|
|
36
|
-
id="btn-${name}"
|
|
37
|
-
${isSelected ? "checked" : ""}/>
|
|
38
|
-
<label class="${baseClasses}" for="btn-${name}">
|
|
39
|
-
${btnChildren}
|
|
40
|
-
</label>`
|
|
41
|
-
: `<button
|
|
42
|
-
class="${baseClasses}${isSelected ? " is-selected" : ""}"
|
|
43
|
-
${isSelected ? `aria-current="true"` : ""}
|
|
44
|
-
type="button">
|
|
45
|
-
${btnChildren}
|
|
46
|
-
</button>`;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const getBtns = (ids: number[]): string => {
|
|
50
|
-
return ids.map((id) => getBtn(btns[id])).join("");
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const testArgs: TestVariationArgs = {
|
|
54
|
-
baseClass: "s-btn-group",
|
|
55
|
-
children: {
|
|
56
|
-
default: getBtns([0, 1, 2]),
|
|
57
|
-
single: getBtns([0]),
|
|
58
|
-
form: `
|
|
59
|
-
${getBtns([0])}
|
|
60
|
-
<form class="mb0 p0">
|
|
61
|
-
${getBtn(btns[1])}
|
|
62
|
-
</form>
|
|
63
|
-
${getBtns([2])}
|
|
64
|
-
`,
|
|
65
|
-
badge: btns.map((btn) => getBtn({ ...btn, hasBadge: true })).join(""),
|
|
66
|
-
radio: btns.map((btn) => getBtn({ ...btn, isRadio: true })).join(""),
|
|
67
|
-
},
|
|
68
|
-
template: ({ component, testid }) =>
|
|
69
|
-
html`<div
|
|
70
|
-
class="d-inline-flex ai-center jc-center p8"
|
|
71
|
-
data-testid="${testid}"
|
|
72
|
-
>
|
|
73
|
-
${component}
|
|
74
|
-
</div>`,
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export { testArgs };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
2
|
-
import "../../index";
|
|
3
|
-
|
|
4
|
-
describe("card", () => {
|
|
5
|
-
runA11yTests({
|
|
6
|
-
baseClass: "s-card",
|
|
7
|
-
variants: ["muted"],
|
|
8
|
-
children: {
|
|
9
|
-
default: `<p>This is a description of the card’s content.</p>`,
|
|
10
|
-
},
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
-
const cardTemplate = ({ component, testid }: any) =>
|
|
7
|
-
html`<div
|
|
8
|
-
class="d-inline-flex ai-center jc-center hs2 ws3 p8"
|
|
9
|
-
data-testid="${testid}"
|
|
10
|
-
>
|
|
11
|
-
${component}
|
|
12
|
-
</div>`;
|
|
13
|
-
|
|
14
|
-
const baseChild = `
|
|
15
|
-
<h2 class="fs-body3 lh-sm fc-dark">Base card title</h2>
|
|
16
|
-
<p class="fs-body1 fc-medium">
|
|
17
|
-
This is a description of the card’s content.
|
|
18
|
-
</p>
|
|
19
|
-
<div class="d-flex gx4">
|
|
20
|
-
<button class="flex--item s-btn s-btn__filled s-btn__sm">
|
|
21
|
-
Call to action
|
|
22
|
-
</button>
|
|
23
|
-
<button class="flex--item s-btn s-btn__sm">Cancel</button>
|
|
24
|
-
</div>
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
describe("card", () => {
|
|
28
|
-
runVisualTests({
|
|
29
|
-
baseClass: "s-card",
|
|
30
|
-
variants: ["muted"],
|
|
31
|
-
children: {
|
|
32
|
-
default: baseChild,
|
|
33
|
-
},
|
|
34
|
-
template: cardTemplate,
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// Stacked
|
|
38
|
-
runVisualTests({
|
|
39
|
-
baseClass: "s-card",
|
|
40
|
-
variants: ["stacked"], // dummy variant for testid differentiation
|
|
41
|
-
children: {
|
|
42
|
-
default: `<div class="s-card ps-relative b4 l4">${baseChild}</div>`,
|
|
43
|
-
},
|
|
44
|
-
attributes: {
|
|
45
|
-
class: "p0",
|
|
46
|
-
},
|
|
47
|
-
template: cardTemplate,
|
|
48
|
-
options: {
|
|
49
|
-
includeNullVariant: false,
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
2
|
-
import "../../index";
|
|
3
|
-
|
|
4
|
-
["checkbox", "radio"].forEach((type) => {
|
|
5
|
-
describe("s-check-control", () => {
|
|
6
|
-
// TODO include indeterminate
|
|
7
|
-
["checked", "unchecked"].forEach((state) => {
|
|
8
|
-
runA11yTests({
|
|
9
|
-
baseClass: "s-check-control",
|
|
10
|
-
modifiers: {
|
|
11
|
-
global: ["has-warning", "has-error", "has-success"],
|
|
12
|
-
},
|
|
13
|
-
children: {
|
|
14
|
-
default: `
|
|
15
|
-
<input
|
|
16
|
-
class="s-${type}"
|
|
17
|
-
type="${type}"
|
|
18
|
-
id="test-input"
|
|
19
|
-
name=""
|
|
20
|
-
${state === "checked" ? "checked" : ""}/>
|
|
21
|
-
<label class="s-label" for="test-input">
|
|
22
|
-
Label ${type}
|
|
23
|
-
<p class="s-input-message">Description</p>
|
|
24
|
-
</label>
|
|
25
|
-
`,
|
|
26
|
-
},
|
|
27
|
-
options: {
|
|
28
|
-
testidSuffix: `${state}-${type}`,
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
2
|
-
import "../../index";
|
|
3
|
-
|
|
4
|
-
["checkbox", "radio"].forEach((type) => {
|
|
5
|
-
describe("s-check-control", () => {
|
|
6
|
-
// TODO include indeterminate
|
|
7
|
-
["checked", "unchecked"].forEach((state) => {
|
|
8
|
-
runVisualTests({
|
|
9
|
-
baseClass: "s-check-control",
|
|
10
|
-
modifiers: {
|
|
11
|
-
global: ["has-warning", "has-error", "has-success"],
|
|
12
|
-
},
|
|
13
|
-
attributes: {
|
|
14
|
-
class: "bg-black-225 hs1 ws2 p8",
|
|
15
|
-
},
|
|
16
|
-
children: {
|
|
17
|
-
default: `
|
|
18
|
-
<input
|
|
19
|
-
class="s-${type}"
|
|
20
|
-
type="${type}"
|
|
21
|
-
id="test-input"
|
|
22
|
-
name=""
|
|
23
|
-
${state === "checked" ? "checked" : ""}/>
|
|
24
|
-
<label class="s-label" for="test-input">
|
|
25
|
-
Label ${type}
|
|
26
|
-
<p class="s-input-message">Description</p>
|
|
27
|
-
</label>
|
|
28
|
-
`,
|
|
29
|
-
},
|
|
30
|
-
options: {
|
|
31
|
-
testidSuffix: `${state}-${type}`,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
});
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
2
|
-
import "../../index";
|
|
3
|
-
|
|
4
|
-
type CheckGroup = "checkbox" | "radio";
|
|
5
|
-
const checkTypes: CheckGroup[] = ["checkbox", "radio"];
|
|
6
|
-
|
|
7
|
-
checkTypes.forEach((type) => {
|
|
8
|
-
describe("s-check-group", () => {
|
|
9
|
-
const checkEls: {
|
|
10
|
-
type: CheckGroup;
|
|
11
|
-
id: string;
|
|
12
|
-
state?: "checked" | "unchecked" | "indeterminate";
|
|
13
|
-
}[] = [
|
|
14
|
-
{ type, id: `test-${type}1`, state: "checked" },
|
|
15
|
-
{ type, id: `test-${type}2` },
|
|
16
|
-
];
|
|
17
|
-
runA11yTests({
|
|
18
|
-
tag: "fieldset",
|
|
19
|
-
baseClass: "s-check-group",
|
|
20
|
-
variants: ["horizontal"],
|
|
21
|
-
children: {
|
|
22
|
-
default: `
|
|
23
|
-
<legend class="s-label">${type} group</legend>
|
|
24
|
-
${checkEls
|
|
25
|
-
.map(
|
|
26
|
-
({ type, state, id }, index) => `
|
|
27
|
-
<div class="s-check-control">
|
|
28
|
-
<input
|
|
29
|
-
class="s-${type}"
|
|
30
|
-
type="${type}"
|
|
31
|
-
id="${id}-${index}"
|
|
32
|
-
name=""
|
|
33
|
-
${state === "checked" ? "checked" : ""}/>
|
|
34
|
-
<label class="s-label" for="${id}-${index}">
|
|
35
|
-
${type} label ${index}
|
|
36
|
-
<p class="s-input-message">Description</p>
|
|
37
|
-
</label>
|
|
38
|
-
</div>
|
|
39
|
-
`
|
|
40
|
-
)
|
|
41
|
-
.join("")}
|
|
42
|
-
`,
|
|
43
|
-
},
|
|
44
|
-
options: {
|
|
45
|
-
testidSuffix: type,
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
});
|