@stackoverflow/stacks 2.3.3 → 2.5.0
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 +37 -4884
- package/dist/css/stacks.min.css +1 -1
- package/lib/components/button/button.less +0 -18
- package/lib/components/tag/tag.less +16 -68
- package/lib/components/topbar/topbar.less +33 -3
- package/lib/exports/color-mixins.less +0 -2
- package/lib/exports/exports.less +0 -1
- package/lib/stacks-static.less +0 -5
- package/package.json +12 -11
- 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/atomic/v1/__snapshots__/border.less.test.ts.snap +0 -546
- package/lib/atomic/v1/__snapshots__/color.less.test.ts.snap +0 -6750
- package/lib/atomic/v1/__snapshots__/typography.less.test.ts.snap +0 -16
- package/lib/atomic/v1/border.less +0 -210
- package/lib/atomic/v1/border.less.test.ts +0 -14
- package/lib/atomic/v1/color.less +0 -183
- package/lib/atomic/v1/color.less.test.ts +0 -14
- package/lib/atomic/v1/typography.less +0 -8
- package/lib/atomic/v1/typography.less.test.ts +0 -14
- 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 -216
- 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
- package/lib/exports/v1/__snapshots__/constants-colors.less.test.ts.snap +0 -902
- package/lib/exports/v1/constants-colors.less +0 -893
- package/lib/exports/v1/constants-colors.less.test.ts +0 -12
|
@@ -1,51 +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
|
-
|
|
6
|
-
const user = userEvent.setup();
|
|
7
|
-
|
|
8
|
-
describe("expandable-control", () => {
|
|
9
|
-
it("should focus on expandable content only when expanded", async () => {
|
|
10
|
-
await fixture(html`
|
|
11
|
-
<button
|
|
12
|
-
data-controller="s-expandable-control"
|
|
13
|
-
aria-expanded="false"
|
|
14
|
-
aria-controls="expandable-example"
|
|
15
|
-
>
|
|
16
|
-
expandable trigger
|
|
17
|
-
</button>
|
|
18
|
-
<div class="s-expandable" id="expandable-example">
|
|
19
|
-
<div class="s-expandable--content">
|
|
20
|
-
<button>inside expandable</button>
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
`);
|
|
24
|
-
|
|
25
|
-
// expandable is not expanded
|
|
26
|
-
let expandableTrigger = screen.getByRole("button", {
|
|
27
|
-
name: "expandable trigger",
|
|
28
|
-
expanded: false,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
expect(
|
|
32
|
-
screen.queryByRole("button", {
|
|
33
|
-
name: "inside expandable",
|
|
34
|
-
})
|
|
35
|
-
).to.be.null;
|
|
36
|
-
|
|
37
|
-
await user.click(expandableTrigger);
|
|
38
|
-
|
|
39
|
-
// expandable is now expanded
|
|
40
|
-
expandableTrigger = screen.getByRole("button", {
|
|
41
|
-
name: "expandable trigger",
|
|
42
|
-
expanded: true,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
expect(
|
|
46
|
-
screen.getByRole("button", {
|
|
47
|
-
name: "inside expandable",
|
|
48
|
-
})
|
|
49
|
-
).to.be.visible;
|
|
50
|
-
});
|
|
51
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("expandable", () => {
|
|
6
|
-
runVisualTests({
|
|
7
|
-
baseClass: "s-expandable",
|
|
8
|
-
modifiers: {
|
|
9
|
-
global: ["is-expanded"],
|
|
10
|
-
},
|
|
11
|
-
children: {
|
|
12
|
-
default: `
|
|
13
|
-
<div class="s-expandable--content">
|
|
14
|
-
<p class="mb8">Expandable: Lorem ipsum dolor sit amet, ex iudicabit necessitatibus usu, cetero laboramus concludaturque mel no, facilisis posidonium cu cum. Pro ex senserit dissentiunt, imperdiet intellegam at sed, ex pri dicit eruditi convenire. Est harum movet gubergren ei, errem dictas evertitur ea sit, at mei oratio eligendi. Ad vis legere possit, vis ne ipsum democritum appellantur. Nullam ancillae iudicabit his ad.</p>
|
|
15
|
-
</div>
|
|
16
|
-
`,
|
|
17
|
-
},
|
|
18
|
-
template: ({ component, testid }) => html`
|
|
19
|
-
<div class="ws2 p8" data-testid="${testid}">
|
|
20
|
-
<div><p>Before expandable content</p></div>
|
|
21
|
-
${component}
|
|
22
|
-
<div><p>After expandable content</p></div>
|
|
23
|
-
</div>
|
|
24
|
-
`,
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,21 +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 template = ({ component, testid }: any) => html`
|
|
7
|
-
<div data-testid="${testid}" class="p8 ws1">${component}</div>
|
|
8
|
-
`;
|
|
9
|
-
|
|
10
|
-
describe("input-fill", () => {
|
|
11
|
-
runA11yTests({
|
|
12
|
-
baseClass: `s-input-fill`,
|
|
13
|
-
modifiers: {
|
|
14
|
-
global: ["order-first", "order-last"],
|
|
15
|
-
},
|
|
16
|
-
children: {
|
|
17
|
-
default: "input fill",
|
|
18
|
-
},
|
|
19
|
-
template,
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,21 +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 template = ({ component, testid }: any) => html`
|
|
7
|
-
<div data-testid="${testid}" class="p8 ws1">${component}</div>
|
|
8
|
-
`;
|
|
9
|
-
|
|
10
|
-
describe("input-fill", () => {
|
|
11
|
-
runVisualTests({
|
|
12
|
-
baseClass: `s-input-fill`,
|
|
13
|
-
modifiers: {
|
|
14
|
-
global: ["order-first", "order-last"],
|
|
15
|
-
},
|
|
16
|
-
children: {
|
|
17
|
-
default: "input fill",
|
|
18
|
-
},
|
|
19
|
-
template,
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
const modifiers = [
|
|
6
|
-
{
|
|
7
|
-
name: "error",
|
|
8
|
-
parentClasses: "has-error",
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
name: "success",
|
|
12
|
-
parentClasses: "has-success",
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
name: "warning",
|
|
16
|
-
parentClasses: "has-warning",
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: "disabled",
|
|
20
|
-
parentClasses: "is-disabled",
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: "readonly",
|
|
24
|
-
parentClasses: "is-readonly",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: "creditcard",
|
|
28
|
-
modifier: "creditcard",
|
|
29
|
-
inputClasses: "s-input__creditcard",
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: "search",
|
|
33
|
-
modifier: "search",
|
|
34
|
-
inputClasses: "s-input__search",
|
|
35
|
-
},
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
const getSvgPath = (name: string) => {
|
|
39
|
-
switch (name) {
|
|
40
|
-
case "creditcard":
|
|
41
|
-
return '<path d="M3 3h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2Zm0 6v4h12V9H3Zm0-3h12V5H3v1Z"></path>';
|
|
42
|
-
case "search":
|
|
43
|
-
return '<path d="m18 16.5-5.14-5.18h-.35a7 7 0 1 0-1.19 1.19v.35L16.5 18l1.5-1.5ZM12 7A5 5 0 1 1 2 7a5 5 0 0 1 10 0Z"></path>';
|
|
44
|
-
default:
|
|
45
|
-
return '<path d="M9.06 3C4 3 1 9 1 9s3 6 8.06 6C14 15 17 9 17 9s-3-6-7.94-6ZM9 13a4 4 0 1 1 0-8 4 4 0 0 1 0 8Zm0-2a2 2 0 0 0 2-2 2 2 0 0 0-2-2 2 2 0 0 0-2 2 2 2 0 0 0 2 2Z"></path>'; // eye icon path
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
describe("input-icon", () => {
|
|
50
|
-
modifiers.forEach(({ name, parentClasses, modifier }) => {
|
|
51
|
-
runA11yTests({
|
|
52
|
-
baseClass: `s-input-icon`,
|
|
53
|
-
tag: "svg",
|
|
54
|
-
children: {
|
|
55
|
-
[name]: getSvgPath(name), // IconSearch
|
|
56
|
-
},
|
|
57
|
-
modifiers: {
|
|
58
|
-
standalone: modifier ? [`${modifier}`] : [],
|
|
59
|
-
global: parentClasses ? [`parent-${parentClasses}`] : [],
|
|
60
|
-
},
|
|
61
|
-
attributes: {
|
|
62
|
-
"aria-hidden": "true",
|
|
63
|
-
"width": "18",
|
|
64
|
-
"height": "18",
|
|
65
|
-
"viewBox": "0 0 18 18",
|
|
66
|
-
},
|
|
67
|
-
template: ({ component, testid }) => html`
|
|
68
|
-
<div
|
|
69
|
-
data-testid="${testid}"
|
|
70
|
-
class="d-flex fd-column g4 fc-black ps-relative wmx2 p8 ${parentClasses ??
|
|
71
|
-
""}"
|
|
72
|
-
>
|
|
73
|
-
<div class="d-flex ps-relative svg-icon">${component}</div>
|
|
74
|
-
</div>
|
|
75
|
-
`,
|
|
76
|
-
options: {
|
|
77
|
-
includeNullModifier: false,
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
});
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
const modifiers = [
|
|
6
|
-
{
|
|
7
|
-
name: "error",
|
|
8
|
-
parentClasses: "has-error",
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
name: "success",
|
|
12
|
-
parentClasses: "has-success",
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
name: "warning",
|
|
16
|
-
parentClasses: "has-warning",
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
name: "disabled",
|
|
20
|
-
parentClasses: "is-disabled",
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: "readonly",
|
|
24
|
-
parentClasses: "is-readonly",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
name: "creditcard",
|
|
28
|
-
modifier: "creditcard",
|
|
29
|
-
inputClasses: "s-input__creditcard",
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: "search",
|
|
33
|
-
modifier: "search",
|
|
34
|
-
inputClasses: "s-input__search",
|
|
35
|
-
},
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
const getSvgPath = (name: string) => {
|
|
39
|
-
switch (name) {
|
|
40
|
-
case "creditcard":
|
|
41
|
-
return '<path d="M3 3h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2Zm0 6v4h12V9H3Zm0-3h12V5H3v1Z"></path>';
|
|
42
|
-
case "search":
|
|
43
|
-
return '<path d="m18 16.5-5.14-5.18h-.35a7 7 0 1 0-1.19 1.19v.35L16.5 18l1.5-1.5ZM12 7A5 5 0 1 1 2 7a5 5 0 0 1 10 0Z"></path>';
|
|
44
|
-
default:
|
|
45
|
-
return '<path d="M9.06 3C4 3 1 9 1 9s3 6 8.06 6C14 15 17 9 17 9s-3-6-7.94-6ZM9 13a4 4 0 1 1 0-8 4 4 0 0 1 0 8Zm0-2a2 2 0 0 0 2-2 2 2 0 0 0-2-2 2 2 0 0 0-2 2 2 2 0 0 0 2 2Z"></path>'; // eye icon path
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
describe("input-icon", () => {
|
|
50
|
-
modifiers.forEach(({ name, parentClasses, modifier, inputClasses }) => {
|
|
51
|
-
runVisualTests({
|
|
52
|
-
baseClass: `s-input-icon`,
|
|
53
|
-
tag: "svg",
|
|
54
|
-
children: {
|
|
55
|
-
[name]: getSvgPath(name), // IconSearch
|
|
56
|
-
},
|
|
57
|
-
modifiers: {
|
|
58
|
-
standalone: modifier ? [`${modifier}`] : [],
|
|
59
|
-
global: parentClasses ? [`parent-${parentClasses}`] : [],
|
|
60
|
-
},
|
|
61
|
-
attributes: {
|
|
62
|
-
"aria-hidden": "true",
|
|
63
|
-
"width": "18",
|
|
64
|
-
"height": "18",
|
|
65
|
-
"viewBox": "0 0 18 18",
|
|
66
|
-
},
|
|
67
|
-
template: ({ component, testid }) => html`
|
|
68
|
-
<div
|
|
69
|
-
data-testid="${testid}"
|
|
70
|
-
class="d-flex fd-column g4 fc-black ps-relative wmx2 p8 ${parentClasses ??
|
|
71
|
-
""}"
|
|
72
|
-
>
|
|
73
|
-
<label class="s-label v-visible-sr" for="ex-input"
|
|
74
|
-
>Input</label
|
|
75
|
-
>
|
|
76
|
-
<div class="d-flex ps-relative svg-icon">
|
|
77
|
-
<input
|
|
78
|
-
id="ex-input"
|
|
79
|
-
type="text"
|
|
80
|
-
class="s-input ${inputClasses ?? ""}"
|
|
81
|
-
placeholder="${name} input…"
|
|
82
|
-
/>
|
|
83
|
-
${component}
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
`,
|
|
87
|
-
options: {
|
|
88
|
-
includeNullModifier: false,
|
|
89
|
-
},
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
const states = [
|
|
6
|
-
{
|
|
7
|
-
class: "",
|
|
8
|
-
children:
|
|
9
|
-
'This is a stateless input message. <a href="">Learn more</a>.',
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
class: "has-error",
|
|
13
|
-
children: 'This is an error input message. <a href="">Learn more</a>.',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
class: "has-success",
|
|
17
|
-
children: 'This is a success input message. <a href="">Learn more</a>.',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
class: "has-warning",
|
|
21
|
-
children: 'This is a warning input message. <a href="">Learn more</a>.',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
class: "disabled",
|
|
25
|
-
children: "This is a disabled input message.",
|
|
26
|
-
},
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
describe("input-message", () => {
|
|
30
|
-
states.forEach((state) => {
|
|
31
|
-
runA11yTests({
|
|
32
|
-
baseClass: `s-input-message ${
|
|
33
|
-
state.class ? `state-${state.class}` : ""
|
|
34
|
-
}`,
|
|
35
|
-
children: {
|
|
36
|
-
default: state.children,
|
|
37
|
-
},
|
|
38
|
-
template: ({ component, testid }) => {
|
|
39
|
-
const isDisabled = state.class === "disabled";
|
|
40
|
-
const stateClass =
|
|
41
|
-
state.class && state.class !== "disabled"
|
|
42
|
-
? state.class
|
|
43
|
-
: "";
|
|
44
|
-
|
|
45
|
-
return html`
|
|
46
|
-
<fieldset
|
|
47
|
-
data-testid="${testid}"
|
|
48
|
-
class="${stateClass}"
|
|
49
|
-
?disabled="${isDisabled}"
|
|
50
|
-
>
|
|
51
|
-
${component}
|
|
52
|
-
</fieldset>
|
|
53
|
-
`;
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
const states = [
|
|
6
|
-
{
|
|
7
|
-
class: "",
|
|
8
|
-
children:
|
|
9
|
-
'This is a stateless input message. <a href="">Learn more</a>.',
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
class: "has-error",
|
|
13
|
-
children: 'This is an error input message. <a href="">Learn more</a>.',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
class: "has-success",
|
|
17
|
-
children: 'This is a success input message. <a href="">Learn more</a>.',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
class: "has-warning",
|
|
21
|
-
children: 'This is a warning input message. <a href="">Learn more</a>.',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
class: "disabled",
|
|
25
|
-
children:
|
|
26
|
-
'This is a disabled input message. <a href="">Learn more</a>.',
|
|
27
|
-
},
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
describe("input-message", () => {
|
|
31
|
-
states.forEach((state) => {
|
|
32
|
-
runVisualTests({
|
|
33
|
-
baseClass: `s-input-message ${
|
|
34
|
-
state.class ? `state-${state.class}` : ""
|
|
35
|
-
}`,
|
|
36
|
-
children: {
|
|
37
|
-
default: state.children,
|
|
38
|
-
},
|
|
39
|
-
template: ({ component, testid }) => {
|
|
40
|
-
const isDisabled = state.class === "disabled";
|
|
41
|
-
const stateClass =
|
|
42
|
-
state.class && state.class !== "disabled"
|
|
43
|
-
? state.class
|
|
44
|
-
: "";
|
|
45
|
-
|
|
46
|
-
return html`
|
|
47
|
-
<fieldset
|
|
48
|
-
data-testid="${testid}"
|
|
49
|
-
class="p8 ws3 ${stateClass}"
|
|
50
|
-
?disabled="${isDisabled}"
|
|
51
|
-
>
|
|
52
|
-
${component}
|
|
53
|
-
</fieldset>
|
|
54
|
-
`;
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
});
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
// TODO note: all accessibility tests here are skipped currently. Revisit in Stacks v2
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
-
const template = ({ component, testid, classes = "", icon }: any) => html`
|
|
9
|
-
<div data-testid="${testid}" class="p8 ws4 ${classes}">
|
|
10
|
-
<label for="default-id">Label</label>
|
|
11
|
-
${component}${icon}
|
|
12
|
-
</div>
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
const customAttributes = [
|
|
16
|
-
{
|
|
17
|
-
placeholder: "Enter your text here",
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
readonly: "",
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
disabled: "",
|
|
24
|
-
},
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
const states = ["has-error", "has-warning", "has-success"];
|
|
28
|
-
const sizes = ["sm", "md", "lg", "xl"];
|
|
29
|
-
const otherModifiers = ["creditcard", "search"];
|
|
30
|
-
|
|
31
|
-
["input", "textarea"].map((type) => {
|
|
32
|
-
const children =
|
|
33
|
-
type === "textarea" ? { default: "Enter your text here" } : undefined;
|
|
34
|
-
|
|
35
|
-
describe(type, () => {
|
|
36
|
-
// Base styles w/ value, modifiers
|
|
37
|
-
runA11yTests({
|
|
38
|
-
baseClass: `s-${type}`,
|
|
39
|
-
modifiers: {
|
|
40
|
-
primary: [...sizes, ...otherModifiers],
|
|
41
|
-
},
|
|
42
|
-
tag: type,
|
|
43
|
-
attributes:
|
|
44
|
-
type === "input"
|
|
45
|
-
? {
|
|
46
|
-
type: "text",
|
|
47
|
-
value: "Text input value",
|
|
48
|
-
id: `default-id`,
|
|
49
|
-
}
|
|
50
|
-
: {
|
|
51
|
-
id: `default-id`,
|
|
52
|
-
},
|
|
53
|
-
children,
|
|
54
|
-
template,
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
// Base styles w/o value; w/ readonly attr; w/ disabled attr
|
|
58
|
-
customAttributes.forEach((attributes) => {
|
|
59
|
-
const attrString = Object.keys(attributes).sort().join("-");
|
|
60
|
-
|
|
61
|
-
runA11yTests({
|
|
62
|
-
baseClass: `s-${type} ${attrString}`,
|
|
63
|
-
tag: type,
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
65
|
-
// @ts-ignore
|
|
66
|
-
attributes:
|
|
67
|
-
type === "input"
|
|
68
|
-
? {
|
|
69
|
-
type: "text",
|
|
70
|
-
value: attributes.placeholder
|
|
71
|
-
? null
|
|
72
|
-
: "Text input value",
|
|
73
|
-
id: `default-id`,
|
|
74
|
-
...attributes,
|
|
75
|
-
}
|
|
76
|
-
: {
|
|
77
|
-
id: `default-id`,
|
|
78
|
-
...attributes,
|
|
79
|
-
},
|
|
80
|
-
children,
|
|
81
|
-
template,
|
|
82
|
-
// TODO revisit these skipped test ids
|
|
83
|
-
skippedTestids: [/readonly/],
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
// w/ state classes
|
|
88
|
-
states.forEach((state) => {
|
|
89
|
-
runA11yTests({
|
|
90
|
-
baseClass: `s-${type} state-${state}`,
|
|
91
|
-
tag: type,
|
|
92
|
-
attributes:
|
|
93
|
-
type === "input"
|
|
94
|
-
? {
|
|
95
|
-
type: "text",
|
|
96
|
-
value: "Text input value",
|
|
97
|
-
id: `default-id`,
|
|
98
|
-
}
|
|
99
|
-
: {
|
|
100
|
-
id: "default-id",
|
|
101
|
-
},
|
|
102
|
-
children,
|
|
103
|
-
template: ({ component, testid }) =>
|
|
104
|
-
template({ component, testid, classes: state }),
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
// TODO interaction (focus) states?
|
|
108
|
-
});
|
|
109
|
-
});
|
|
@@ -1,95 +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 template = ({ component, testid, classes = "", icon }: any) => html`
|
|
7
|
-
<div data-testid="${testid}" class="p8 ws4 ${classes}">
|
|
8
|
-
${component}${icon}
|
|
9
|
-
</div>
|
|
10
|
-
`;
|
|
11
|
-
|
|
12
|
-
const customAttributes = [
|
|
13
|
-
{
|
|
14
|
-
placeholder: "Enter your text here",
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
readonly: "",
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
disabled: "",
|
|
21
|
-
},
|
|
22
|
-
] as Record<string, string>[];
|
|
23
|
-
|
|
24
|
-
const states = ["has-error", "has-warning", "has-success", "is-readonly"];
|
|
25
|
-
const sizes = ["sm", "md", "lg", "xl"];
|
|
26
|
-
const otherModifiers = ["creditcard", "search"];
|
|
27
|
-
|
|
28
|
-
["input", "textarea"].map((type) => {
|
|
29
|
-
const children =
|
|
30
|
-
type === "textarea" ? { default: "Enter your text here" } : undefined;
|
|
31
|
-
|
|
32
|
-
describe(type, () => {
|
|
33
|
-
// Base styles w/ value, modifiers
|
|
34
|
-
runVisualTests({
|
|
35
|
-
baseClass: `s-${type}`,
|
|
36
|
-
modifiers: {
|
|
37
|
-
primary: [...sizes, ...otherModifiers],
|
|
38
|
-
},
|
|
39
|
-
tag: type,
|
|
40
|
-
attributes:
|
|
41
|
-
type === "input"
|
|
42
|
-
? {
|
|
43
|
-
type: "text",
|
|
44
|
-
value: "Text input value",
|
|
45
|
-
}
|
|
46
|
-
: {},
|
|
47
|
-
children,
|
|
48
|
-
template,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
// Base styles w/o value; w/ readonly attr; w/ disabled attr
|
|
52
|
-
customAttributes.forEach((attributes) => {
|
|
53
|
-
const attrString = Object.keys(attributes).sort().join("-");
|
|
54
|
-
let attr = attributes;
|
|
55
|
-
if (type === "input") {
|
|
56
|
-
attr = {
|
|
57
|
-
type: "text",
|
|
58
|
-
...attributes,
|
|
59
|
-
};
|
|
60
|
-
if (!attributes.placeholder) {
|
|
61
|
-
attr = {
|
|
62
|
-
value: "Text input value",
|
|
63
|
-
...attr,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
runVisualTests({
|
|
68
|
-
baseClass: `s-${type} ${attrString}`,
|
|
69
|
-
tag: type,
|
|
70
|
-
attributes: attr,
|
|
71
|
-
children,
|
|
72
|
-
template,
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// w/ state classes; .is-readonly
|
|
77
|
-
states.forEach((state) => {
|
|
78
|
-
runVisualTests({
|
|
79
|
-
baseClass: `s-${type} state-${state}`,
|
|
80
|
-
tag: type,
|
|
81
|
-
attributes:
|
|
82
|
-
type === "input"
|
|
83
|
-
? {
|
|
84
|
-
type: "text",
|
|
85
|
-
value: "Text input value",
|
|
86
|
-
}
|
|
87
|
-
: {},
|
|
88
|
-
children,
|
|
89
|
-
template: ({ component, testid }) =>
|
|
90
|
-
template({ component, testid, classes: state }),
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
// TODO interaction (focus) states?
|
|
94
|
-
});
|
|
95
|
-
});
|
|
@@ -1,47 +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 labelTemplate = ({ component, testid }: any) => {
|
|
7
|
-
return html`
|
|
8
|
-
<fieldset data-testid="${testid}" class="p8 ws3">${component}</fieldset>
|
|
9
|
-
`;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
-
const getChildren = (status?: any) => {
|
|
14
|
-
const typeClass =
|
|
15
|
-
status && status !== "base" ? `s-label--status__${status}` : "";
|
|
16
|
-
return `
|
|
17
|
-
Example label
|
|
18
|
-
${
|
|
19
|
-
status
|
|
20
|
-
? `
|
|
21
|
-
<span class="s-label--status ${typeClass}">${
|
|
22
|
-
status ?? "no type"
|
|
23
|
-
}</span>
|
|
24
|
-
`
|
|
25
|
-
: ""
|
|
26
|
-
}
|
|
27
|
-
`;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
describe("label", () => {
|
|
31
|
-
runA11yTests({
|
|
32
|
-
baseClass: `s-label`,
|
|
33
|
-
modifiers: {
|
|
34
|
-
primary: ["sm", "md", "lg", "xl"],
|
|
35
|
-
},
|
|
36
|
-
children: {
|
|
37
|
-
"default": getChildren(),
|
|
38
|
-
"status": getChildren("base"),
|
|
39
|
-
"status-beta": getChildren("beta"),
|
|
40
|
-
"status-new": getChildren("new"),
|
|
41
|
-
"status-required": getChildren("required"),
|
|
42
|
-
},
|
|
43
|
-
tag: "label",
|
|
44
|
-
template: ({ component, testid }) =>
|
|
45
|
-
labelTemplate({ component, testid }),
|
|
46
|
-
});
|
|
47
|
-
});
|