@stackoverflow/stacks 2.0.0 → 2.0.2
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 +83 -83
- package/dist/css/stacks.min.css +1 -1
- package/lib/components/empty-state/empty-state.a11y.test.ts +17 -0
- package/lib/components/empty-state/empty-state.visual.test.ts +17 -0
- package/lib/components/input-fill/input-fill.a11y.test.ts +22 -0
- package/lib/components/input-fill/input-fill.visual.test.ts +22 -0
- package/lib/components/input-message/input-message.a11y.test.ts +58 -0
- package/lib/components/input-message/input-message.visual.test.ts +59 -0
- package/lib/components/progress-bar/progress-bar.a11y.test.ts +200 -0
- package/lib/components/progress-bar/progress-bar.visual.test.ts +199 -0
- package/lib/components/table/table.a11y.test.ts +113 -0
- package/lib/components/table/table.visual.test.ts +105 -0
- package/lib/components/tag/tag.less +24 -16
- package/lib/exports/__snapshots__/color-mixins.less.test.ts.snap +2 -2
- package/lib/exports/__snapshots__/color.less.test.ts.snap +66 -66
- package/lib/exports/color-sets.less +39 -39
- package/lib/test/test-utils.ts +1 -1
- package/package.json +10 -10
- package/lib/test/axe-apca/README.md +0 -53
- package/lib/test/axe-apca/index.ts +0 -3
- package/lib/test/axe-apca/package.wip.json +0 -30
- package/lib/test/axe-apca/src/apca-w3.d.ts +0 -3
- package/lib/test/axe-apca/src/axe-apca.test.ts +0 -231
- package/lib/test/axe-apca/src/axe-apca.ts +0 -220
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { html } from "@open-wc/testing";
|
|
2
|
+
import { SpotEmptyXL } from "@stackoverflow/stacks-icons";
|
|
3
|
+
import { runComponentTests } from "../../test/test-utils";
|
|
4
|
+
import "../../index";
|
|
5
|
+
|
|
6
|
+
describe("empty-state", () => {
|
|
7
|
+
runComponentTests({
|
|
8
|
+
type: "a11y",
|
|
9
|
+
baseClass: "s-empty-state",
|
|
10
|
+
children: {
|
|
11
|
+
default: `${SpotEmptyXL}<p class="mt24"><strong>Hello!</strong> This is a wonderful empty state component.</p>`,
|
|
12
|
+
},
|
|
13
|
+
template: ({ component, testid }) => html`
|
|
14
|
+
<div class="ws3 p16" data-testid="${testid}">${component}</div>
|
|
15
|
+
`,
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { html } from "@open-wc/testing";
|
|
2
|
+
import { SpotEmptyXL } from "@stackoverflow/stacks-icons";
|
|
3
|
+
import { runComponentTests } from "../../test/test-utils";
|
|
4
|
+
import "../../index";
|
|
5
|
+
|
|
6
|
+
describe("empty-state", () => {
|
|
7
|
+
runComponentTests({
|
|
8
|
+
type: "visual",
|
|
9
|
+
baseClass: "s-empty-state",
|
|
10
|
+
children: {
|
|
11
|
+
default: `${SpotEmptyXL}<p class="mt24"><strong>Hello!</strong> This is a wonderful empty state component.</p>`,
|
|
12
|
+
},
|
|
13
|
+
template: ({ component, testid }) => html`
|
|
14
|
+
<div class="ws3 p16" data-testid="${testid}">${component}</div>
|
|
15
|
+
`,
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { html } from "@open-wc/testing";
|
|
2
|
+
import { runComponentTests } from "../../test/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
|
+
runComponentTests({
|
|
12
|
+
type: "a11y",
|
|
13
|
+
baseClass: `s-input-fill`,
|
|
14
|
+
modifiers: {
|
|
15
|
+
global: ["order-first", "order-last"],
|
|
16
|
+
},
|
|
17
|
+
children: {
|
|
18
|
+
default: "input fill",
|
|
19
|
+
},
|
|
20
|
+
template,
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { html } from "@open-wc/testing";
|
|
2
|
+
import { runComponentTests } from "../../test/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
|
+
runComponentTests({
|
|
12
|
+
type: "visual",
|
|
13
|
+
baseClass: `s-input-fill`,
|
|
14
|
+
modifiers: {
|
|
15
|
+
global: ["order-first", "order-last"],
|
|
16
|
+
},
|
|
17
|
+
children: {
|
|
18
|
+
default: "input fill",
|
|
19
|
+
},
|
|
20
|
+
template,
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { html } from "@open-wc/testing";
|
|
2
|
+
import { runComponentTests } from "../../test/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
|
+
runComponentTests({
|
|
32
|
+
type: "a11y",
|
|
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="${stateClass}"
|
|
50
|
+
?disabled="${isDisabled}"
|
|
51
|
+
>
|
|
52
|
+
${component}
|
|
53
|
+
</fieldset>
|
|
54
|
+
`;
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { html } from "@open-wc/testing";
|
|
2
|
+
import { runComponentTests } from "../../test/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
|
+
runComponentTests({
|
|
33
|
+
type: "visual",
|
|
34
|
+
baseClass: `s-input-message ${
|
|
35
|
+
state.class ? `state-${state.class}` : ""
|
|
36
|
+
}`,
|
|
37
|
+
children: {
|
|
38
|
+
default: state.children,
|
|
39
|
+
},
|
|
40
|
+
template: ({ component, testid }) => {
|
|
41
|
+
const isDisabled = state.class === "disabled";
|
|
42
|
+
const stateClass =
|
|
43
|
+
state.class && state.class !== "disabled"
|
|
44
|
+
? state.class
|
|
45
|
+
: "";
|
|
46
|
+
|
|
47
|
+
return html`
|
|
48
|
+
<fieldset
|
|
49
|
+
data-testid="${testid}"
|
|
50
|
+
class="p8 ws3 ${stateClass}"
|
|
51
|
+
?disabled="${isDisabled}"
|
|
52
|
+
>
|
|
53
|
+
${component}
|
|
54
|
+
</fieldset>
|
|
55
|
+
`;
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { html } from "@open-wc/testing";
|
|
2
|
+
import {
|
|
3
|
+
IconAchievementsSm,
|
|
4
|
+
IconCheckmarkSm,
|
|
5
|
+
} from "@stackoverflow/stacks-icons/icons";
|
|
6
|
+
import { defaultOptions, runComponentTests } from "../../test/test-utils";
|
|
7
|
+
import "../../index";
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
const template = ({ component, testid }: any) => html`
|
|
11
|
+
<div class="d-flex ai-center jc-center p8 ws2" data-testid="${testid}">
|
|
12
|
+
${component}
|
|
13
|
+
</div>
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
const steppedItems = [
|
|
17
|
+
{
|
|
18
|
+
complete: true,
|
|
19
|
+
label: "Select plan",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
complete: true,
|
|
23
|
+
label: "Team name",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
active: true,
|
|
27
|
+
label: "Payment",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: "Create account",
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const getChildren = (type: string) => {
|
|
35
|
+
switch (type) {
|
|
36
|
+
case "badge":
|
|
37
|
+
return `<div class="s-progress--label" id="example-label">
|
|
38
|
+
<div class="s-badge--label">Electorate</div>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="s-progress--bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="75" aria-labelledby="example-label" style="width: 75%;"></div>`;
|
|
41
|
+
case "circular":
|
|
42
|
+
return `<svg class="s-progress-bar" role="progressbar" viewbox="0 0 32 32" aria-valuemin="0" aria-valuemax="100" aria-valuenow="75">
|
|
43
|
+
<circle cx="16" cy="16" r="14"></circle>
|
|
44
|
+
<circle cx="16" cy="16" r="14"></circle>
|
|
45
|
+
</svg>`;
|
|
46
|
+
case "privilege":
|
|
47
|
+
return `
|
|
48
|
+
<div class="s-progress--label" id="progress-label">
|
|
49
|
+
${IconAchievementsSm}
|
|
50
|
+
Access Review Queues
|
|
51
|
+
</div>
|
|
52
|
+
<div class="s-progress--bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="75" aria-labelledby="progress-label" style="width: 75%;"></div>
|
|
53
|
+
`;
|
|
54
|
+
case "segmented":
|
|
55
|
+
return `
|
|
56
|
+
<div class="s-progress--bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="75" aria-label="…" style="width: 75%;"></div>
|
|
57
|
+
<ol class="s-progress--segments">
|
|
58
|
+
<li></li><li></li><li></li>
|
|
59
|
+
</ol>
|
|
60
|
+
`;
|
|
61
|
+
case "stepped":
|
|
62
|
+
return steppedItems
|
|
63
|
+
.map((step, i) => {
|
|
64
|
+
return `
|
|
65
|
+
<div
|
|
66
|
+
class="
|
|
67
|
+
s-progress--step
|
|
68
|
+
${step.active ? "is-active" : ""}
|
|
69
|
+
${step.complete ? "is-complete" : ""}
|
|
70
|
+
"
|
|
71
|
+
>
|
|
72
|
+
<a href="#" class="s-progress--stop">
|
|
73
|
+
${step.complete ? IconCheckmarkSm : ""}
|
|
74
|
+
<span class="v-visible-sr">${step.label} ${
|
|
75
|
+
step.complete ? "complete" : "incomplete"
|
|
76
|
+
}</span>
|
|
77
|
+
</a>
|
|
78
|
+
${
|
|
79
|
+
i > 0
|
|
80
|
+
? '<div class="s-progress--bar s-progress--bar__left"></div>'
|
|
81
|
+
: ""
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
${
|
|
85
|
+
i < steppedItems.length - 1
|
|
86
|
+
? '<div class="s-progress--bar s-progress--bar__right"></div>'
|
|
87
|
+
: ""
|
|
88
|
+
}
|
|
89
|
+
<a class="s-progress--label">${step.label}</a>
|
|
90
|
+
</div>
|
|
91
|
+
`;
|
|
92
|
+
})
|
|
93
|
+
.join("");
|
|
94
|
+
default:
|
|
95
|
+
return `<div class="s-progress--bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="75" aria-label="progress" style="width: 75%"></div>`;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
describe("progress-bar", () => {
|
|
99
|
+
// Base
|
|
100
|
+
runComponentTests({
|
|
101
|
+
type: "a11y",
|
|
102
|
+
baseClass: "s-progress",
|
|
103
|
+
variants: ["brand", "info"],
|
|
104
|
+
children: {
|
|
105
|
+
default: getChildren(""),
|
|
106
|
+
},
|
|
107
|
+
template,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Badge
|
|
111
|
+
runComponentTests({
|
|
112
|
+
type: "a11y",
|
|
113
|
+
baseClass: "s-progress",
|
|
114
|
+
variants: ["badge"],
|
|
115
|
+
modifiers: {
|
|
116
|
+
primary: ["gold", "silver", "bronze"],
|
|
117
|
+
},
|
|
118
|
+
children: {
|
|
119
|
+
default: getChildren("badge"),
|
|
120
|
+
},
|
|
121
|
+
template,
|
|
122
|
+
options: {
|
|
123
|
+
...defaultOptions,
|
|
124
|
+
includeNullVariant: false,
|
|
125
|
+
includeNullModifier: false,
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// Circular
|
|
130
|
+
runComponentTests({
|
|
131
|
+
type: "a11y",
|
|
132
|
+
baseClass: "s-progress",
|
|
133
|
+
variants: ["circular"],
|
|
134
|
+
modifiers: {
|
|
135
|
+
global: ["fc-green-400", "fc-theme-primary"],
|
|
136
|
+
},
|
|
137
|
+
children: {
|
|
138
|
+
default: getChildren("circular"),
|
|
139
|
+
},
|
|
140
|
+
template,
|
|
141
|
+
attributes: {
|
|
142
|
+
style: "--s-progress-value: .75",
|
|
143
|
+
},
|
|
144
|
+
options: {
|
|
145
|
+
...defaultOptions,
|
|
146
|
+
includeNullVariant: false,
|
|
147
|
+
includeNullModifier: false,
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// Privilege
|
|
152
|
+
runComponentTests({
|
|
153
|
+
type: "a11y",
|
|
154
|
+
baseClass: "s-progress",
|
|
155
|
+
variants: ["privilege"],
|
|
156
|
+
children: {
|
|
157
|
+
default: getChildren("privilege"),
|
|
158
|
+
},
|
|
159
|
+
template,
|
|
160
|
+
options: {
|
|
161
|
+
...defaultOptions,
|
|
162
|
+
includeNullVariant: false,
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// Segmented
|
|
167
|
+
runComponentTests({
|
|
168
|
+
type: "a11y",
|
|
169
|
+
baseClass: "s-progress",
|
|
170
|
+
variants: ["segmented"],
|
|
171
|
+
children: {
|
|
172
|
+
default: getChildren("segmented"),
|
|
173
|
+
},
|
|
174
|
+
template,
|
|
175
|
+
options: {
|
|
176
|
+
...defaultOptions,
|
|
177
|
+
includeNullVariant: false,
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// Stepped
|
|
182
|
+
runComponentTests({
|
|
183
|
+
type: "a11y",
|
|
184
|
+
baseClass: "s-progress",
|
|
185
|
+
variants: ["stepped"],
|
|
186
|
+
children: {
|
|
187
|
+
default: getChildren("stepped"),
|
|
188
|
+
},
|
|
189
|
+
template: ({ component, testid }) => html`
|
|
190
|
+
<div class="d-block p8 ws5" data-testid="${testid}">
|
|
191
|
+
${component}
|
|
192
|
+
</div>
|
|
193
|
+
`,
|
|
194
|
+
options: {
|
|
195
|
+
...defaultOptions,
|
|
196
|
+
includeNullVariant: false,
|
|
197
|
+
},
|
|
198
|
+
// TODO add skipped test ids
|
|
199
|
+
});
|
|
200
|
+
});
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { html } from "@open-wc/testing";
|
|
2
|
+
import {
|
|
3
|
+
IconAchievementsSm,
|
|
4
|
+
IconCheckmarkSm,
|
|
5
|
+
} from "@stackoverflow/stacks-icons/icons";
|
|
6
|
+
import { defaultOptions, runComponentTests } from "../../test/test-utils";
|
|
7
|
+
import "../../index";
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
const template = ({ component, testid }: any) => html`
|
|
11
|
+
<div class="d-flex ai-center jc-center p8 ws2" data-testid="${testid}">
|
|
12
|
+
${component}
|
|
13
|
+
</div>
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
const steppedItems = [
|
|
17
|
+
{
|
|
18
|
+
complete: true,
|
|
19
|
+
label: "Select plan",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
complete: true,
|
|
23
|
+
label: "Team name",
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
active: true,
|
|
27
|
+
label: "Payment",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: "Create account",
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const getChildren = (type: string) => {
|
|
35
|
+
switch (type) {
|
|
36
|
+
case "badge":
|
|
37
|
+
return `<div class="s-progress--label" id="example-label">
|
|
38
|
+
<div class="s-badge--label">Electorate</div>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="s-progress--bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="75" aria-labelledby="example-label" style="width: 75%;"></div>`;
|
|
41
|
+
case "circular":
|
|
42
|
+
return `<svg class="s-progress-bar" role="progressbar" viewbox="0 0 32 32" aria-valuemin="0" aria-valuemax="100" aria-valuenow="75">
|
|
43
|
+
<circle cx="16" cy="16" r="14"></circle>
|
|
44
|
+
<circle cx="16" cy="16" r="14"></circle>
|
|
45
|
+
</svg>`;
|
|
46
|
+
case "privilege":
|
|
47
|
+
return `
|
|
48
|
+
<div class="s-progress--label" id="progress-label">
|
|
49
|
+
${IconAchievementsSm}
|
|
50
|
+
Access Review Queues
|
|
51
|
+
</div>
|
|
52
|
+
<div class="s-progress--bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="75" aria-labelledby="progress-label" style="width: 75%;"></div>
|
|
53
|
+
`;
|
|
54
|
+
case "segmented":
|
|
55
|
+
return `
|
|
56
|
+
<div class="s-progress--bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="75" aria-label="…" style="width: 75%;"></div>
|
|
57
|
+
<ol class="s-progress--segments">
|
|
58
|
+
<li></li><li></li><li></li>
|
|
59
|
+
</ol>
|
|
60
|
+
`;
|
|
61
|
+
case "stepped":
|
|
62
|
+
return steppedItems
|
|
63
|
+
.map((step, i) => {
|
|
64
|
+
return `
|
|
65
|
+
<div
|
|
66
|
+
class="
|
|
67
|
+
s-progress--step
|
|
68
|
+
${step.active ? "is-active" : ""}
|
|
69
|
+
${step.complete ? "is-complete" : ""}
|
|
70
|
+
"
|
|
71
|
+
>
|
|
72
|
+
<a href="#" class="s-progress--stop">
|
|
73
|
+
${step.complete ? IconCheckmarkSm : ""}
|
|
74
|
+
<span class="v-visible-sr">${step.label} ${
|
|
75
|
+
step.complete ? "complete" : "incomplete"
|
|
76
|
+
}</span>
|
|
77
|
+
</a>
|
|
78
|
+
${
|
|
79
|
+
i > 0
|
|
80
|
+
? '<div class="s-progress--bar s-progress--bar__left"></div>'
|
|
81
|
+
: ""
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
${
|
|
85
|
+
i < steppedItems.length - 1
|
|
86
|
+
? '<div class="s-progress--bar s-progress--bar__right"></div>'
|
|
87
|
+
: ""
|
|
88
|
+
}
|
|
89
|
+
<a class="s-progress--label">${step.label}</a>
|
|
90
|
+
</div>
|
|
91
|
+
`;
|
|
92
|
+
})
|
|
93
|
+
.join("");
|
|
94
|
+
default:
|
|
95
|
+
return `<div class="s-progress--bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="75" aria-label="progress" style="width: 75%"></div>`;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
describe("progress-bar", () => {
|
|
99
|
+
// Base
|
|
100
|
+
runComponentTests({
|
|
101
|
+
type: "visual",
|
|
102
|
+
baseClass: "s-progress",
|
|
103
|
+
variants: ["brand", "info"],
|
|
104
|
+
children: {
|
|
105
|
+
default: getChildren(""),
|
|
106
|
+
},
|
|
107
|
+
template,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Badge
|
|
111
|
+
runComponentTests({
|
|
112
|
+
type: "visual",
|
|
113
|
+
baseClass: "s-progress",
|
|
114
|
+
variants: ["badge"],
|
|
115
|
+
modifiers: {
|
|
116
|
+
primary: ["gold", "silver", "bronze"],
|
|
117
|
+
},
|
|
118
|
+
children: {
|
|
119
|
+
default: getChildren("badge"),
|
|
120
|
+
},
|
|
121
|
+
template,
|
|
122
|
+
options: {
|
|
123
|
+
...defaultOptions,
|
|
124
|
+
includeNullVariant: false,
|
|
125
|
+
includeNullModifier: false,
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
// Circular
|
|
130
|
+
runComponentTests({
|
|
131
|
+
type: "visual",
|
|
132
|
+
baseClass: "s-progress",
|
|
133
|
+
variants: ["circular"],
|
|
134
|
+
modifiers: {
|
|
135
|
+
global: ["fc-green-400", "fc-theme-primary"],
|
|
136
|
+
},
|
|
137
|
+
children: {
|
|
138
|
+
default: getChildren("circular"),
|
|
139
|
+
},
|
|
140
|
+
template,
|
|
141
|
+
attributes: {
|
|
142
|
+
style: "--s-progress-value: .75",
|
|
143
|
+
},
|
|
144
|
+
options: {
|
|
145
|
+
...defaultOptions,
|
|
146
|
+
includeNullVariant: false,
|
|
147
|
+
includeNullModifier: false,
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// Privilege
|
|
152
|
+
runComponentTests({
|
|
153
|
+
type: "visual",
|
|
154
|
+
baseClass: "s-progress",
|
|
155
|
+
variants: ["privilege"],
|
|
156
|
+
children: {
|
|
157
|
+
default: getChildren("privilege"),
|
|
158
|
+
},
|
|
159
|
+
template,
|
|
160
|
+
options: {
|
|
161
|
+
...defaultOptions,
|
|
162
|
+
includeNullVariant: false,
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// Segmented
|
|
167
|
+
runComponentTests({
|
|
168
|
+
type: "visual",
|
|
169
|
+
baseClass: "s-progress",
|
|
170
|
+
variants: ["segmented"],
|
|
171
|
+
children: {
|
|
172
|
+
default: getChildren("segmented"),
|
|
173
|
+
},
|
|
174
|
+
template,
|
|
175
|
+
options: {
|
|
176
|
+
...defaultOptions,
|
|
177
|
+
includeNullVariant: false,
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// Stepped
|
|
182
|
+
runComponentTests({
|
|
183
|
+
type: "visual",
|
|
184
|
+
baseClass: "s-progress",
|
|
185
|
+
variants: ["stepped"],
|
|
186
|
+
children: {
|
|
187
|
+
default: getChildren("stepped"),
|
|
188
|
+
},
|
|
189
|
+
template: ({ component, testid }) => html`
|
|
190
|
+
<div class="d-block p8 ws5" data-testid="${testid}">
|
|
191
|
+
${component}
|
|
192
|
+
</div>
|
|
193
|
+
`,
|
|
194
|
+
options: {
|
|
195
|
+
...defaultOptions,
|
|
196
|
+
includeNullVariant: false,
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
});
|