@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,155 +0,0 @@
|
|
|
1
|
-
import { html, fixture, expect } from "@open-wc/testing";
|
|
2
|
-
import { screen, waitFor } from "@testing-library/dom";
|
|
3
|
-
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import "../../index";
|
|
5
|
-
|
|
6
|
-
const user = userEvent.setup();
|
|
7
|
-
|
|
8
|
-
const createModal = ({
|
|
9
|
-
hidden = true,
|
|
10
|
-
initialFocusEl,
|
|
11
|
-
}: { hidden?: boolean; initialFocusEl?: ReturnType<typeof html> } = {}) => html`
|
|
12
|
-
<div data-controller="s-modal">
|
|
13
|
-
<button
|
|
14
|
-
class="s-btn"
|
|
15
|
-
data-action="s-modal#show"
|
|
16
|
-
data-testid="trigger">
|
|
17
|
-
Show Modal
|
|
18
|
-
</button>
|
|
19
|
-
|
|
20
|
-
<aside
|
|
21
|
-
class="s-modal"
|
|
22
|
-
id="modal-base"
|
|
23
|
-
tabindex="-1"
|
|
24
|
-
role="dialog"
|
|
25
|
-
aria-labelledby="modal-base-title"
|
|
26
|
-
aria-describedby="modal-base-description"
|
|
27
|
-
aria-hidden="${hidden}"
|
|
28
|
-
data-s-modal-target="modal"
|
|
29
|
-
data-testid="modal">
|
|
30
|
-
<div class="s-modal--dialog" role="document">
|
|
31
|
-
<h1 class="s-modal--header" id="modal-base-title">Title</h1>
|
|
32
|
-
|
|
33
|
-
<p class="s-modal--body">
|
|
34
|
-
<span id="modal-base-description">Description</span>
|
|
35
|
-
<form>
|
|
36
|
-
<input type="text" data-testid="first-focusable-element" />
|
|
37
|
-
${initialFocusEl}
|
|
38
|
-
</form>
|
|
39
|
-
</p>
|
|
40
|
-
|
|
41
|
-
<div class="d-flex gx8 s-modal--footer">
|
|
42
|
-
<button class="flex--item s-btn s-btn__filled" type="button">Save changes</button>
|
|
43
|
-
<button class="flex--item s-btn" type="button" data-action="s-modal#hide">Cancel</button>
|
|
44
|
-
</div>
|
|
45
|
-
|
|
46
|
-
<button
|
|
47
|
-
class="s-btn s-btn__muted s-modal--close"
|
|
48
|
-
type="button"
|
|
49
|
-
aria-label="Close"
|
|
50
|
-
data-action="s-modal#hide"
|
|
51
|
-
data-testid="close-btn">
|
|
52
|
-
Close
|
|
53
|
-
</button>
|
|
54
|
-
</div>
|
|
55
|
-
</aside>
|
|
56
|
-
</div>
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
describe("modal", () => {
|
|
60
|
-
it("should make the modal visible when toggle button is clicked", async () => {
|
|
61
|
-
await fixture(createModal());
|
|
62
|
-
|
|
63
|
-
const modal = await screen.findByTestId("modal");
|
|
64
|
-
const trigger = await screen.findByTestId("trigger");
|
|
65
|
-
|
|
66
|
-
expect(modal).not.to.be.visible;
|
|
67
|
-
|
|
68
|
-
await user.click(trigger);
|
|
69
|
-
|
|
70
|
-
expect(modal).to.be.visible;
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it("should hide the modal when the close button is clicked", async () => {
|
|
74
|
-
await fixture(createModal({ hidden: false }));
|
|
75
|
-
|
|
76
|
-
const modal = await screen.findByTestId("modal");
|
|
77
|
-
const closeBtn = await screen.findByTestId("close-btn");
|
|
78
|
-
|
|
79
|
-
expect(modal).to.be.visible;
|
|
80
|
-
|
|
81
|
-
await user.click(closeBtn);
|
|
82
|
-
|
|
83
|
-
await waitFor(() => expect(modal).not.to.be.visible);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('should focus on the first element with `data-s-modal-target"initialFocus"` when modal is shown', async () => {
|
|
87
|
-
await fixture(
|
|
88
|
-
createModal({
|
|
89
|
-
initialFocusEl: html`<input
|
|
90
|
-
type="text"
|
|
91
|
-
data-testid="initialFocus"
|
|
92
|
-
data-s-modal-target="initialFocus"
|
|
93
|
-
/>`,
|
|
94
|
-
})
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
const modal = await screen.findByTestId("modal");
|
|
98
|
-
const trigger = await screen.findByTestId("trigger");
|
|
99
|
-
const initialFocusEl = await screen.findByTestId("initialFocus");
|
|
100
|
-
|
|
101
|
-
expect(modal).not.to.be.visible;
|
|
102
|
-
|
|
103
|
-
await user.click(trigger);
|
|
104
|
-
expect(modal).to.be.visible;
|
|
105
|
-
|
|
106
|
-
await waitFor(() => expect(initialFocusEl).to.have.focus);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it("should focus on the first focusable element when modal is shown and no initialFocus is specified", async () => {
|
|
110
|
-
await fixture(createModal());
|
|
111
|
-
|
|
112
|
-
const modal = await screen.findByTestId("modal");
|
|
113
|
-
const trigger = await screen.findByTestId("trigger");
|
|
114
|
-
const focusableEl = await screen.findByTestId(
|
|
115
|
-
"first-focusable-element"
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
expect(modal).not.to.be.visible;
|
|
119
|
-
expect(focusableEl).not.to.have.focus;
|
|
120
|
-
|
|
121
|
-
await user.click(trigger);
|
|
122
|
-
expect(modal).to.be.visible;
|
|
123
|
-
|
|
124
|
-
await waitFor(() => expect(focusableEl).to.have.focus);
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it("should not change set focus when an element within the modal is already focused", async () => {
|
|
128
|
-
await fixture(createModal());
|
|
129
|
-
|
|
130
|
-
const modal = await screen.findByTestId("modal");
|
|
131
|
-
const trigger = await screen.findByTestId("trigger");
|
|
132
|
-
const firstFocusableEl = await screen.findByTestId(
|
|
133
|
-
"first-focusable-element"
|
|
134
|
-
);
|
|
135
|
-
const closeButton = await screen.findByTestId("close-btn");
|
|
136
|
-
|
|
137
|
-
expect(modal).not.to.be.visible;
|
|
138
|
-
expect(firstFocusableEl).not.to.have.focus;
|
|
139
|
-
|
|
140
|
-
await user.click(trigger);
|
|
141
|
-
expect(modal).to.be.visible;
|
|
142
|
-
|
|
143
|
-
// manually focus on an element within the modal
|
|
144
|
-
closeButton.focus();
|
|
145
|
-
|
|
146
|
-
// wait for s-modal:shown css transition to complete
|
|
147
|
-
await new Promise((resolve) =>
|
|
148
|
-
modal.addEventListener("s-modal:shown", resolve)
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
// check that focus stayed on the manually focused element and
|
|
152
|
-
// has not changed to the first focusable element
|
|
153
|
-
expect(closeButton).to.have.focus;
|
|
154
|
-
});
|
|
155
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import { IconClearSm } from "@stackoverflow/stacks-icons/icons";
|
|
4
|
-
import "../../index";
|
|
5
|
-
|
|
6
|
-
describe("modal", () => {
|
|
7
|
-
runVisualTests({
|
|
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
|
-
});
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
3
|
-
import { WCAGNonTextContrast } from "../../test/assertions";
|
|
4
|
-
import "../../index";
|
|
5
|
-
|
|
6
|
-
const items = [
|
|
7
|
-
{
|
|
8
|
-
label: "Group 1",
|
|
9
|
-
title: true,
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
label: "Product",
|
|
13
|
-
selected: true,
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
label: "Email",
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
label: "Group 2",
|
|
20
|
-
title: true,
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
label: "Content",
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
label: "Brand",
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
label: "Marketing",
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
label: "More selected",
|
|
33
|
-
dropdown: true,
|
|
34
|
-
selected: true,
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
label: "More",
|
|
38
|
-
dropdown: true,
|
|
39
|
-
},
|
|
40
|
-
];
|
|
41
|
-
|
|
42
|
-
const getChildren = (includeTitles = false): string =>
|
|
43
|
-
items
|
|
44
|
-
.map((item) => {
|
|
45
|
-
if (item.title) {
|
|
46
|
-
return includeTitles
|
|
47
|
-
? `<li class="s-navigation--title">${item.label}</li>`
|
|
48
|
-
: "";
|
|
49
|
-
}
|
|
50
|
-
const classes = `s-navigation--item${
|
|
51
|
-
item.selected ? " is-selected" : ""
|
|
52
|
-
}${item.dropdown ? " s-navigation--item__dropdown" : ""}`;
|
|
53
|
-
return `<li><a href="#" class="${classes}">${item.label}</a></li>`;
|
|
54
|
-
})
|
|
55
|
-
.join("");
|
|
56
|
-
|
|
57
|
-
describe("navigation", () => {
|
|
58
|
-
runA11yTests({
|
|
59
|
-
baseClass: "s-navigation",
|
|
60
|
-
variants: ["vertical", "muted"],
|
|
61
|
-
modifiers: {
|
|
62
|
-
primary: ["scroll", "sm"],
|
|
63
|
-
},
|
|
64
|
-
tag: "ul",
|
|
65
|
-
children: {
|
|
66
|
-
default: getChildren(true),
|
|
67
|
-
},
|
|
68
|
-
template: ({ component, testid }) => html`
|
|
69
|
-
<nav
|
|
70
|
-
class="d-inline-block p8 wmx3"
|
|
71
|
-
aria-label="example-navigation"
|
|
72
|
-
data-testid="${testid}"
|
|
73
|
-
>
|
|
74
|
-
${component}
|
|
75
|
-
</nav>
|
|
76
|
-
`,
|
|
77
|
-
additionalAssertions: [WCAGNonTextContrast],
|
|
78
|
-
// TODO: fix non-text-contrast SC for s-navigation__muted
|
|
79
|
-
skippedTestids: [/s-navigation-(light|dark)-muted/],
|
|
80
|
-
});
|
|
81
|
-
});
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
const items = [
|
|
6
|
-
{
|
|
7
|
-
label: "Group 1",
|
|
8
|
-
title: true,
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
label: "Product",
|
|
12
|
-
selected: true,
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
label: "Email",
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
label: "Group 2",
|
|
19
|
-
title: true,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
label: "Content",
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
label: "Brand",
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
label: "Marketing",
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
label: "More selected",
|
|
32
|
-
dropdown: true,
|
|
33
|
-
selected: true,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
label: "More",
|
|
37
|
-
dropdown: true,
|
|
38
|
-
},
|
|
39
|
-
];
|
|
40
|
-
|
|
41
|
-
const getChildren = (includeTitles = false): string =>
|
|
42
|
-
items
|
|
43
|
-
.map((item) => {
|
|
44
|
-
if (item.title) {
|
|
45
|
-
return includeTitles
|
|
46
|
-
? `<li class="s-navigation--title">${item.label}</li>`
|
|
47
|
-
: "";
|
|
48
|
-
}
|
|
49
|
-
const classes = `s-navigation--item${
|
|
50
|
-
item.selected ? " is-selected" : ""
|
|
51
|
-
}${item.dropdown ? " s-navigation--item__dropdown" : ""}`;
|
|
52
|
-
return `<li><a href="#" class="${classes}">${item.label}</a></li>`;
|
|
53
|
-
})
|
|
54
|
-
.join("");
|
|
55
|
-
|
|
56
|
-
describe("navigation", () => {
|
|
57
|
-
runVisualTests({
|
|
58
|
-
baseClass: "s-navigation",
|
|
59
|
-
variants: ["muted"],
|
|
60
|
-
modifiers: {
|
|
61
|
-
primary: ["scroll", "sm"],
|
|
62
|
-
},
|
|
63
|
-
tag: "ul",
|
|
64
|
-
children: {
|
|
65
|
-
default: getChildren(),
|
|
66
|
-
},
|
|
67
|
-
template: ({ component, testid }) => html`
|
|
68
|
-
<nav
|
|
69
|
-
class="d-inline-block p8 wmx3"
|
|
70
|
-
aria-label="example-navigation"
|
|
71
|
-
data-testid="${testid}"
|
|
72
|
-
>
|
|
73
|
-
${component}
|
|
74
|
-
</nav>
|
|
75
|
-
`,
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
runVisualTests({
|
|
79
|
-
baseClass: "s-navigation",
|
|
80
|
-
variants: ["vertical"],
|
|
81
|
-
tag: "ul",
|
|
82
|
-
children: {
|
|
83
|
-
default: getChildren(true),
|
|
84
|
-
},
|
|
85
|
-
template: ({ component, testid }) => html`
|
|
86
|
-
<nav
|
|
87
|
-
class="d-inline-block p8 ws2"
|
|
88
|
-
aria-label="example-navigation"
|
|
89
|
-
data-testid="${testid}"
|
|
90
|
-
>
|
|
91
|
-
${component}
|
|
92
|
-
</nav>
|
|
93
|
-
`,
|
|
94
|
-
options: {
|
|
95
|
-
includeNullVariant: false,
|
|
96
|
-
},
|
|
97
|
-
});
|
|
98
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
2
|
-
import "../../index";
|
|
3
|
-
|
|
4
|
-
describe("notice", () => {
|
|
5
|
-
runA11yTests({
|
|
6
|
-
baseClass: "s-notice",
|
|
7
|
-
variants: ["info", "success", "warning", "danger"],
|
|
8
|
-
modifiers: {
|
|
9
|
-
primary: ["important"],
|
|
10
|
-
},
|
|
11
|
-
children: {
|
|
12
|
-
default: `Test notice <code>some code</code> <a class="s-link s-link__inherit s-link__underlined" href="#">Link</a>`,
|
|
13
|
-
},
|
|
14
|
-
tag: "aside",
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
2
|
-
import { html } from "@open-wc/testing";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("notice", () => {
|
|
6
|
-
runVisualTests({
|
|
7
|
-
baseClass: "s-notice",
|
|
8
|
-
variants: ["info", "success", "warning", "danger"],
|
|
9
|
-
modifiers: {
|
|
10
|
-
primary: ["important"],
|
|
11
|
-
},
|
|
12
|
-
attributes: {
|
|
13
|
-
ariaHidden: "false",
|
|
14
|
-
},
|
|
15
|
-
children: {
|
|
16
|
-
default: `Test notice <code>some code</code> <a class="s-link s-link__inherit s-link__underlined" href="#">Link</a>`,
|
|
17
|
-
},
|
|
18
|
-
tag: "aside",
|
|
19
|
-
template: ({ component, testid }) => html`
|
|
20
|
-
<div class="d-inline-block p8 wmx5" data-testid="${testid}">
|
|
21
|
-
${component}
|
|
22
|
-
</div>
|
|
23
|
-
`,
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("page title", () => {
|
|
6
|
-
runA11yTests({
|
|
7
|
-
baseClass: "s-page-title",
|
|
8
|
-
children: {
|
|
9
|
-
default: `
|
|
10
|
-
<div class="s-page-title--text">
|
|
11
|
-
<nav class="s-breadcrumbs" aria-label="example-breadcrumbs">…</nav>
|
|
12
|
-
<h1 class="s-page-title--header">Page title</h1>
|
|
13
|
-
<p class="s-page-title--description">
|
|
14
|
-
Optional description de Finibus Bonorum et Malorum
|
|
15
|
-
</p>
|
|
16
|
-
</div>
|
|
17
|
-
<div class="s-page-title--actions">
|
|
18
|
-
<button class="s-btn s-btn__filled" type="button">Action</button>
|
|
19
|
-
</div>
|
|
20
|
-
`,
|
|
21
|
-
},
|
|
22
|
-
template: ({ component, testid }) => html`
|
|
23
|
-
<div class="d-block p8 ws6" data-testid="${testid}">
|
|
24
|
-
${component}
|
|
25
|
-
</div>
|
|
26
|
-
`,
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1,58 +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 postTitleTemplate = ({ component, testid }: any) => html`
|
|
7
|
-
<div class="d-block p8 ws6" data-testid="${testid}">${component}</div>
|
|
8
|
-
`;
|
|
9
|
-
|
|
10
|
-
const getChildren = ({
|
|
11
|
-
showEverything = false,
|
|
12
|
-
}: {
|
|
13
|
-
showEverything: boolean;
|
|
14
|
-
}) => `
|
|
15
|
-
<div class="s-page-title--text">
|
|
16
|
-
${
|
|
17
|
-
showEverything
|
|
18
|
-
? `
|
|
19
|
-
<nav class="s-breadcrumbs" aria-label="example-breadcrumbs">
|
|
20
|
-
<div class="s-breadcrumbs--item">
|
|
21
|
-
<a class="s-breadcrumbs--link">Stack Overflow</a>
|
|
22
|
-
</div>
|
|
23
|
-
</nav>
|
|
24
|
-
`
|
|
25
|
-
: ""
|
|
26
|
-
}
|
|
27
|
-
<h1 class="s-page-title--header">Page title</h1>
|
|
28
|
-
${
|
|
29
|
-
showEverything
|
|
30
|
-
? `
|
|
31
|
-
<p class="s-page-title--description">
|
|
32
|
-
Optional description de Finibus Bonorum et Malorum
|
|
33
|
-
</p>
|
|
34
|
-
`
|
|
35
|
-
: ""
|
|
36
|
-
}
|
|
37
|
-
</div>
|
|
38
|
-
${
|
|
39
|
-
showEverything
|
|
40
|
-
? `
|
|
41
|
-
<div class="s-page-title--actions">
|
|
42
|
-
<button class="s-btn s-btn__filled" type="button">Action</button>
|
|
43
|
-
</div>
|
|
44
|
-
`
|
|
45
|
-
: ""
|
|
46
|
-
}
|
|
47
|
-
`;
|
|
48
|
-
|
|
49
|
-
describe("page title", () => {
|
|
50
|
-
runVisualTests({
|
|
51
|
-
baseClass: "s-page-title",
|
|
52
|
-
children: {
|
|
53
|
-
default: getChildren({ showEverything: false }),
|
|
54
|
-
complete: getChildren({ showEverything: true }),
|
|
55
|
-
},
|
|
56
|
-
template: postTitleTemplate,
|
|
57
|
-
});
|
|
58
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
2
|
-
import { WCAGNonTextContrast } from "../../test/assertions";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("pagination", () => {
|
|
6
|
-
runA11yTests({
|
|
7
|
-
baseClass: "s-pagination",
|
|
8
|
-
children: {
|
|
9
|
-
default: `
|
|
10
|
-
<a class="s-pagination--item" href="#">Prev</a>
|
|
11
|
-
<a class="s-pagination--item" href="#">1</a>
|
|
12
|
-
<span class="s-pagination--item is-selected" aria-current="page">2</span>
|
|
13
|
-
<a class="s-pagination--item" href="#">3</a>
|
|
14
|
-
<span class="s-pagination--item s-pagination--item__clear">…</span>
|
|
15
|
-
<a class="s-pagination--item" href="#">100</a>
|
|
16
|
-
<a class="s-pagination--item" href="#">Next</a>
|
|
17
|
-
`,
|
|
18
|
-
},
|
|
19
|
-
additionalAssertions: [WCAGNonTextContrast],
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { html } from "@open-wc/testing";
|
|
2
|
-
import { runVisualTests } from "../../test/visual-test-utils";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("pagination", () => {
|
|
6
|
-
runVisualTests({
|
|
7
|
-
baseClass: "s-pagination",
|
|
8
|
-
children: {
|
|
9
|
-
default: `
|
|
10
|
-
<a class="s-pagination--item" href="#">Prev</a>
|
|
11
|
-
<a class="s-pagination--item" href="#">1</a>
|
|
12
|
-
<span class="s-pagination--item is-selected" aria-current="page">2</span>
|
|
13
|
-
<a class="s-pagination--item" href="#">3</a>
|
|
14
|
-
<span class="s-pagination--item s-pagination--item__clear">…</span>
|
|
15
|
-
<a class="s-pagination--item" href="#">100</a>
|
|
16
|
-
<a class="s-pagination--item" href="#">Next</a>
|
|
17
|
-
`,
|
|
18
|
-
},
|
|
19
|
-
template: ({ component, testid }) => html`
|
|
20
|
-
<div class="d-inline-block p8" data-testid="${testid}">
|
|
21
|
-
${component}
|
|
22
|
-
</div>
|
|
23
|
-
`,
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { html, fixture, expect } from "@open-wc/testing";
|
|
2
|
-
import { screen, waitForElementToBeRemoved } from "@testing-library/dom";
|
|
3
|
-
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import "../../index";
|
|
5
|
-
|
|
6
|
-
const user = userEvent.setup();
|
|
7
|
-
|
|
8
|
-
describe("tooltip", () => {
|
|
9
|
-
it("should make the tooltip element visible on hover (after a delay)", async () => {
|
|
10
|
-
const trigger = await fixture(html`
|
|
11
|
-
<button
|
|
12
|
-
class="s-btn s-btn__filled"
|
|
13
|
-
role="button"
|
|
14
|
-
data-controller="s-tooltip"
|
|
15
|
-
title="tooltip content"
|
|
16
|
-
data-s-tooltip-placement="bottom-start"
|
|
17
|
-
>
|
|
18
|
-
Hover tooltip popover
|
|
19
|
-
</button>
|
|
20
|
-
`);
|
|
21
|
-
|
|
22
|
-
expect(screen.queryByRole("tooltip")).to.be.null;
|
|
23
|
-
|
|
24
|
-
await user.hover(trigger);
|
|
25
|
-
const tooltip = await screen.findByRole("tooltip");
|
|
26
|
-
expect(tooltip).to.be.visible;
|
|
27
|
-
|
|
28
|
-
await user.unhover(trigger);
|
|
29
|
-
await waitForElementToBeRemoved(() => screen.queryByRole("tooltip"));
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it("should not flicker when the host contains an SVG and the user hover on it", async () => {
|
|
33
|
-
await fixture(html`
|
|
34
|
-
<button
|
|
35
|
-
class="s-btn"
|
|
36
|
-
role="button"
|
|
37
|
-
title="tooltip content"
|
|
38
|
-
data-controller="s-tooltip"
|
|
39
|
-
data-s-tooltip-placement="bottom-start"
|
|
40
|
-
>
|
|
41
|
-
<svg
|
|
42
|
-
data-testid="svg"
|
|
43
|
-
aria-hidden="true"
|
|
44
|
-
class="bg-red-400"
|
|
45
|
-
width="18"
|
|
46
|
-
height="18"
|
|
47
|
-
viewBox="0 0 18 18"
|
|
48
|
-
></svg>
|
|
49
|
-
👈 Shouldn't flicker 🤷
|
|
50
|
-
</button>
|
|
51
|
-
`);
|
|
52
|
-
const button = screen.getByRole("button");
|
|
53
|
-
const svg = screen.getByTestId("svg");
|
|
54
|
-
|
|
55
|
-
await user.hover(button);
|
|
56
|
-
const tooltip = await screen.findByRole("tooltip");
|
|
57
|
-
expect(tooltip).to.be.visible;
|
|
58
|
-
|
|
59
|
-
await user.hover(svg);
|
|
60
|
-
expect(tooltip).to.be.visible;
|
|
61
|
-
});
|
|
62
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { runA11yTests } from "../../test/a11y-test-utils";
|
|
2
|
-
import testArgs from "./post-summary.test.setup";
|
|
3
|
-
import "../../index";
|
|
4
|
-
|
|
5
|
-
describe("post-summary", () => {
|
|
6
|
-
// Base, sparce
|
|
7
|
-
runA11yTests({
|
|
8
|
-
...testArgs.base,
|
|
9
|
-
// TODO resolve test failures
|
|
10
|
-
skippedTestids: [
|
|
11
|
-
/-deleted/,
|
|
12
|
-
/-ignored/,
|
|
13
|
-
/-highcontrast-(light|dark)-watched/,
|
|
14
|
-
],
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
// Truncated description sizes
|
|
18
|
-
runA11yTests(testArgs.sizes);
|
|
19
|
-
|
|
20
|
-
// Stats - answers, view hotness
|
|
21
|
-
runA11yTests(testArgs.stats);
|
|
22
|
-
|
|
23
|
-
// Badges
|
|
24
|
-
runA11yTests(testArgs.badges);
|
|
25
|
-
});
|