@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,12 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { renderLess } from "../test/less-test-utils";
|
|
3
|
-
|
|
4
|
-
describe("atomic: color", () => {
|
|
5
|
-
it("should output v2 atomic css classes for colors", async () => {
|
|
6
|
-
const css = await renderLess(`
|
|
7
|
-
@import "./lib/atomic/color.less";
|
|
8
|
-
`);
|
|
9
|
-
|
|
10
|
-
expect(css).toMatchSnapshot();
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { renderLess } from "../test/less-test-utils";
|
|
3
|
-
|
|
4
|
-
describe("atomic: misc", () => {
|
|
5
|
-
it("should output all atomic css classes", async () => {
|
|
6
|
-
const css = await renderLess(`
|
|
7
|
-
@import "./lib/atomic/misc.less";
|
|
8
|
-
`);
|
|
9
|
-
|
|
10
|
-
expect(css).toMatchSnapshot();
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { renderLess } from "../test/less-test-utils";
|
|
3
|
-
|
|
4
|
-
describe("atomic: misc", () => {
|
|
5
|
-
it("should output all atomic css classes", async () => {
|
|
6
|
-
const css = await renderLess(`
|
|
7
|
-
@import "./lib/atomic/spacing.less";
|
|
8
|
-
`);
|
|
9
|
-
|
|
10
|
-
expect(css).toMatchSnapshot();
|
|
11
|
-
});
|
|
12
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
2
|
-
import "../../index";
|
|
3
|
-
|
|
4
|
-
describe("activity-indicator", () => {
|
|
5
|
-
runA11yTests({
|
|
6
|
-
baseClass: "s-activity-indicator",
|
|
7
|
-
variants: ["danger", "success", "warning"],
|
|
8
|
-
children: {
|
|
9
|
-
default: `<div class="v-visible-sr">New activity</div>`,
|
|
10
|
-
new: `new<div class="v-visible-sr">New activity</div>`,
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("activity-indicator", () => {
|
|
6
|
-
runVisualTests({
|
|
7
|
-
baseClass: "s-activity-indicator",
|
|
8
|
-
variants: ["danger", "success", "warning"],
|
|
9
|
-
children: {
|
|
10
|
-
default: `<div class="v-visible-sr">New activity</div>`,
|
|
11
|
-
new: `new<div class="v-visible-sr">New activity</div>`,
|
|
12
|
-
},
|
|
13
|
-
template: ({ component, testid }) => html`
|
|
14
|
-
<div
|
|
15
|
-
class="d-inline-flex ai-center jc-center hs1 ws1 p8"
|
|
16
|
-
data-testid="${testid}"
|
|
17
|
-
>
|
|
18
|
-
${component}
|
|
19
|
-
</div>
|
|
20
|
-
`,
|
|
21
|
-
});
|
|
22
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
2
|
-
import "../../index";
|
|
3
|
-
|
|
4
|
-
// TODO check for visited styling
|
|
5
|
-
const link = (text = "", visited = true, classes = "") =>
|
|
6
|
-
`<a class="${classes}" href="${
|
|
7
|
-
visited ? "/" : "https://stackoverflow.design/404-unvisited"
|
|
8
|
-
}">${text}</a>`;
|
|
9
|
-
|
|
10
|
-
describe("anchors", () => {
|
|
11
|
-
runA11yTests({
|
|
12
|
-
baseClass: "s-anchors",
|
|
13
|
-
modifiers: {
|
|
14
|
-
primary: [
|
|
15
|
-
"default",
|
|
16
|
-
"grayscale",
|
|
17
|
-
"muted",
|
|
18
|
-
"danger",
|
|
19
|
-
"inherit",
|
|
20
|
-
"underlined",
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
children: {
|
|
24
|
-
default: `A ${link(
|
|
25
|
-
"link"
|
|
26
|
-
)}, a <button class="s-btn s-btn__link">button</button>, an ${link(
|
|
27
|
-
"unvisited link",
|
|
28
|
-
false
|
|
29
|
-
)}.`,
|
|
30
|
-
},
|
|
31
|
-
options: {
|
|
32
|
-
includeNullModifier: false,
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
// TODO check for visited styling
|
|
6
|
-
const link = (text = "", classes = "") =>
|
|
7
|
-
`<a class="${classes}" href="#">${text}</a>`;
|
|
8
|
-
const links = `A ${link(
|
|
9
|
-
"link"
|
|
10
|
-
)}, a <button class="s-btn s-btn__link">button</button>, an ${link(
|
|
11
|
-
"unvisited link"
|
|
12
|
-
)}.<br/>Nested: ${link("danger", "s-link s-link__danger")}, ${link(
|
|
13
|
-
"grayscale",
|
|
14
|
-
"s-link s-link__grayscale"
|
|
15
|
-
)}.`;
|
|
16
|
-
|
|
17
|
-
describe("anchors", () => {
|
|
18
|
-
runVisualTests({
|
|
19
|
-
baseClass: "s-anchors",
|
|
20
|
-
modifiers: {
|
|
21
|
-
primary: [
|
|
22
|
-
"default",
|
|
23
|
-
"grayscale",
|
|
24
|
-
"muted",
|
|
25
|
-
"danger",
|
|
26
|
-
"inherit",
|
|
27
|
-
"underlined",
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
children: {
|
|
31
|
-
// children include nested anchors block to test for appropriate nested styling
|
|
32
|
-
default: `
|
|
33
|
-
${links}
|
|
34
|
-
<div class="s-card s-anchors s-anchors__danger">Danger: ${links}</div>
|
|
35
|
-
<div class="s-card s-anchors s-anchors__muted mt4">Muted: ${links}</div>
|
|
36
|
-
`,
|
|
37
|
-
},
|
|
38
|
-
options: {
|
|
39
|
-
includeNullModifier: false,
|
|
40
|
-
},
|
|
41
|
-
template: ({ component, testid }) => html`
|
|
42
|
-
<div data-testid="${testid}" class="s-card ws3 fc-green-500">
|
|
43
|
-
${testid}: ${component}
|
|
44
|
-
</div>
|
|
45
|
-
`,
|
|
46
|
-
});
|
|
47
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
2
|
-
import "../../index";
|
|
3
|
-
|
|
4
|
-
const getChild = (child?: string): string => {
|
|
5
|
-
const srEl = `<span class="v-visible-sr">Stack Overflow</span>`;
|
|
6
|
-
switch (child) {
|
|
7
|
-
case "image":
|
|
8
|
-
return `<img
|
|
9
|
-
class="s-avatar--image"
|
|
10
|
-
src="https://picsum.photos/id/1/48"
|
|
11
|
-
alt="team logo"
|
|
12
|
-
/>${srEl}`;
|
|
13
|
-
case "letter":
|
|
14
|
-
return `<div
|
|
15
|
-
class="s-avatar--letter"
|
|
16
|
-
aria-hidden="true">
|
|
17
|
-
S
|
|
18
|
-
</div>${srEl}`;
|
|
19
|
-
default:
|
|
20
|
-
return srEl;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
describe("avatar", () => {
|
|
25
|
-
runA11yTests({
|
|
26
|
-
baseClass: "s-avatar",
|
|
27
|
-
variants: ["24", "32", "48", "64", "96", "128"],
|
|
28
|
-
children: {
|
|
29
|
-
default: getChild(),
|
|
30
|
-
image: getChild("image"),
|
|
31
|
-
letter: getChild("letter"),
|
|
32
|
-
},
|
|
33
|
-
tag: "span",
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
const base64Image =
|
|
6
|
-
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATwAAAE8CAMAAABq2/00AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABhQTFRF/3IA/////44y/8OS/+fU//Xs/6tn/9e2EhvbMQAABH9JREFUeNrs3e1y2ygAhWELJHH/d7zuJpN1XAnxoe408Ly/6xnnHXEOIEwfDwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/gbAGEhrZl2VloY20PIk8tAzZbfkXA7eeuHyysVfdFMsXiY66ptiWF8Re05BdxF7HkBV7PUNW7FVx4E7sVSwrDjBw2+pC7NWwHtkTe3ULM7En9v6O2ONF7Ik9sSf2IPbEntgTexB7t8feTsynniD2Oh6tXex1hFoUe02kaxVi72JMZs+Rib0LLdkXFGLvaECWjkOxdxVmUex1rB6S2Kss2lcytSH2LnVkakPsXQ7E8xwTe5fuMrUh9vKj8CP4xN7lNOXc3mnwib1M2X7Z28VeS93mg0/sFZTG6WCMVSE51fqsYL4s9jpqQ+yV1caxErHXUxtir6c2xF5HbYRF7LXXhtjrqQ2x11MbYu9tLG4VtSH2empD7BUNxpPaSGKvPPh2sdcxX45i78baEHs18+X32hB7NfPl99oQex21MVHsxViaR8W1MU3s/XpMSvWF0tqYJfY+BmMq01dcG+scP6/6enTK9BW+1J0j9l5aYN0rP5BzM0XsbSUnAlpqY4LYezexFeRSbpslH3uDXdF64OG6est258PohXE8BK+7o6g29rJTQsPt1F3qK9qdTwMP2Wz2X1Vv0UvdbeQ53nl2Xesr2Z0Pww7Zs5lsafWW1MY+6JDNxv5/+kLb5/fXfzLirRdhKSGnr6A2tkGvJoxLGZnqva6NkAbdgA+pUN9a+QuWYYPu+98ee/W1/PJgoMG7lek7nW3UHiEdbKpcqu+kO2L9b4aG0rcWjt5jfWf2Z7kCeE891XtSG/O86A5d+tbZj1h0VW+c/ja90FG9uxMCFdWb/+SkZ1Oaq/d1vjzvXfvF+tLp+aiZT5S1Vm90lrFj02B3bW1d9X7T92u+7Aq9qk2D+Fob/v/Myu7YostC76xe9K966evfr5+7ekuXHVy1V6+R275pEMd3kPbGB+Syeod/8D7Sf41NBvPdMf7a4uXpaTGY0zd+4r0vDlKtwdPqHf/BOzzf8zQYqvRtcz54mXfUNUVyUL0T7AhcrBbKY/C36p1geVEy1y00+F3fBA9eKFxnlRXJa/XOcKxnqeF6Pv1VvTPc7RuXai6K5LN6Z9hQSUsb2Rh86pviUultaScTg/sMD15YeqmcT8/bFx1Foi/umk9P3hcMfqTenrabBT5j8DGTwHivwelOCTwNrnfJm/Ol2U0GZ74WdE+dBn9+Z/z2J9UZ7IjB7dZv8gPl9RRJIq89BiN57QZ38trn04G8k62E6xjcHuQ1D+JEXrvBnbz2+XQgr30+/SCveT69ktceg4m8doOBvDG/CXnkkTezvOXPQB555JFHHnnkkUceeeSRRx555JFHHnnkkWcnmTzyyCOPPPLII4888sgjjzzfhDzyyCOPPPL+9Ff+eyCPPPLII4888sgjjzzyyCOPPPLII4888sgDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPy//CPAAPiZOI3BPDFQAAAAAElFTkSuQmCC";
|
|
7
|
-
|
|
8
|
-
const getChild = (child?: string): string => {
|
|
9
|
-
const srEl = `<span class="v-visible-sr">Stack Overflow</span>`;
|
|
10
|
-
switch (child) {
|
|
11
|
-
case "image":
|
|
12
|
-
return `<img
|
|
13
|
-
class="s-avatar--image"
|
|
14
|
-
src="${base64Image}"
|
|
15
|
-
alt="team logo"
|
|
16
|
-
/>${srEl}`;
|
|
17
|
-
case "letter":
|
|
18
|
-
return `<div
|
|
19
|
-
class="s-avatar--letter"
|
|
20
|
-
aria-hidden="true">
|
|
21
|
-
S
|
|
22
|
-
</div>${srEl}`;
|
|
23
|
-
default:
|
|
24
|
-
return srEl;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
describe("avatar", () => {
|
|
29
|
-
runVisualTests({
|
|
30
|
-
baseClass: "s-avatar",
|
|
31
|
-
variants: ["24", "32", "48", "64", "96", "128"],
|
|
32
|
-
children: {
|
|
33
|
-
default: getChild(),
|
|
34
|
-
image: getChild("image"),
|
|
35
|
-
letter: getChild("letter"),
|
|
36
|
-
},
|
|
37
|
-
attributes: {
|
|
38
|
-
href: "#",
|
|
39
|
-
},
|
|
40
|
-
tag: "a",
|
|
41
|
-
template: ({ component, testid }) => html`
|
|
42
|
-
<div
|
|
43
|
-
data-testid="${testid}"
|
|
44
|
-
class="d-inline-flex ai-center jc-center hmn1 wmn1 p8"
|
|
45
|
-
>
|
|
46
|
-
${component}
|
|
47
|
-
</div>
|
|
48
|
-
`,
|
|
49
|
-
});
|
|
50
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
2
|
-
import "../../index";
|
|
3
|
-
|
|
4
|
-
describe("award-bling", () => {
|
|
5
|
-
runA11yTests({
|
|
6
|
-
baseClass: "s-award-bling",
|
|
7
|
-
variants: ["gold", "silver", "bronze"],
|
|
8
|
-
children: {
|
|
9
|
-
default: `100 <div class="v-visible-sr">award</div>`,
|
|
10
|
-
},
|
|
11
|
-
options: {
|
|
12
|
-
includeNullVariant: false,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
2
|
-
import { html } from "@open-wc/testing";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("anchors", () => {
|
|
6
|
-
runVisualTests({
|
|
7
|
-
baseClass: "s-award-bling",
|
|
8
|
-
variants: ["gold", "silver", "bronze"],
|
|
9
|
-
children: {
|
|
10
|
-
default: `100 <div class="v-visible-sr">award</div>`,
|
|
11
|
-
},
|
|
12
|
-
options: {
|
|
13
|
-
includeNullVariant: false,
|
|
14
|
-
},
|
|
15
|
-
template: ({ component, testid }) => html`
|
|
16
|
-
<div
|
|
17
|
-
class="d-inline-flex ai-center jc-center hs1 ws1 p8"
|
|
18
|
-
data-testid="${testid}"
|
|
19
|
-
>
|
|
20
|
-
${component}
|
|
21
|
-
</div>
|
|
22
|
-
`,
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
2
|
-
import { IconEyeSm } from "@stackoverflow/stacks-icons/icons";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
const variants = {
|
|
6
|
-
blings: ["gold", "silver", "bronze"],
|
|
7
|
-
numbers: ["answered", "bounty", "important", "rep", "rep-down", "votes"],
|
|
8
|
-
filled: ["danger", "muted"],
|
|
9
|
-
states: ["danger", "muted", "info", "new", "warning"],
|
|
10
|
-
users: ["admin", "moderator", "staff"],
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
describe("badge", () => {
|
|
14
|
-
// Base badge
|
|
15
|
-
runA11yTests({
|
|
16
|
-
baseClass: "s-badge",
|
|
17
|
-
children: {
|
|
18
|
-
default: `base badge`,
|
|
19
|
-
},
|
|
20
|
-
tag: "span",
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// Award badges
|
|
24
|
-
variants.blings.map((bling) => {
|
|
25
|
-
runA11yTests({
|
|
26
|
-
baseClass: "s-badge",
|
|
27
|
-
variants: [bling],
|
|
28
|
-
children: {
|
|
29
|
-
default: `<span class="s-award-bling s-award-bling__${bling}">
|
|
30
|
-
with bling
|
|
31
|
-
</span>`,
|
|
32
|
-
},
|
|
33
|
-
options: {
|
|
34
|
-
includeNullVariant: false,
|
|
35
|
-
},
|
|
36
|
-
tag: "span",
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// Number counts
|
|
41
|
-
runA11yTests({
|
|
42
|
-
baseClass: "s-badge",
|
|
43
|
-
variants: variants.numbers,
|
|
44
|
-
children: {
|
|
45
|
-
default: "123",
|
|
46
|
-
},
|
|
47
|
-
options: {
|
|
48
|
-
includeNullVariant: false,
|
|
49
|
-
},
|
|
50
|
-
tag: "span",
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// State badges
|
|
54
|
-
runA11yTests({
|
|
55
|
-
baseClass: "s-badge",
|
|
56
|
-
variants: variants.states,
|
|
57
|
-
children: {
|
|
58
|
-
default: `badge`,
|
|
59
|
-
},
|
|
60
|
-
tag: "span",
|
|
61
|
-
skippedTestids: ["s-badge-dark-new"],
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
// State badges w/ filled modifier
|
|
65
|
-
runA11yTests({
|
|
66
|
-
baseClass: "s-badge",
|
|
67
|
-
variants: variants.filled,
|
|
68
|
-
modifiers: {
|
|
69
|
-
primary: ["filled"],
|
|
70
|
-
},
|
|
71
|
-
children: {
|
|
72
|
-
default: `filled badge`,
|
|
73
|
-
},
|
|
74
|
-
options: {
|
|
75
|
-
includeNullModifier: false,
|
|
76
|
-
},
|
|
77
|
-
tag: "span",
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// State badges w/ filled modifier and icon
|
|
81
|
-
runA11yTests({
|
|
82
|
-
baseClass: "s-badge",
|
|
83
|
-
variants: variants.filled,
|
|
84
|
-
modifiers: {
|
|
85
|
-
primary: ["filled"],
|
|
86
|
-
secondary: ["icon"],
|
|
87
|
-
},
|
|
88
|
-
children: {
|
|
89
|
-
default: `${IconEyeSm} icon badge`,
|
|
90
|
-
},
|
|
91
|
-
options: {
|
|
92
|
-
includeNullModifier: false,
|
|
93
|
-
},
|
|
94
|
-
tag: "span",
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
// State badges w/ icon
|
|
98
|
-
runA11yTests({
|
|
99
|
-
baseClass: "s-badge",
|
|
100
|
-
variants: variants.states.filter((state) => state !== "new"),
|
|
101
|
-
modifiers: {
|
|
102
|
-
primary: ["icon"],
|
|
103
|
-
},
|
|
104
|
-
children: {
|
|
105
|
-
default: `${IconEyeSm} icon badge`,
|
|
106
|
-
},
|
|
107
|
-
options: {
|
|
108
|
-
includeNullModifier: false,
|
|
109
|
-
},
|
|
110
|
-
tag: "span",
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
// User badges
|
|
114
|
-
runA11yTests({
|
|
115
|
-
baseClass: "s-badge",
|
|
116
|
-
variants: variants.users,
|
|
117
|
-
modifiers: {
|
|
118
|
-
primary: ["xs", "sm"],
|
|
119
|
-
},
|
|
120
|
-
children: {
|
|
121
|
-
default: "user badge",
|
|
122
|
-
},
|
|
123
|
-
options: {
|
|
124
|
-
includeNullVariant: false,
|
|
125
|
-
},
|
|
126
|
-
tag: "span",
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
// Sizes
|
|
130
|
-
runA11yTests({
|
|
131
|
-
baseClass: "s-badge",
|
|
132
|
-
modifiers: {
|
|
133
|
-
primary: ["xs", "sm"],
|
|
134
|
-
},
|
|
135
|
-
children: {
|
|
136
|
-
default: "size badge",
|
|
137
|
-
},
|
|
138
|
-
options: {
|
|
139
|
-
includeNullModifier: false,
|
|
140
|
-
},
|
|
141
|
-
tag: "span",
|
|
142
|
-
});
|
|
143
|
-
});
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
2
|
-
import { IconEyeSm } from "@stackoverflow/stacks-icons/icons";
|
|
3
|
-
import "../../index";
|
|
4
|
-
import { html } from "@open-wc/testing";
|
|
5
|
-
|
|
6
|
-
const variants = {
|
|
7
|
-
blings: ["gold", "silver", "bronze"],
|
|
8
|
-
numbers: ["answered", "bounty", "important", "rep", "rep-down", "votes"],
|
|
9
|
-
filled: ["danger", "muted"],
|
|
10
|
-
states: ["danger", "muted", "info", "new", "warning"],
|
|
11
|
-
users: ["admin", "moderator", "staff"],
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
-
const template = ({ component, testid }: any) => html`
|
|
16
|
-
<div
|
|
17
|
-
class="d-inline-flex ai-center jc-center hs1 ws1 p8"
|
|
18
|
-
data-testid="${testid}"
|
|
19
|
-
>
|
|
20
|
-
${component}
|
|
21
|
-
</div>
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
describe("badge", () => {
|
|
25
|
-
// Base badge
|
|
26
|
-
runVisualTests({
|
|
27
|
-
baseClass: "s-badge",
|
|
28
|
-
children: {
|
|
29
|
-
default: `base badge`,
|
|
30
|
-
},
|
|
31
|
-
tag: "span",
|
|
32
|
-
template,
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// Award badges
|
|
36
|
-
variants.blings.map((bling) => {
|
|
37
|
-
runVisualTests({
|
|
38
|
-
baseClass: "s-badge",
|
|
39
|
-
variants: [bling],
|
|
40
|
-
children: {
|
|
41
|
-
default: `<span class="s-award-bling s-award-bling__${bling}">
|
|
42
|
-
with bling
|
|
43
|
-
</span>`,
|
|
44
|
-
},
|
|
45
|
-
options: {
|
|
46
|
-
includeNullVariant: false,
|
|
47
|
-
},
|
|
48
|
-
tag: "span",
|
|
49
|
-
template,
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// Number counts
|
|
54
|
-
runVisualTests({
|
|
55
|
-
baseClass: "s-badge",
|
|
56
|
-
variants: variants.numbers,
|
|
57
|
-
children: {
|
|
58
|
-
default: "123",
|
|
59
|
-
},
|
|
60
|
-
options: {
|
|
61
|
-
includeNullVariant: false,
|
|
62
|
-
},
|
|
63
|
-
tag: "span",
|
|
64
|
-
template,
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// State badges
|
|
68
|
-
runVisualTests({
|
|
69
|
-
baseClass: "s-badge",
|
|
70
|
-
variants: variants.states,
|
|
71
|
-
children: {
|
|
72
|
-
default: `state badge`,
|
|
73
|
-
},
|
|
74
|
-
tag: "span",
|
|
75
|
-
options: {
|
|
76
|
-
includeNullVariant: false,
|
|
77
|
-
},
|
|
78
|
-
template,
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
// State badges w/ filled modifier
|
|
82
|
-
runVisualTests({
|
|
83
|
-
baseClass: "s-badge",
|
|
84
|
-
variants: variants.filled,
|
|
85
|
-
modifiers: {
|
|
86
|
-
primary: ["filled"],
|
|
87
|
-
},
|
|
88
|
-
children: {
|
|
89
|
-
default: `filled badge`,
|
|
90
|
-
},
|
|
91
|
-
options: {
|
|
92
|
-
includeNullModifier: false,
|
|
93
|
-
},
|
|
94
|
-
tag: "span",
|
|
95
|
-
template,
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
// State badges w/ filled modifier and icon
|
|
99
|
-
runVisualTests({
|
|
100
|
-
baseClass: "s-badge",
|
|
101
|
-
variants: variants.filled,
|
|
102
|
-
modifiers: {
|
|
103
|
-
primary: ["filled"],
|
|
104
|
-
secondary: ["icon"],
|
|
105
|
-
},
|
|
106
|
-
children: {
|
|
107
|
-
default: `${IconEyeSm} icon badge`,
|
|
108
|
-
},
|
|
109
|
-
options: {
|
|
110
|
-
includeNullModifier: false,
|
|
111
|
-
},
|
|
112
|
-
tag: "span",
|
|
113
|
-
template,
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// State badges w/ icon
|
|
117
|
-
runVisualTests({
|
|
118
|
-
baseClass: "s-badge",
|
|
119
|
-
variants: variants.states.filter((state) => state !== "new"),
|
|
120
|
-
modifiers: {
|
|
121
|
-
primary: ["icon"],
|
|
122
|
-
},
|
|
123
|
-
children: {
|
|
124
|
-
default: `${IconEyeSm} icon badge`,
|
|
125
|
-
},
|
|
126
|
-
options: {
|
|
127
|
-
includeNullModifier: false,
|
|
128
|
-
},
|
|
129
|
-
tag: "span",
|
|
130
|
-
template,
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
// User badges
|
|
134
|
-
runVisualTests({
|
|
135
|
-
baseClass: "s-badge",
|
|
136
|
-
variants: variants.users,
|
|
137
|
-
modifiers: {
|
|
138
|
-
primary: ["xs", "sm"],
|
|
139
|
-
},
|
|
140
|
-
children: {
|
|
141
|
-
default: "user badge",
|
|
142
|
-
},
|
|
143
|
-
options: {
|
|
144
|
-
includeNullVariant: false,
|
|
145
|
-
},
|
|
146
|
-
tag: "span",
|
|
147
|
-
template,
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
// Sizes
|
|
151
|
-
runVisualTests({
|
|
152
|
-
baseClass: "s-badge",
|
|
153
|
-
modifiers: {
|
|
154
|
-
primary: ["xs", "sm"],
|
|
155
|
-
},
|
|
156
|
-
children: {
|
|
157
|
-
default: "size badge",
|
|
158
|
-
},
|
|
159
|
-
options: {
|
|
160
|
-
includeNullModifier: false,
|
|
161
|
-
},
|
|
162
|
-
tag: "span",
|
|
163
|
-
template,
|
|
164
|
-
});
|
|
165
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
2
|
-
import "../../index";
|
|
3
|
-
|
|
4
|
-
const bannerChild = `
|
|
5
|
-
<div
|
|
6
|
-
class="d-flex flex__center jc-space-between s-banner--container"
|
|
7
|
-
role="alertdialog"
|
|
8
|
-
aria-labelledby="banner-title"
|
|
9
|
-
aria-describedby="banner-description"
|
|
10
|
-
>
|
|
11
|
-
<div aria-label="banner message">
|
|
12
|
-
<h2 id="banner-title">Banner heading</h2>
|
|
13
|
-
<p id="banner-description">Banner description</p>
|
|
14
|
-
</div>
|
|
15
|
-
<div class="ml-auto myn8">
|
|
16
|
-
<span class="s-btn s-banner--btn">Close</span>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
describe("banner", () => {
|
|
22
|
-
runA11yTests({
|
|
23
|
-
baseClass: "s-banner",
|
|
24
|
-
variants: ["info", "success", "warning", "danger"],
|
|
25
|
-
modifiers: {
|
|
26
|
-
primary: ["important"],
|
|
27
|
-
},
|
|
28
|
-
attributes: {
|
|
29
|
-
role: "alert",
|
|
30
|
-
ariaHidden: "false",
|
|
31
|
-
},
|
|
32
|
-
children: {
|
|
33
|
-
default: bannerChild,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
});
|