@stackoverflow/stacks 2.0.1 → 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 +5 -5
- 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/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/exports/__snapshots__/color-mixins.less.test.ts.snap +2 -2
- package/lib/exports/__snapshots__/color.less.test.ts.snap +4 -4
- package/lib/exports/color-sets.less +4 -4
- package/lib/test/test-utils.ts +1 -1
- package/package.json +7 -7
- 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,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
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
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 class="s-table-container p8" data-testid="${testid}">${component}</div>
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
const rows = [
|
|
11
|
+
{
|
|
12
|
+
displayName: "Sponge",
|
|
13
|
+
fullName: "Bobby Geometrislacks",
|
|
14
|
+
progress: 10,
|
|
15
|
+
active: true,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
displayName: "Patty",
|
|
19
|
+
fullName: "Pat Supernova",
|
|
20
|
+
progress: 50,
|
|
21
|
+
active: true,
|
|
22
|
+
// }, {
|
|
23
|
+
// displayName: "Crustoph",
|
|
24
|
+
// fullName: "Eugene Harold K",
|
|
25
|
+
// progress: 75,
|
|
26
|
+
// active: false, // TODO reintroduce once disabled rows pass contrast requirements
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
displayName: "SCheeks",
|
|
30
|
+
fullName: "Sandra C.",
|
|
31
|
+
progress: 100,
|
|
32
|
+
active: true,
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
const children = {
|
|
37
|
+
default: `
|
|
38
|
+
<thead>
|
|
39
|
+
<tr>
|
|
40
|
+
<th scope="col" class="s-table--bulk">
|
|
41
|
+
<label class="v-visible-sr" for="check">bulk action</label>
|
|
42
|
+
<input type="checkbox" class="s-checkbox" id="check">
|
|
43
|
+
</th>
|
|
44
|
+
<th scope="col">Display Name</th>
|
|
45
|
+
<th scope="col">Full name</th>
|
|
46
|
+
<th scope="col" colspan="2">Progress</th>
|
|
47
|
+
<th scope="col"><span>class="v-visible-sr">Bar</span></th>
|
|
48
|
+
</tr>
|
|
49
|
+
</thead>
|
|
50
|
+
<tbody>
|
|
51
|
+
${rows
|
|
52
|
+
.map(
|
|
53
|
+
(row, i) => `
|
|
54
|
+
<tr class="${row.active ? "" : "is-disabled"}">
|
|
55
|
+
<th scope="row">
|
|
56
|
+
<label class="v-visible-sr" for="check-${i}">bulk</label>
|
|
57
|
+
<input type="checkbox" class="s-checkbox" id="check-${i}">
|
|
58
|
+
</th>
|
|
59
|
+
<td>${row.displayName}</td>
|
|
60
|
+
<td>${row.fullName}</td>
|
|
61
|
+
<td class="s-table--progress">${row.progress}</td>
|
|
62
|
+
<td class="s-table--progress-bar">
|
|
63
|
+
<div class="s-progress bg-white">
|
|
64
|
+
<div class="s-progress--bar bg-blue-400" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${
|
|
65
|
+
row.progress
|
|
66
|
+
}" aria-label="progressbar" style="width: ${
|
|
67
|
+
row.progress
|
|
68
|
+
}%"></div>
|
|
69
|
+
</div>
|
|
70
|
+
</td>
|
|
71
|
+
<td><a class="s-link" href="#">Add</a></td>
|
|
72
|
+
</tr>
|
|
73
|
+
`
|
|
74
|
+
)
|
|
75
|
+
.join("")}
|
|
76
|
+
</tbody>
|
|
77
|
+
<tfoot class="s-table--totals">
|
|
78
|
+
<tr>
|
|
79
|
+
<td scope="row"><span class="v-visible-sr">Empty</span></td>
|
|
80
|
+
<th scope="row" class="ta-left">Totals</th>
|
|
81
|
+
<td><span class="v-visible-sr">Empty</span></td>
|
|
82
|
+
<td colspan="2">160</td>
|
|
83
|
+
<td><span class="v-visible-sr">Empty</span></td>
|
|
84
|
+
</tr>
|
|
85
|
+
</tfoot>
|
|
86
|
+
`,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
describe("table", () => {
|
|
90
|
+
// default, sizes
|
|
91
|
+
runComponentTests({
|
|
92
|
+
type: "a11y",
|
|
93
|
+
baseClass: "s-table",
|
|
94
|
+
variants: ["stripes"],
|
|
95
|
+
modifiers: {
|
|
96
|
+
primary: ["sm", "lg"],
|
|
97
|
+
secondary: ["b0", "bx", "bx-simple", "sortable"],
|
|
98
|
+
// global: ["ta-center", "ta-left", "ta-justify", "ta-right", "va-bottom", "va-middle", "va-top"], // Removing these modifiers *for now* since they create so many test images and would slow testing
|
|
99
|
+
},
|
|
100
|
+
tag: "table",
|
|
101
|
+
children,
|
|
102
|
+
template,
|
|
103
|
+
// TODO resolve HC contrast issues with `.s-table.s-table__sortable thead th` sortable
|
|
104
|
+
skippedTestids: [
|
|
105
|
+
"s-table-highcontrast-light-lg-sortable",
|
|
106
|
+
"s-table-highcontrast-light-sm-sortable",
|
|
107
|
+
"s-table-highcontrast-light-sortable",
|
|
108
|
+
"s-table-highcontrast-light-stripes-lg-sortable",
|
|
109
|
+
"s-table-highcontrast-light-stripes-sm-sortable",
|
|
110
|
+
"s-table-highcontrast-light-stripes-sortable",
|
|
111
|
+
],
|
|
112
|
+
});
|
|
113
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
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 class="s-table-container p8" data-testid="${testid}">${component}</div>
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
const rows = [
|
|
11
|
+
{
|
|
12
|
+
displayName: "Sponge",
|
|
13
|
+
fullName: "Bobby Geometrislacks",
|
|
14
|
+
progress: 10,
|
|
15
|
+
active: true,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
displayName: "Patty",
|
|
19
|
+
fullName: "Pat Supernova",
|
|
20
|
+
progress: 50,
|
|
21
|
+
active: true,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
displayName: "Crustoph",
|
|
25
|
+
fullName: "Eugene Harold K",
|
|
26
|
+
progress: 75,
|
|
27
|
+
active: false,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
displayName: "SCheeks",
|
|
31
|
+
fullName: "Sandra C.",
|
|
32
|
+
progress: 100,
|
|
33
|
+
active: true,
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
const children = {
|
|
38
|
+
default: `
|
|
39
|
+
<thead>
|
|
40
|
+
<tr>
|
|
41
|
+
<th scope="col" class="s-table--bulk">
|
|
42
|
+
<label class="v-visible-sr" for="check">bulk action</label>
|
|
43
|
+
<input type="checkbox" class="s-checkbox" id="check">
|
|
44
|
+
</th>
|
|
45
|
+
<th scope="col">Display Name</th>
|
|
46
|
+
<th scope="col">Full name</th>
|
|
47
|
+
<th scope="col" colspan="2">Progress</th>
|
|
48
|
+
<th scope="col"><span>class="v-visible-sr">Bar</span></th>
|
|
49
|
+
</tr>
|
|
50
|
+
</thead>
|
|
51
|
+
<tbody>
|
|
52
|
+
${rows
|
|
53
|
+
.map(
|
|
54
|
+
(row, i) => `
|
|
55
|
+
<tr class="${row.active ? "" : "is-disabled"}">
|
|
56
|
+
<th scope="row">
|
|
57
|
+
<label class="v-visible-sr" for="check-${i}">bulk</label>
|
|
58
|
+
<input type="checkbox" class="s-checkbox" id="check-${i}">
|
|
59
|
+
</th>
|
|
60
|
+
<td>${row.displayName}</td>
|
|
61
|
+
<td>${row.fullName}</td>
|
|
62
|
+
<td class="s-table--progress">${row.progress}</td>
|
|
63
|
+
<td class="s-table--progress-bar">
|
|
64
|
+
<div class="s-progress bg-white">
|
|
65
|
+
<div class="s-progress--bar bg-blue-400" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${
|
|
66
|
+
row.progress
|
|
67
|
+
}" aria-label="progressbar" style="width: ${
|
|
68
|
+
row.progress
|
|
69
|
+
}%"></div>
|
|
70
|
+
</div>
|
|
71
|
+
</td>
|
|
72
|
+
<td><a class="s-link" href="#">Add</a></td>
|
|
73
|
+
</tr>
|
|
74
|
+
`
|
|
75
|
+
)
|
|
76
|
+
.join("")}
|
|
77
|
+
</tbody>
|
|
78
|
+
<tfoot class="s-table--totals">
|
|
79
|
+
<tr>
|
|
80
|
+
<td scope="row"><span class="v-visible-sr">Empty</span></td>
|
|
81
|
+
<th scope="row" class="ta-left">Totals</th>
|
|
82
|
+
<td><span class="v-visible-sr">Empty</span></td>
|
|
83
|
+
<td colspan="2">160</td>
|
|
84
|
+
<td><span class="v-visible-sr">Empty</span></td>
|
|
85
|
+
</tr>
|
|
86
|
+
</tfoot>
|
|
87
|
+
`,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
describe("table", () => {
|
|
91
|
+
// default, sizes
|
|
92
|
+
runComponentTests({
|
|
93
|
+
type: "visual",
|
|
94
|
+
baseClass: "s-table",
|
|
95
|
+
variants: ["stripes"],
|
|
96
|
+
modifiers: {
|
|
97
|
+
primary: ["sm", "lg"],
|
|
98
|
+
secondary: ["b0", "bx", "bx-simple", "sortable"],
|
|
99
|
+
// global: ["ta-center", "ta-left", "ta-justify", "ta-right", "va-bottom", "va-middle", "va-top"], // Removing these modifiers *for now* since they create so many test images and would slow testing
|
|
100
|
+
},
|
|
101
|
+
tag: "table",
|
|
102
|
+
children,
|
|
103
|
+
template,
|
|
104
|
+
});
|
|
105
|
+
});
|
|
@@ -316,10 +316,10 @@ body .themed {
|
|
|
316
316
|
--green-600: hsl(148, 75%, 15%);
|
|
317
317
|
--red-100: hsl(0, 72%, 96%);
|
|
318
318
|
--red-200: hsl(0, 70%, 93%);
|
|
319
|
-
--red-300: hsl(0,
|
|
319
|
+
--red-300: hsl(0, 66%, 80%);
|
|
320
320
|
--red-400: hsl(0, 60%, 49%);
|
|
321
321
|
--red-500: hsl(0, 65%, 37%);
|
|
322
|
-
--red-600: hsl(0, 65%,
|
|
322
|
+
--red-600: hsl(0, 65%, 22%);
|
|
323
323
|
--yellow-100: hsl(43, 80%, 96%);
|
|
324
324
|
--yellow-200: hsl(43, 80%, 88%);
|
|
325
325
|
--yellow-300: hsl(43, 85%, 72%);
|