@stackoverflow/stacks 2.4.0 → 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 +12 -58
- package/dist/css/stacks.min.css +1 -1
- package/lib/components/tag/tag.less +16 -68
- 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,56 +0,0 @@
|
|
|
1
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
2
|
-
import "../../index";
|
|
3
|
-
|
|
4
|
-
type CheckGroup = "checkbox" | "radio";
|
|
5
|
-
const checkTypes: CheckGroup[] = ["checkbox", "radio"];
|
|
6
|
-
|
|
7
|
-
// Account for horizontal variant
|
|
8
|
-
[true, false].forEach((isHorizontal) => {
|
|
9
|
-
checkTypes.forEach((type) => {
|
|
10
|
-
describe("s-check-group", () => {
|
|
11
|
-
const checkEls: {
|
|
12
|
-
type: CheckGroup;
|
|
13
|
-
id: string;
|
|
14
|
-
state?: "checked" | "unchecked" | "indeterminate";
|
|
15
|
-
}[] = [
|
|
16
|
-
{ type, id: `test-${type}1`, state: "checked" },
|
|
17
|
-
{ type, id: `test-${type}2` },
|
|
18
|
-
];
|
|
19
|
-
runVisualTests({
|
|
20
|
-
tag: "fieldset",
|
|
21
|
-
baseClass: "s-check-group",
|
|
22
|
-
attributes: {
|
|
23
|
-
class: isHorizontal ? "hs1 ws3 p8" : "hs2 ws2 p8",
|
|
24
|
-
},
|
|
25
|
-
variants: isHorizontal ? ["horizontal"] : [],
|
|
26
|
-
children: {
|
|
27
|
-
default: `
|
|
28
|
-
<legend class="s-label">${type} group</legend>
|
|
29
|
-
${checkEls
|
|
30
|
-
.map(
|
|
31
|
-
({ type, state, id }, index) => `
|
|
32
|
-
<div class="s-check-control">
|
|
33
|
-
<input
|
|
34
|
-
class="s-${type}"
|
|
35
|
-
type="${type}"
|
|
36
|
-
id="${id}-${index}"
|
|
37
|
-
name=""
|
|
38
|
-
${state === "checked" ? "checked" : ""}/>
|
|
39
|
-
<label class="s-label" for="${id}-${index}">
|
|
40
|
-
${type} label ${index}
|
|
41
|
-
<p class="s-input-message">Description</p>
|
|
42
|
-
</label>
|
|
43
|
-
</div>
|
|
44
|
-
`
|
|
45
|
-
)
|
|
46
|
-
.join("")}
|
|
47
|
-
`,
|
|
48
|
-
},
|
|
49
|
-
options: {
|
|
50
|
-
includeNullVariant: !isHorizontal,
|
|
51
|
-
testidSuffix: type,
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
});
|
|
@@ -1,37 +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 checkboxTemplate = ({ component, testid, id }: any) =>
|
|
7
|
-
html` <div class="s-check-control" data-testid="${testid}">
|
|
8
|
-
${component}
|
|
9
|
-
<label class="s-label" for="${id}">Label</label>
|
|
10
|
-
</div>`;
|
|
11
|
-
|
|
12
|
-
["checkbox", "radio"].forEach((type) => {
|
|
13
|
-
describe(type, () => {
|
|
14
|
-
// TODO include indeterminate
|
|
15
|
-
["checked", "unchecked"].forEach((state) => {
|
|
16
|
-
runA11yTests({
|
|
17
|
-
tag: "input",
|
|
18
|
-
baseClass: `s-${type}`,
|
|
19
|
-
attributes: {
|
|
20
|
-
name: "test-name",
|
|
21
|
-
id: "test-id",
|
|
22
|
-
type,
|
|
23
|
-
...(state === "checked" ? { checked: "checked" } : {}),
|
|
24
|
-
},
|
|
25
|
-
template: ({ component, testid }) =>
|
|
26
|
-
checkboxTemplate({
|
|
27
|
-
component,
|
|
28
|
-
testid,
|
|
29
|
-
id: "test-id",
|
|
30
|
-
}),
|
|
31
|
-
options: {
|
|
32
|
-
testidSuffix: state,
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1,33 +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 checkboxTemplate = ({ component, testid }: any) =>
|
|
7
|
-
html`<div
|
|
8
|
-
class="d-inline-flex ai-center jc-center bg-black-225 hs1 ws1 p8"
|
|
9
|
-
data-testid="${testid}"
|
|
10
|
-
>
|
|
11
|
-
${component}
|
|
12
|
-
</div>`;
|
|
13
|
-
|
|
14
|
-
["checkbox", "radio"].forEach((type) => {
|
|
15
|
-
describe(type, () => {
|
|
16
|
-
// TODO include indeterminate
|
|
17
|
-
["checked", "unchecked"].forEach((state) => {
|
|
18
|
-
runVisualTests({
|
|
19
|
-
tag: "input",
|
|
20
|
-
baseClass: `s-${type}`,
|
|
21
|
-
attributes: {
|
|
22
|
-
type,
|
|
23
|
-
...(state === "checked" ? { checked: "checked" } : {}),
|
|
24
|
-
},
|
|
25
|
-
template: ({ component, testid }) =>
|
|
26
|
-
checkboxTemplate({ component, testid }),
|
|
27
|
-
options: {
|
|
28
|
-
testidSuffix: state,
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
2
|
-
import highlightedFixtures from "./code-block.fixtures";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("code block", () => {
|
|
6
|
-
Object.keys(highlightedFixtures).forEach((language) => {
|
|
7
|
-
runA11yTests({
|
|
8
|
-
tag: "pre",
|
|
9
|
-
baseClass: `s-code-block language-${language}`,
|
|
10
|
-
children: {
|
|
11
|
-
default: highlightedFixtures[language],
|
|
12
|
-
},
|
|
13
|
-
options: {
|
|
14
|
-
includeNullModifier: false,
|
|
15
|
-
},
|
|
16
|
-
attributes: {
|
|
17
|
-
tabindex: "0",
|
|
18
|
-
},
|
|
19
|
-
// TODO revisit these skipped test ids
|
|
20
|
-
skippedTestids: [
|
|
21
|
-
/s-code-block-language-(html|css|javascript)-dark/,
|
|
22
|
-
/s-code-block-language-html-highcontrast-(light|dark)/,
|
|
23
|
-
"s-code-block-language-javascript-highcontrast-light",
|
|
24
|
-
],
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
2
|
-
import highlightedFixtures from "./code-block.fixtures";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("code block", () => {
|
|
6
|
-
Object.keys(highlightedFixtures).forEach((language) => {
|
|
7
|
-
runVisualTests({
|
|
8
|
-
tag: "pre",
|
|
9
|
-
baseClass: `s-code-block language-${language}`,
|
|
10
|
-
children: {
|
|
11
|
-
default: highlightedFixtures[language],
|
|
12
|
-
},
|
|
13
|
-
options: {
|
|
14
|
-
includeNullModifier: false,
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
// account for parent with `.is-disabled` class
|
|
6
|
-
[true, false].forEach((isDisabled) => {
|
|
7
|
-
describe("description", () => {
|
|
8
|
-
runA11yTests({
|
|
9
|
-
tag: "p",
|
|
10
|
-
baseClass: "s-description",
|
|
11
|
-
children: {
|
|
12
|
-
default: `Describes the site in the product, emails, integrations, and logs.`,
|
|
13
|
-
},
|
|
14
|
-
options: {
|
|
15
|
-
testidSuffix: isDisabled ? "is-disabled" : "",
|
|
16
|
-
},
|
|
17
|
-
template: ({ component, testid }) => html`
|
|
18
|
-
<div
|
|
19
|
-
class="${isDisabled ? "is-disabled" : ""}"
|
|
20
|
-
data-testid="${testid}"
|
|
21
|
-
>
|
|
22
|
-
${component}
|
|
23
|
-
</div>
|
|
24
|
-
`,
|
|
25
|
-
skippedTestids: [/is-disabled/],
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
// account for parent with `.is-disabled` class
|
|
6
|
-
[true, false].forEach((isDisabled) => {
|
|
7
|
-
describe("description", () => {
|
|
8
|
-
runVisualTests({
|
|
9
|
-
tag: "p",
|
|
10
|
-
baseClass: "s-description",
|
|
11
|
-
children: {
|
|
12
|
-
default: `Describes the site in the product, emails, integrations, and logs.`,
|
|
13
|
-
},
|
|
14
|
-
options: {
|
|
15
|
-
testidSuffix: isDisabled ? "is-disabled" : "",
|
|
16
|
-
},
|
|
17
|
-
template: ({ component, testid }) => html`
|
|
18
|
-
<div
|
|
19
|
-
class="bg-black-225 d-inline-flex ai-center jc-center hs1 ws2 p8
|
|
20
|
-
${isDisabled ? "is-disabled" : ""}"
|
|
21
|
-
data-testid="${testid}"
|
|
22
|
-
>
|
|
23
|
-
${component}
|
|
24
|
-
</div>
|
|
25
|
-
`,
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { SpotEmptyXL } from "@stackoverflow/stacks-icons";
|
|
3
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
4
|
-
import "../../index";
|
|
5
|
-
|
|
6
|
-
describe("empty-state", () => {
|
|
7
|
-
runA11yTests({
|
|
8
|
-
baseClass: "s-empty-state",
|
|
9
|
-
children: {
|
|
10
|
-
default: `${SpotEmptyXL}<p class="mt24"><strong>Hello!</strong> This is a wonderful empty state component.</p>`,
|
|
11
|
-
},
|
|
12
|
-
template: ({ component, testid }) => html`
|
|
13
|
-
<div class="ws3 p16" data-testid="${testid}">${component}</div>
|
|
14
|
-
`,
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { SpotEmptyXL } from "@stackoverflow/stacks-icons";
|
|
3
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
4
|
-
import "../../index";
|
|
5
|
-
|
|
6
|
-
describe("empty-state", () => {
|
|
7
|
-
runVisualTests({
|
|
8
|
-
baseClass: "s-empty-state",
|
|
9
|
-
children: {
|
|
10
|
-
default: `${SpotEmptyXL}<p class="mt24"><strong>Hello!</strong> This is a wonderful empty state component.</p>`,
|
|
11
|
-
},
|
|
12
|
-
template: ({ component, testid }) => html`
|
|
13
|
-
<div class="ws3 p16" data-testid="${testid}">${component}</div>
|
|
14
|
-
`,
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("expandable", () => {
|
|
6
|
-
runA11yTests({
|
|
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,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
|
-
});
|