@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,58 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
const states = [
|
|
6
|
-
{
|
|
7
|
-
class: "",
|
|
8
|
-
children:
|
|
9
|
-
'This is a stateless input message. <a href="">Learn more</a>.',
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
class: "has-error",
|
|
13
|
-
children: 'This is an error input message. <a href="">Learn more</a>.',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
class: "has-success",
|
|
17
|
-
children: 'This is a success input message. <a href="">Learn more</a>.',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
class: "has-warning",
|
|
21
|
-
children: 'This is a warning input message. <a href="">Learn more</a>.',
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
class: "disabled",
|
|
25
|
-
children:
|
|
26
|
-
'This is a disabled input message. <a href="">Learn more</a>.',
|
|
27
|
-
},
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
describe("input-message", () => {
|
|
31
|
-
states.forEach((state) => {
|
|
32
|
-
runVisualTests({
|
|
33
|
-
baseClass: `s-input-message ${
|
|
34
|
-
state.class ? `state-${state.class}` : ""
|
|
35
|
-
}`,
|
|
36
|
-
children: {
|
|
37
|
-
default: state.children,
|
|
38
|
-
},
|
|
39
|
-
template: ({ component, testid }) => {
|
|
40
|
-
const isDisabled = state.class === "disabled";
|
|
41
|
-
const stateClass =
|
|
42
|
-
state.class && state.class !== "disabled"
|
|
43
|
-
? state.class
|
|
44
|
-
: "";
|
|
45
|
-
|
|
46
|
-
return html`
|
|
47
|
-
<fieldset
|
|
48
|
-
data-testid="${testid}"
|
|
49
|
-
class="p8 ws3 ${stateClass}"
|
|
50
|
-
?disabled="${isDisabled}"
|
|
51
|
-
>
|
|
52
|
-
${component}
|
|
53
|
-
</fieldset>
|
|
54
|
-
`;
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
});
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
// TODO note: all accessibility tests here are skipped currently. Revisit in Stacks v2
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
-
const template = ({ component, testid, classes = "", icon }: any) => html`
|
|
9
|
-
<div data-testid="${testid}" class="p8 ws4 ${classes}">
|
|
10
|
-
<label for="default-id">Label</label>
|
|
11
|
-
${component}${icon}
|
|
12
|
-
</div>
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
const customAttributes = [
|
|
16
|
-
{
|
|
17
|
-
placeholder: "Enter your text here",
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
readonly: "",
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
disabled: "",
|
|
24
|
-
},
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
const states = ["has-error", "has-warning", "has-success"];
|
|
28
|
-
const sizes = ["sm", "md", "lg", "xl"];
|
|
29
|
-
const otherModifiers = ["creditcard", "search"];
|
|
30
|
-
|
|
31
|
-
["input", "textarea"].map((type) => {
|
|
32
|
-
const children =
|
|
33
|
-
type === "textarea" ? { default: "Enter your text here" } : undefined;
|
|
34
|
-
|
|
35
|
-
describe(type, () => {
|
|
36
|
-
// Base styles w/ value, modifiers
|
|
37
|
-
runA11yTests({
|
|
38
|
-
baseClass: `s-${type}`,
|
|
39
|
-
modifiers: {
|
|
40
|
-
primary: [...sizes, ...otherModifiers],
|
|
41
|
-
},
|
|
42
|
-
tag: type,
|
|
43
|
-
attributes:
|
|
44
|
-
type === "input"
|
|
45
|
-
? {
|
|
46
|
-
type: "text",
|
|
47
|
-
value: "Text input value",
|
|
48
|
-
id: `default-id`,
|
|
49
|
-
}
|
|
50
|
-
: {
|
|
51
|
-
id: `default-id`,
|
|
52
|
-
},
|
|
53
|
-
children,
|
|
54
|
-
template,
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
// Base styles w/o value; w/ readonly attr; w/ disabled attr
|
|
58
|
-
customAttributes.forEach((attributes) => {
|
|
59
|
-
const attrString = Object.keys(attributes).sort().join("-");
|
|
60
|
-
|
|
61
|
-
runA11yTests({
|
|
62
|
-
baseClass: `s-${type} ${attrString}`,
|
|
63
|
-
tag: type,
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
65
|
-
// @ts-ignore
|
|
66
|
-
attributes:
|
|
67
|
-
type === "input"
|
|
68
|
-
? {
|
|
69
|
-
type: "text",
|
|
70
|
-
value: attributes.placeholder
|
|
71
|
-
? null
|
|
72
|
-
: "Text input value",
|
|
73
|
-
id: `default-id`,
|
|
74
|
-
...attributes,
|
|
75
|
-
}
|
|
76
|
-
: {
|
|
77
|
-
id: `default-id`,
|
|
78
|
-
...attributes,
|
|
79
|
-
},
|
|
80
|
-
children,
|
|
81
|
-
template,
|
|
82
|
-
// TODO revisit these skipped test ids
|
|
83
|
-
skippedTestids: [/readonly/],
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
// w/ state classes
|
|
88
|
-
states.forEach((state) => {
|
|
89
|
-
runA11yTests({
|
|
90
|
-
baseClass: `s-${type} state-${state}`,
|
|
91
|
-
tag: type,
|
|
92
|
-
attributes:
|
|
93
|
-
type === "input"
|
|
94
|
-
? {
|
|
95
|
-
type: "text",
|
|
96
|
-
value: "Text input value",
|
|
97
|
-
id: `default-id`,
|
|
98
|
-
}
|
|
99
|
-
: {
|
|
100
|
-
id: "default-id",
|
|
101
|
-
},
|
|
102
|
-
children,
|
|
103
|
-
template: ({ component, testid }) =>
|
|
104
|
-
template({ component, testid, classes: state }),
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
// TODO interaction (focus) states?
|
|
108
|
-
});
|
|
109
|
-
});
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
-
const template = ({ component, testid, classes = "", icon }: any) => html`
|
|
7
|
-
<div data-testid="${testid}" class="p8 ws4 ${classes}">
|
|
8
|
-
${component}${icon}
|
|
9
|
-
</div>
|
|
10
|
-
`;
|
|
11
|
-
|
|
12
|
-
const customAttributes = [
|
|
13
|
-
{
|
|
14
|
-
placeholder: "Enter your text here",
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
readonly: "",
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
disabled: "",
|
|
21
|
-
},
|
|
22
|
-
] as Record<string, string>[];
|
|
23
|
-
|
|
24
|
-
const states = ["has-error", "has-warning", "has-success", "is-readonly"];
|
|
25
|
-
const sizes = ["sm", "md", "lg", "xl"];
|
|
26
|
-
const otherModifiers = ["creditcard", "search"];
|
|
27
|
-
|
|
28
|
-
["input", "textarea"].map((type) => {
|
|
29
|
-
const children =
|
|
30
|
-
type === "textarea" ? { default: "Enter your text here" } : undefined;
|
|
31
|
-
|
|
32
|
-
describe(type, () => {
|
|
33
|
-
// Base styles w/ value, modifiers
|
|
34
|
-
runVisualTests({
|
|
35
|
-
baseClass: `s-${type}`,
|
|
36
|
-
modifiers: {
|
|
37
|
-
primary: [...sizes, ...otherModifiers],
|
|
38
|
-
},
|
|
39
|
-
tag: type,
|
|
40
|
-
attributes:
|
|
41
|
-
type === "input"
|
|
42
|
-
? {
|
|
43
|
-
type: "text",
|
|
44
|
-
value: "Text input value",
|
|
45
|
-
}
|
|
46
|
-
: {},
|
|
47
|
-
children,
|
|
48
|
-
template,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
// Base styles w/o value; w/ readonly attr; w/ disabled attr
|
|
52
|
-
customAttributes.forEach((attributes) => {
|
|
53
|
-
const attrString = Object.keys(attributes).sort().join("-");
|
|
54
|
-
let attr = attributes;
|
|
55
|
-
if (type === "input") {
|
|
56
|
-
attr = {
|
|
57
|
-
type: "text",
|
|
58
|
-
...attributes,
|
|
59
|
-
};
|
|
60
|
-
if (!attributes.placeholder) {
|
|
61
|
-
attr = {
|
|
62
|
-
value: "Text input value",
|
|
63
|
-
...attr,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
runVisualTests({
|
|
68
|
-
baseClass: `s-${type} ${attrString}`,
|
|
69
|
-
tag: type,
|
|
70
|
-
attributes: attr,
|
|
71
|
-
children,
|
|
72
|
-
template,
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// w/ state classes; .is-readonly
|
|
77
|
-
states.forEach((state) => {
|
|
78
|
-
runVisualTests({
|
|
79
|
-
baseClass: `s-${type} state-${state}`,
|
|
80
|
-
tag: type,
|
|
81
|
-
attributes:
|
|
82
|
-
type === "input"
|
|
83
|
-
? {
|
|
84
|
-
type: "text",
|
|
85
|
-
value: "Text input value",
|
|
86
|
-
}
|
|
87
|
-
: {},
|
|
88
|
-
children,
|
|
89
|
-
template: ({ component, testid }) =>
|
|
90
|
-
template({ component, testid, classes: state }),
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
// TODO interaction (focus) states?
|
|
94
|
-
});
|
|
95
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
-
const labelTemplate = ({ component, testid }: any) => {
|
|
7
|
-
return html`
|
|
8
|
-
<fieldset data-testid="${testid}" class="p8 ws3">${component}</fieldset>
|
|
9
|
-
`;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
-
const getChildren = (status?: any) => {
|
|
14
|
-
const typeClass =
|
|
15
|
-
status && status !== "base" ? `s-label--status__${status}` : "";
|
|
16
|
-
return `
|
|
17
|
-
Example label
|
|
18
|
-
${
|
|
19
|
-
status
|
|
20
|
-
? `
|
|
21
|
-
<span class="s-label--status ${typeClass}">${
|
|
22
|
-
status ?? "no type"
|
|
23
|
-
}</span>
|
|
24
|
-
`
|
|
25
|
-
: ""
|
|
26
|
-
}
|
|
27
|
-
`;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
describe("label", () => {
|
|
31
|
-
runA11yTests({
|
|
32
|
-
baseClass: `s-label`,
|
|
33
|
-
modifiers: {
|
|
34
|
-
primary: ["sm", "md", "lg", "xl"],
|
|
35
|
-
},
|
|
36
|
-
children: {
|
|
37
|
-
"default": getChildren(),
|
|
38
|
-
"status": getChildren("base"),
|
|
39
|
-
"status-beta": getChildren("beta"),
|
|
40
|
-
"status-new": getChildren("new"),
|
|
41
|
-
"status-required": getChildren("required"),
|
|
42
|
-
},
|
|
43
|
-
tag: "label",
|
|
44
|
-
template: ({ component, testid }) =>
|
|
45
|
-
labelTemplate({ component, testid }),
|
|
46
|
-
});
|
|
47
|
-
});
|
|
@@ -1,65 +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 labelTemplate = ({ component, testid, isDisabled }: any) => {
|
|
7
|
-
return html`
|
|
8
|
-
<fieldset
|
|
9
|
-
data-testid="${testid}"
|
|
10
|
-
class="p8 ws3"
|
|
11
|
-
?disabled="${isDisabled}"
|
|
12
|
-
>
|
|
13
|
-
${component}
|
|
14
|
-
</fieldset>
|
|
15
|
-
`;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
-
const getChildren = (text: string, status?: any) => {
|
|
20
|
-
const typeClass =
|
|
21
|
-
status && status !== "base" ? `s-label--status__${status}` : "";
|
|
22
|
-
return `
|
|
23
|
-
${text}
|
|
24
|
-
${
|
|
25
|
-
status
|
|
26
|
-
? `
|
|
27
|
-
<span class="s-label--status ${typeClass}">${
|
|
28
|
-
status ?? "no type"
|
|
29
|
-
}</span>
|
|
30
|
-
`
|
|
31
|
-
: ""
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
describe("label", () => {
|
|
37
|
-
[true, false].forEach((isDisabled) => {
|
|
38
|
-
const text = isDisabled ? "Disabled label" : "Example label";
|
|
39
|
-
|
|
40
|
-
runVisualTests({
|
|
41
|
-
baseClass: `s-label`,
|
|
42
|
-
modifiers: {
|
|
43
|
-
primary: ["sm", "md", "lg", "xl"],
|
|
44
|
-
},
|
|
45
|
-
children: isDisabled
|
|
46
|
-
? {
|
|
47
|
-
"disabled": getChildren(text),
|
|
48
|
-
"disabled-status": getChildren(text, "base"),
|
|
49
|
-
"disabled-status-beta": getChildren(text, "beta"),
|
|
50
|
-
"disabled-status-new": getChildren(text, "new"),
|
|
51
|
-
"disabled-status-required": getChildren(text, "required"),
|
|
52
|
-
}
|
|
53
|
-
: {
|
|
54
|
-
"default": getChildren(text),
|
|
55
|
-
"status": getChildren(text, "base"),
|
|
56
|
-
"status-beta": getChildren(text, "beta"),
|
|
57
|
-
"status-new": getChildren(text, "new"),
|
|
58
|
-
"status-required": getChildren(text, "required"),
|
|
59
|
-
},
|
|
60
|
-
tag: "label",
|
|
61
|
-
template: ({ component, testid }) =>
|
|
62
|
-
labelTemplate({ component, testid, isDisabled }),
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
2
|
-
import "../../index";
|
|
3
|
-
|
|
4
|
-
describe("link", () => {
|
|
5
|
-
// TODO check for visited styling
|
|
6
|
-
runA11yTests({
|
|
7
|
-
baseClass: "s-link",
|
|
8
|
-
modifiers: {
|
|
9
|
-
primary: [
|
|
10
|
-
"grayscale",
|
|
11
|
-
"muted",
|
|
12
|
-
"danger",
|
|
13
|
-
"inherit",
|
|
14
|
-
"underlined",
|
|
15
|
-
"visited",
|
|
16
|
-
],
|
|
17
|
-
secondary: ["dropdown"],
|
|
18
|
-
},
|
|
19
|
-
children: {
|
|
20
|
-
default: "s-link",
|
|
21
|
-
},
|
|
22
|
-
tag: "a",
|
|
23
|
-
attributes: {
|
|
24
|
-
href: "#",
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("link", () => {
|
|
6
|
-
// TODO check for visited styling
|
|
7
|
-
runVisualTests({
|
|
8
|
-
baseClass: "s-link",
|
|
9
|
-
modifiers: {
|
|
10
|
-
primary: [
|
|
11
|
-
"grayscale",
|
|
12
|
-
"muted",
|
|
13
|
-
"danger",
|
|
14
|
-
"inherit",
|
|
15
|
-
"underlined",
|
|
16
|
-
"visited",
|
|
17
|
-
],
|
|
18
|
-
secondary: ["dropdown"],
|
|
19
|
-
},
|
|
20
|
-
children: {
|
|
21
|
-
default: "s-link",
|
|
22
|
-
},
|
|
23
|
-
tag: "a",
|
|
24
|
-
attributes: {
|
|
25
|
-
href: "#",
|
|
26
|
-
},
|
|
27
|
-
template: ({ component, testid }) => html`
|
|
28
|
-
<div data-testid="${testid}" class="p4 ws1">${component}</div>
|
|
29
|
-
`,
|
|
30
|
-
});
|
|
31
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
2
|
-
import "../../index";
|
|
3
|
-
|
|
4
|
-
const getChild = (child?: string): string => {
|
|
5
|
-
return `
|
|
6
|
-
<div class="s-link-preview--header">
|
|
7
|
-
<div class="s-link-preview--icon">👋</div>
|
|
8
|
-
<div>
|
|
9
|
-
<a href="#" class="s-link-preview--title">
|
|
10
|
-
Using hooks for a simple fetch request and breaking the rules of hooks, unsure how?
|
|
11
|
-
</a>
|
|
12
|
-
<div class="s-link-preview--details">
|
|
13
|
-
Issue submitted by Ricky Otero on <relative-time datetime="2019-08-12T04:05:22Z" title="Aug 12, 2019, 12:05 AM EDT">Aug 12, 2019</relative-time> • <strong>RESOLVED</strong>
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
${
|
|
18
|
-
child
|
|
19
|
-
? child
|
|
20
|
-
: `
|
|
21
|
-
<div class="s-link-preview--body">
|
|
22
|
-
<p>I'm trying to create a simple fetch with hooks from an AWS database. At the moment it errors out and the only reason I can see is because it breaks the rules of hooks but I'm not sure how. It's at the top level of this functional component and it's not called inside an event handler.</p>
|
|
23
|
-
<p>The result of this call (an array of user data), needs to be exported as a function and called in another file.</p>
|
|
24
|
-
<p>If anyone can spot something I have missed and can highlighted how I'm breaking the rules of hooks I'd be grateful!</p>
|
|
25
|
-
<p>Thanks!</p>
|
|
26
|
-
</div>
|
|
27
|
-
`
|
|
28
|
-
}
|
|
29
|
-
<div class="s-link-preview--footer">
|
|
30
|
-
<a href="#" class="s-link-preview--url">https://stackoverflow.atlassian.net/projects/SREREQ/queues/custom/1</a>
|
|
31
|
-
<a href="#" class="s-link-preview--misc">Privacy notice</a>
|
|
32
|
-
</div>
|
|
33
|
-
`;
|
|
34
|
-
};
|
|
35
|
-
describe("link preview", () => {
|
|
36
|
-
runA11yTests({
|
|
37
|
-
baseClass: "s-link-preview",
|
|
38
|
-
children: {
|
|
39
|
-
default: getChild(),
|
|
40
|
-
code: getChild(`
|
|
41
|
-
<div class="s-link-preview--code">
|
|
42
|
-
<pre class="language-js s-code-block" tabindex="0"><code class="language-js s-code-block"><span class="hljs-meta">'use strict'</span>;</code></pre>
|
|
43
|
-
</div>
|
|
44
|
-
`),
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
const getChild = (child?: string): string => {
|
|
6
|
-
return `
|
|
7
|
-
<div class="s-link-preview--header">
|
|
8
|
-
<div class="s-link-preview--icon">👋</div>
|
|
9
|
-
<div>
|
|
10
|
-
<a href="#" class="s-link-preview--title">
|
|
11
|
-
Using hooks for a simple fetch request and breaking the rules of hooks, unsure how?
|
|
12
|
-
</a>
|
|
13
|
-
<div class="s-link-preview--details">
|
|
14
|
-
Issue submitted by Ricky Otero on <relative-time datetime="2019-08-12T04:05:22Z" title="Aug 12, 2019, 12:05 AM EDT">Aug 12, 2019</relative-time> • <strong>RESOLVED</strong>
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
${
|
|
19
|
-
child
|
|
20
|
-
? child
|
|
21
|
-
: `
|
|
22
|
-
<div class="s-link-preview--body">
|
|
23
|
-
<p>I'm trying to create a simple fetch with hooks from an AWS database. At the moment it errors out and the only reason I can see is because it breaks the rules of hooks but I'm not sure how. It's at the top level of this functional component and it's not called inside an event handler.</p>
|
|
24
|
-
<p>The result of this call (an array of user data), needs to be exported as a function and called in another file.</p>
|
|
25
|
-
<p>If anyone can spot something I have missed and can highlighted how I'm breaking the rules of hooks I'd be grateful!</p>
|
|
26
|
-
<p>Thanks!</p>
|
|
27
|
-
</div>
|
|
28
|
-
`
|
|
29
|
-
}
|
|
30
|
-
<div class="s-link-preview--footer">
|
|
31
|
-
<a href="#" class="s-link-preview--url">https://stackoverflow.atlassian.net/projects/SREREQ/queues/custom/1</a>
|
|
32
|
-
<a href="#" class="s-link-preview--misc">Privacy notice</a>
|
|
33
|
-
</div>
|
|
34
|
-
`;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
describe("link preview", () => {
|
|
38
|
-
runVisualTests({
|
|
39
|
-
baseClass: "s-link-preview",
|
|
40
|
-
children: {
|
|
41
|
-
default: getChild(),
|
|
42
|
-
code: getChild(`
|
|
43
|
-
<div class="s-link-preview--code">
|
|
44
|
-
<pre class="language-js s-code-block" tabindex="0"><code class="language-js s-code-block"><span class="hljs-meta">'use strict'</span>;</code></pre>
|
|
45
|
-
</div>
|
|
46
|
-
`),
|
|
47
|
-
},
|
|
48
|
-
template: ({ component, testid }) => html`
|
|
49
|
-
<div class="ws8 p8" data-testid="${testid}">${component}</div>
|
|
50
|
-
`,
|
|
51
|
-
});
|
|
52
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("menu", () => {
|
|
6
|
-
runA11yTests({
|
|
7
|
-
baseClass: `s-menu`,
|
|
8
|
-
children: {
|
|
9
|
-
default: `
|
|
10
|
-
<li class="s-menu--title" role="separator">Title 1</li>
|
|
11
|
-
<li role="menuitem">
|
|
12
|
-
<a href="#" class="s-block-link">Example li</a>
|
|
13
|
-
</li>
|
|
14
|
-
<li class="s-menu--title" role="separator">Title 2</li>
|
|
15
|
-
<li role="menuitem">
|
|
16
|
-
<a href="#" class="s-block-link s-block-link__left is-selected">Selected link</a>
|
|
17
|
-
</li>
|
|
18
|
-
<li role="menuitem">
|
|
19
|
-
<a href="#" class="s-block-link">Example li</a>
|
|
20
|
-
</li>
|
|
21
|
-
<li role="menuitem" class="s-menu--label">Example label</li>
|
|
22
|
-
<li role="menuitem">
|
|
23
|
-
<a href="#" class="s-block-link">Block link</a>
|
|
24
|
-
</li>
|
|
25
|
-
<li class="s-menu--divider" role="separator"></li>
|
|
26
|
-
<li role="menuitem">
|
|
27
|
-
<a href="…" class="s-block-link s-block-link__danger">Danger link</a>
|
|
28
|
-
</li>
|
|
29
|
-
`,
|
|
30
|
-
},
|
|
31
|
-
tag: "ul",
|
|
32
|
-
attributes: {
|
|
33
|
-
role: "menu",
|
|
34
|
-
},
|
|
35
|
-
template: ({ component, testid }) => html`
|
|
36
|
-
<div class="ws2" data-testid="${testid}">${component}</div>
|
|
37
|
-
`,
|
|
38
|
-
});
|
|
39
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("menu", () => {
|
|
6
|
-
runVisualTests({
|
|
7
|
-
baseClass: `s-menu`,
|
|
8
|
-
children: {
|
|
9
|
-
default: `
|
|
10
|
-
<li class="s-menu--title" role="separator">Title 1</li>
|
|
11
|
-
<li role="menuitem">
|
|
12
|
-
<a href="#" class="s-block-link">Example li</a>
|
|
13
|
-
</li>
|
|
14
|
-
<li class="s-menu--title" role="separator">Title 2</li>
|
|
15
|
-
<li role="menuitem">
|
|
16
|
-
<a href="#" class="s-block-link s-block-link__left is-selected">Selected link</a>
|
|
17
|
-
</li>
|
|
18
|
-
<li role="menuitem">
|
|
19
|
-
<a href="#" class="s-block-link">Example li</a>
|
|
20
|
-
</li>
|
|
21
|
-
<li role="menuitem" class="s-menu--label">Example label</li>
|
|
22
|
-
<li role="menuitem">
|
|
23
|
-
<a href="#" class="s-block-link">Block link</a>
|
|
24
|
-
</li>
|
|
25
|
-
<li class="s-menu--divider" role="separator"></li>
|
|
26
|
-
<li role="menuitem">
|
|
27
|
-
<a href="…" class="s-block-link s-block-link__danger">Danger link</a>
|
|
28
|
-
</li>
|
|
29
|
-
`,
|
|
30
|
-
},
|
|
31
|
-
tag: "ul",
|
|
32
|
-
attributes: {
|
|
33
|
-
role: "menu",
|
|
34
|
-
},
|
|
35
|
-
template: ({ component, testid }) => html`
|
|
36
|
-
<div class="ws2" data-testid="${testid}">${component}</div>
|
|
37
|
-
`,
|
|
38
|
-
});
|
|
39
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
3
|
-
import { IconClearSm } from "@stackoverflow/stacks-icons/icons";
|
|
4
|
-
import "../../index";
|
|
5
|
-
|
|
6
|
-
describe("modal", () => {
|
|
7
|
-
runA11yTests({
|
|
8
|
-
baseClass: `s-modal`,
|
|
9
|
-
variants: ["danger"],
|
|
10
|
-
modifiers: {
|
|
11
|
-
primary: ["celebration"],
|
|
12
|
-
secondary: ["full"],
|
|
13
|
-
},
|
|
14
|
-
children: {
|
|
15
|
-
default: `
|
|
16
|
-
<div class="s-modal--dialog" role="document">
|
|
17
|
-
<h1 class="s-modal--header" id="modal-title">Modal header</h1>
|
|
18
|
-
<p class="s-modal--body" id="modal-description">Modal body. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.</p>
|
|
19
|
-
<div class="d-flex gx8 s-modal--footer">
|
|
20
|
-
<button class="s-btn s-btn__filled" type="button">Confirm</button>
|
|
21
|
-
<button class="s-btn s-btn__muted" type="button">Cancel</button>
|
|
22
|
-
</div>
|
|
23
|
-
<button class="s-modal--close s-btn s-btn__muted" type="button" aria-label="Close">
|
|
24
|
-
${IconClearSm}
|
|
25
|
-
</button>
|
|
26
|
-
</div>
|
|
27
|
-
`,
|
|
28
|
-
},
|
|
29
|
-
tag: "aside",
|
|
30
|
-
attributes: {
|
|
31
|
-
"id": "example-modal",
|
|
32
|
-
"tabindex": "-1",
|
|
33
|
-
"aria-hidden": "false",
|
|
34
|
-
"aria-labelledby": "modal-title",
|
|
35
|
-
"class": "ps-relative p32",
|
|
36
|
-
},
|
|
37
|
-
template: ({ component, testid }) => html`
|
|
38
|
-
<div class="m8 ws6" data-testid="${testid}">${component}</div>
|
|
39
|
-
`,
|
|
40
|
-
});
|
|
41
|
-
});
|