@stackoverflow/stacks 1.9.0 → 1.9.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.
Files changed (132) hide show
  1. package/README.md +161 -153
  2. package/dist/components/table/table.d.ts +26 -4
  3. package/dist/css/stacks.css +21 -6
  4. package/dist/css/stacks.min.css +1 -1
  5. package/dist/js/stacks.js +93 -64
  6. package/dist/js/stacks.min.js +1 -1
  7. package/lib/atomic/border.less +397 -397
  8. package/lib/atomic/color.less +210 -210
  9. package/lib/atomic/flex.less +426 -426
  10. package/lib/atomic/gap.less +44 -44
  11. package/lib/atomic/grid.less +139 -139
  12. package/lib/atomic/misc.less +343 -343
  13. package/lib/atomic/spacing.less +342 -342
  14. package/lib/atomic/typography.less +267 -267
  15. package/lib/atomic/width-height.less +194 -194
  16. package/lib/base/body.less +44 -44
  17. package/lib/base/configuration-static.less +61 -61
  18. package/lib/base/fieldset.less +5 -5
  19. package/lib/base/icon.less +11 -11
  20. package/lib/base/internal.less +220 -220
  21. package/lib/base/reset-meyer.less +64 -64
  22. package/lib/base/reset-normalize.less +449 -449
  23. package/lib/base/reset.less +20 -20
  24. package/lib/components/activity-indicator/activity-indicator.a11y.test.ts +21 -21
  25. package/lib/components/activity-indicator/activity-indicator.less +40 -40
  26. package/lib/components/activity-indicator/activity-indicator.visual.test.ts +23 -23
  27. package/lib/components/anchor/anchor.less +61 -61
  28. package/lib/components/avatar/avatar.a11y.test.ts +36 -36
  29. package/lib/components/avatar/avatar.less +108 -108
  30. package/lib/components/avatar/avatar.visual.test.ts +54 -54
  31. package/lib/components/award-bling/award-bling.a11y.test.ts +17 -0
  32. package/lib/components/award-bling/award-bling.less +31 -31
  33. package/lib/components/award-bling/award-bling.visual.test.ts +26 -0
  34. package/lib/components/badge/badge.less +251 -251
  35. package/lib/components/banner/banner.a11y.test.ts +37 -0
  36. package/lib/components/banner/banner.less +51 -51
  37. package/lib/components/banner/banner.test.ts +73 -77
  38. package/lib/components/banner/banner.ts +149 -149
  39. package/lib/components/banner/banner.visual.test.ts +37 -36
  40. package/lib/components/block-link/block-link.a11y.test.ts +68 -0
  41. package/lib/components/block-link/block-link.less +80 -80
  42. package/lib/components/block-link/block-link.visual.test.ts +61 -0
  43. package/lib/components/breadcrumbs/breadcrumbs.a11y.test.ts +37 -0
  44. package/lib/components/breadcrumbs/breadcrumbs.less +41 -41
  45. package/lib/components/breadcrumbs/breadcrumbs.visual.test.ts +37 -0
  46. package/lib/components/button/button.a11y.test.ts +32 -32
  47. package/lib/components/button/button.less +502 -502
  48. package/lib/components/button/button.visual.test.ts +52 -52
  49. package/lib/components/button-group/button-group.less +83 -83
  50. package/lib/components/card/card.a11y.test.ts +13 -0
  51. package/lib/components/card/card.less +29 -29
  52. package/lib/components/card/card.visual.test.ts +54 -0
  53. package/lib/components/check-control/check-control.less +17 -17
  54. package/lib/components/check-group/check-group.less +19 -19
  55. package/lib/components/checkbox_radio/checkbox_radio.less +158 -158
  56. package/lib/components/code-block/code-block.less +116 -116
  57. package/lib/components/description/description.less +9 -9
  58. package/lib/components/empty-state/empty-state.less +16 -16
  59. package/lib/components/expandable/expandable.less +118 -118
  60. package/lib/components/expandable/expandable.test.ts +51 -53
  61. package/lib/components/expandable/expandable.ts +238 -238
  62. package/lib/components/input-fill/input-fill.less +35 -35
  63. package/lib/components/input-icon/input-icon.less +45 -45
  64. package/lib/components/input-message/input-message.less +48 -48
  65. package/lib/components/input_textarea/input_textarea.less +166 -166
  66. package/lib/components/label/label.less +111 -111
  67. package/lib/components/link/link.less +119 -119
  68. package/lib/components/link-preview/link-preview.less +139 -139
  69. package/lib/components/menu/menu.less +41 -41
  70. package/lib/components/modal/modal.less +113 -113
  71. package/lib/components/modal/modal.ts +379 -379
  72. package/lib/components/navigation/navigation.less +134 -134
  73. package/lib/components/navigation/navigation.ts +128 -128
  74. package/lib/components/notice/notice.less +203 -203
  75. package/lib/components/page-title/page-title.less +51 -51
  76. package/lib/components/pagination/pagination.less +52 -52
  77. package/lib/components/popover/popover.less +148 -148
  78. package/lib/components/popover/popover.ts +651 -651
  79. package/lib/components/popover/tooltip.test.ts +62 -66
  80. package/lib/components/popover/tooltip.ts +343 -343
  81. package/lib/components/popover/tooltip.visual.test.ts +31 -31
  82. package/lib/components/post-summary/post-summary.less +415 -415
  83. package/lib/components/progress-bar/progress-bar.less +291 -291
  84. package/lib/components/prose/prose.less +452 -452
  85. package/lib/components/select/select.less +148 -148
  86. package/lib/components/sidebar-widget/sidebar-widget.less +257 -258
  87. package/lib/components/spinner/spinner.less +103 -103
  88. package/lib/components/table/table.less +307 -292
  89. package/lib/components/table/table.test.ts +366 -0
  90. package/lib/components/table/table.ts +296 -263
  91. package/lib/components/table-container/table-container.less +4 -4
  92. package/lib/components/tag/tag.less +213 -213
  93. package/lib/components/toast/toast.less +35 -35
  94. package/lib/components/toast/toast.test.ts +63 -67
  95. package/lib/components/toast/toast.ts +357 -357
  96. package/lib/components/toast/toast.visual.test.ts +27 -27
  97. package/lib/components/toggle-switch/toggle-switch.less +110 -110
  98. package/lib/components/topbar/topbar.less +436 -435
  99. package/lib/components/uploader/uploader.less +195 -195
  100. package/lib/components/uploader/uploader.ts +205 -205
  101. package/lib/components/user-card/user-card.less +129 -129
  102. package/lib/controllers.ts +33 -33
  103. package/lib/exports/constants-colors.less +1112 -1111
  104. package/lib/exports/constants-helpers.less +108 -108
  105. package/lib/exports/constants-type.less +153 -153
  106. package/lib/exports/exports.less +15 -15
  107. package/lib/exports/mixins.less +299 -299
  108. package/lib/index.ts +32 -32
  109. package/lib/input-utils.less +44 -44
  110. package/lib/stacks-dynamic.less +24 -24
  111. package/lib/stacks-static.less +93 -93
  112. package/lib/stacks.less +13 -13
  113. package/lib/stacks.ts +113 -113
  114. package/lib/test/open-wc-testing-patch.d.ts +26 -0
  115. package/lib/test/test-utils.ts +466 -444
  116. package/lib/tsconfig.build.json +4 -0
  117. package/lib/tsconfig.json +16 -13
  118. package/package.json +106 -105
  119. package/dist/components/activity-indicator/activity-indicator.a11y.test.d.ts +0 -1
  120. package/dist/components/activity-indicator/activity-indicator.visual.test.d.ts +0 -1
  121. package/dist/components/avatar/avatar.a11y.test.d.ts +0 -1
  122. package/dist/components/avatar/avatar.visual.test.d.ts +0 -1
  123. package/dist/components/banner/banner.test.d.ts +0 -1
  124. package/dist/components/banner/banner.visual.test.d.ts +0 -1
  125. package/dist/components/button/button.a11y.test.d.ts +0 -1
  126. package/dist/components/button/button.visual.test.d.ts +0 -1
  127. package/dist/components/expandable/expandable.test.d.ts +0 -1
  128. package/dist/components/popover/tooltip.test.d.ts +0 -1
  129. package/dist/components/popover/tooltip.visual.test.d.ts +0 -1
  130. package/dist/components/toast/toast.test.d.ts +0 -1
  131. package/dist/components/toast/toast.visual.test.d.ts +0 -1
  132. package/dist/test/test-utils.d.ts +0 -136
@@ -1,77 +1,73 @@
1
- import { html, fixture, expect } from "@open-wc/testing";
2
- import { screen } from "@testing-library/dom";
3
- import userEvent from "@testing-library/user-event";
4
- import "../../index";
5
- import { showBanner, hideBanner } from "../../controllers";
6
-
7
- const user = userEvent.setup();
8
-
9
- describe("banner", () => {
10
- it("trigger should make banner visible", async () => {
11
- await fixture(html`
12
- <button data-toggle="s-banner" data-target="#test-banner">
13
- Show test banner
14
- </button>
15
- <aside
16
- role="alert"
17
- id="test-banner"
18
- class="s-banner"
19
- aria-labelledby="banner-message"
20
- aria-hidden="true"
21
- data-controller="s-banner"
22
- data-s-banner-target="banner"
23
- data-testid="test-banner"
24
- >
25
- Test banner
26
- </aside>
27
- `);
28
-
29
- const button = screen.getByRole("button");
30
- const banner = screen.getByTestId("test-banner");
31
-
32
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
33
- expect(banner).to.have.attribute("aria-hidden", "true");
34
- button.addEventListener("click", () => showBanner(banner));
35
-
36
- await user.click(button);
37
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
38
- expect(banner).to.have.attribute("aria-hidden", "false");
39
- });
40
-
41
- it("trigger should hide banner", async () => {
42
- await fixture(html`
43
- <aside
44
- role="alert"
45
- id="test-banner"
46
- class="s-banner"
47
- aria-labelledby="banner-message"
48
- aria-hidden="false"
49
- data-controller="s-banner"
50
- data-s-banner-target="banner"
51
- data-testid="test-banner"
52
- >
53
- Test banner
54
- <button
55
- type="button"
56
- class="s-btn s-banner--btn"
57
- aria-label="Dismiss"
58
- data-toggle="s-banner"
59
- data-target="#test-banner"
60
- >
61
- Close banner
62
- </button>
63
- </aside>
64
- `);
65
-
66
- const button = screen.getByRole("button");
67
- const banner = screen.getByTestId("test-banner");
68
-
69
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
70
- expect(banner).to.have.attribute("aria-hidden", "false");
71
- button.addEventListener("click", () => hideBanner(banner));
72
-
73
- await user.click(button);
74
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
75
- expect(banner).to.have.attribute("aria-hidden", "true");
76
- });
77
- });
1
+ import { html, fixture, expect } from "@open-wc/testing";
2
+ import { screen } from "@testing-library/dom";
3
+ import userEvent from "@testing-library/user-event";
4
+ import "../../index";
5
+ import { showBanner, hideBanner } from "../../controllers";
6
+
7
+ const user = userEvent.setup();
8
+
9
+ describe("banner", () => {
10
+ it("trigger should make banner visible", async () => {
11
+ await fixture(html`
12
+ <button data-toggle="s-banner" data-target="#test-banner">
13
+ Show test banner
14
+ </button>
15
+ <aside
16
+ role="alert"
17
+ id="test-banner"
18
+ class="s-banner"
19
+ aria-labelledby="banner-message"
20
+ aria-hidden="true"
21
+ data-controller="s-banner"
22
+ data-s-banner-target="banner"
23
+ data-testid="test-banner"
24
+ >
25
+ Test banner
26
+ </aside>
27
+ `);
28
+
29
+ const button = screen.getByRole("button");
30
+ const banner = screen.getByTestId("test-banner");
31
+
32
+ expect(banner).to.have.attribute("aria-hidden", "true");
33
+ button.addEventListener("click", () => showBanner(banner));
34
+
35
+ await user.click(button);
36
+ expect(banner).to.have.attribute("aria-hidden", "false");
37
+ });
38
+
39
+ it("trigger should hide banner", async () => {
40
+ await fixture(html`
41
+ <aside
42
+ role="alert"
43
+ id="test-banner"
44
+ class="s-banner"
45
+ aria-labelledby="banner-message"
46
+ aria-hidden="false"
47
+ data-controller="s-banner"
48
+ data-s-banner-target="banner"
49
+ data-testid="test-banner"
50
+ >
51
+ Test banner
52
+ <button
53
+ type="button"
54
+ class="s-btn s-banner--btn"
55
+ aria-label="Dismiss"
56
+ data-toggle="s-banner"
57
+ data-target="#test-banner"
58
+ >
59
+ Close banner
60
+ </button>
61
+ </aside>
62
+ `);
63
+
64
+ const button = screen.getByRole("button");
65
+ const banner = screen.getByTestId("test-banner");
66
+
67
+ expect(banner).to.have.attribute("aria-hidden", "false");
68
+ button.addEventListener("click", () => hideBanner(banner));
69
+
70
+ await user.click(button);
71
+ expect(banner).to.have.attribute("aria-hidden", "true");
72
+ });
73
+ });
@@ -1,149 +1,149 @@
1
- import * as Stacks from "../../stacks";
2
-
3
- export class BannerController extends Stacks.StacksController {
4
- static targets = ["banner"];
5
-
6
- declare readonly bannerTarget: HTMLElement;
7
-
8
- /**
9
- * Toggles the visibility of the banner
10
- */
11
- toggle(dispatcher: Event | Element | null = null) {
12
- this._toggle(undefined, dispatcher);
13
- }
14
-
15
- /**
16
- * Shows the banner
17
- */
18
- show(dispatcher: Event | Element | null = null) {
19
- this._toggle(true, dispatcher);
20
- }
21
-
22
- /**
23
- * Hides the banner
24
- */
25
- hide(dispatcher: Event | Element | null = null) {
26
- this._toggle(false, dispatcher);
27
- }
28
-
29
- /**
30
- * Toggles the visibility of the banner element
31
- * @param show Optional parameter that force shows/hides the element or toggles it if left undefined
32
- */
33
- private _toggle(
34
- show?: boolean | undefined,
35
- dispatcher: Event | Element | null = null
36
- ) {
37
- let toShow = show;
38
- const isVisible =
39
- this.bannerTarget.getAttribute("aria-hidden") === "false";
40
-
41
- // if we're letting the class toggle, we need to figure out if the banner is visible manually
42
- if (typeof toShow === "undefined") {
43
- toShow = !isVisible;
44
- }
45
-
46
- // if the state matches the disired state, return without changing anything
47
- if ((toShow && isVisible) || (!toShow && !isVisible)) {
48
- return;
49
- }
50
-
51
- const dispatchingElement = this.getDispatcher(dispatcher);
52
-
53
- // show/hide events trigger before toggling the class
54
- const triggeredEvent = this.triggerEvent(
55
- toShow ? "show" : "hide",
56
- {
57
- dispatcher: this.getDispatcher(dispatchingElement),
58
- },
59
- this.bannerTarget
60
- );
61
-
62
- // if this pre-show/hide event was prevented, don't attempt to continue changing the banner state
63
- if (triggeredEvent.defaultPrevented) {
64
- return;
65
- }
66
-
67
- this.bannerTarget.setAttribute(
68
- "aria-hidden",
69
- toShow ? "false" : "true"
70
- );
71
-
72
- if (!toShow) {
73
- this.removeBannerOnHide();
74
- }
75
-
76
- this.triggerEvent(
77
- toShow ? "shown" : "hidden",
78
- {
79
- dispatcher: dispatchingElement,
80
- },
81
- this.bannerTarget
82
- );
83
- }
84
-
85
- /**
86
- * Remove the element on hide if the `remove-when-hidden` flag is set
87
- */
88
- private removeBannerOnHide() {
89
- if (this.data.get("remove-when-hidden") !== "true") {
90
- return;
91
- }
92
-
93
- this.bannerTarget.addEventListener(
94
- "s-banner:hidden",
95
- () => {
96
- this.element.remove();
97
- },
98
- { once: true }
99
- );
100
- }
101
-
102
- /**
103
- * Determines the correct dispatching element from a potential input
104
- * @param dispatcher The event or element to get the dispatcher from
105
- */
106
- private getDispatcher(dispatcher: Event | Element | null = null): Element {
107
- if (dispatcher instanceof Event) {
108
- return <Element>dispatcher.target;
109
- } else if (dispatcher instanceof Element) {
110
- return dispatcher;
111
- } else {
112
- return this.element;
113
- }
114
- }
115
- }
116
-
117
- /**
118
- * Helper to manually show an s-banner element via external JS
119
- * @param element the element the `data-controller="s-banner"` attribute is on
120
- */
121
- export function showBanner(element: HTMLElement) {
122
- toggleBanner(element, true);
123
- }
124
-
125
- /**
126
- * Helper to manually hide an s-banner element via external JS
127
- * @param element the element the `data-controller="s-banner"` attribute is on
128
- */
129
- export function hideBanner(element: HTMLElement) {
130
- toggleBanner(element, false);
131
- }
132
-
133
- /**
134
- * Helper to manually show an s-banner element via external JS
135
- * @param element the element the `data-controller="s-banner"` attribute is on
136
- * @param show whether to force show/hide the banner; toggles the banner if left undefined
137
- */
138
- function toggleBanner(element: HTMLElement, show?: boolean | undefined) {
139
- const controller = Stacks.application.getControllerForElementAndIdentifier(
140
- element,
141
- "s-banner"
142
- ) as BannerController;
143
-
144
- if (!controller) {
145
- throw "Unable to get s-banner controller from element";
146
- }
147
-
148
- show ? controller.show() : controller.hide();
149
- }
1
+ import * as Stacks from "../../stacks";
2
+
3
+ export class BannerController extends Stacks.StacksController {
4
+ static targets = ["banner"];
5
+
6
+ declare readonly bannerTarget: HTMLElement;
7
+
8
+ /**
9
+ * Toggles the visibility of the banner
10
+ */
11
+ toggle(dispatcher: Event | Element | null = null) {
12
+ this._toggle(undefined, dispatcher);
13
+ }
14
+
15
+ /**
16
+ * Shows the banner
17
+ */
18
+ show(dispatcher: Event | Element | null = null) {
19
+ this._toggle(true, dispatcher);
20
+ }
21
+
22
+ /**
23
+ * Hides the banner
24
+ */
25
+ hide(dispatcher: Event | Element | null = null) {
26
+ this._toggle(false, dispatcher);
27
+ }
28
+
29
+ /**
30
+ * Toggles the visibility of the banner element
31
+ * @param show Optional parameter that force shows/hides the element or toggles it if left undefined
32
+ */
33
+ private _toggle(
34
+ show?: boolean | undefined,
35
+ dispatcher: Event | Element | null = null
36
+ ) {
37
+ let toShow = show;
38
+ const isVisible =
39
+ this.bannerTarget.getAttribute("aria-hidden") === "false";
40
+
41
+ // if we're letting the class toggle, we need to figure out if the banner is visible manually
42
+ if (typeof toShow === "undefined") {
43
+ toShow = !isVisible;
44
+ }
45
+
46
+ // if the state matches the disired state, return without changing anything
47
+ if ((toShow && isVisible) || (!toShow && !isVisible)) {
48
+ return;
49
+ }
50
+
51
+ const dispatchingElement = this.getDispatcher(dispatcher);
52
+
53
+ // show/hide events trigger before toggling the class
54
+ const triggeredEvent = this.triggerEvent(
55
+ toShow ? "show" : "hide",
56
+ {
57
+ dispatcher: this.getDispatcher(dispatchingElement),
58
+ },
59
+ this.bannerTarget
60
+ );
61
+
62
+ // if this pre-show/hide event was prevented, don't attempt to continue changing the banner state
63
+ if (triggeredEvent.defaultPrevented) {
64
+ return;
65
+ }
66
+
67
+ this.bannerTarget.setAttribute(
68
+ "aria-hidden",
69
+ toShow ? "false" : "true"
70
+ );
71
+
72
+ if (!toShow) {
73
+ this.removeBannerOnHide();
74
+ }
75
+
76
+ this.triggerEvent(
77
+ toShow ? "shown" : "hidden",
78
+ {
79
+ dispatcher: dispatchingElement,
80
+ },
81
+ this.bannerTarget
82
+ );
83
+ }
84
+
85
+ /**
86
+ * Remove the element on hide if the `remove-when-hidden` flag is set
87
+ */
88
+ private removeBannerOnHide() {
89
+ if (this.data.get("remove-when-hidden") !== "true") {
90
+ return;
91
+ }
92
+
93
+ this.bannerTarget.addEventListener(
94
+ "s-banner:hidden",
95
+ () => {
96
+ this.element.remove();
97
+ },
98
+ { once: true }
99
+ );
100
+ }
101
+
102
+ /**
103
+ * Determines the correct dispatching element from a potential input
104
+ * @param dispatcher The event or element to get the dispatcher from
105
+ */
106
+ private getDispatcher(dispatcher: Event | Element | null = null): Element {
107
+ if (dispatcher instanceof Event) {
108
+ return <Element>dispatcher.target;
109
+ } else if (dispatcher instanceof Element) {
110
+ return dispatcher;
111
+ } else {
112
+ return this.element;
113
+ }
114
+ }
115
+ }
116
+
117
+ /**
118
+ * Helper to manually show an s-banner element via external JS
119
+ * @param element the element the `data-controller="s-banner"` attribute is on
120
+ */
121
+ export function showBanner(element: HTMLElement) {
122
+ toggleBanner(element, true);
123
+ }
124
+
125
+ /**
126
+ * Helper to manually hide an s-banner element via external JS
127
+ * @param element the element the `data-controller="s-banner"` attribute is on
128
+ */
129
+ export function hideBanner(element: HTMLElement) {
130
+ toggleBanner(element, false);
131
+ }
132
+
133
+ /**
134
+ * Helper to manually show an s-banner element via external JS
135
+ * @param element the element the `data-controller="s-banner"` attribute is on
136
+ * @param show whether to force show/hide the banner; toggles the banner if left undefined
137
+ */
138
+ function toggleBanner(element: HTMLElement, show?: boolean | undefined) {
139
+ const controller = Stacks.application.getControllerForElementAndIdentifier(
140
+ element,
141
+ "s-banner"
142
+ ) as BannerController;
143
+
144
+ if (!controller) {
145
+ throw "Unable to get s-banner controller from element";
146
+ }
147
+
148
+ show ? controller.show() : controller.hide();
149
+ }
@@ -1,36 +1,37 @@
1
- import { runComponentTests } from "../../test/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-describedby="banner-message"
9
- >
10
- <div aria-label="banner message">
11
- Test Banner
12
- </div>
13
- <div class="ml-auto myn8">
14
- <span class="s-btn s-banner--btn">Close</span>
15
- </div>
16
- </div>
17
- `;
18
-
19
- describe("banner", () => {
20
- runComponentTests({
21
- type: "visual",
22
- baseClass: "s-banner",
23
- variants: ["info", "success", "warning", "danger"],
24
- modifiers: {
25
- primary: ["important"],
26
- },
27
- attributes: {
28
- role: "alert",
29
- ariaHidden: "false",
30
- },
31
- children: {
32
- default: bannerChild,
33
- },
34
- tag: "aside",
35
- });
36
- });
1
+ import { runComponentTests } from "../../test/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
+ runComponentTests({
23
+ type: "visual",
24
+ baseClass: "s-banner",
25
+ variants: ["info", "success", "warning", "danger"],
26
+ modifiers: {
27
+ primary: ["important"],
28
+ },
29
+ attributes: {
30
+ role: "alert",
31
+ ariaHidden: "false",
32
+ },
33
+ children: {
34
+ default: bannerChild,
35
+ },
36
+ });
37
+ });
@@ -0,0 +1,68 @@
1
+ import { html } from "@open-wc/testing";
2
+ import { defaultOptions, runComponentTests } from "../../test/test-utils";
3
+ import "../../index";
4
+
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ const blockLinkTemplate = ({ component, testid }: any) => html`<div
7
+ class="d-inline-flex ai-center jc-center hs1 ws2 p8"
8
+ data-testid="${testid}"
9
+ >
10
+ ${component}
11
+ </div>`;
12
+
13
+ describe("block-link", () => {
14
+ // Base block link
15
+ runComponentTests({
16
+ type: "a11y",
17
+ baseClass: "s-block-link",
18
+ modifiers: {
19
+ global: ["is-selected"],
20
+ },
21
+ children: {
22
+ default: `block link`,
23
+ },
24
+ template: blockLinkTemplate,
25
+ });
26
+
27
+ // Base + danger
28
+ runComponentTests({
29
+ type: "a11y",
30
+ baseClass: "s-block-link",
31
+ modifiers: {
32
+ primary: ["danger"],
33
+ },
34
+ children: {
35
+ default: `block link`,
36
+ },
37
+ options: {
38
+ ...defaultOptions,
39
+ includeNullModifier: false,
40
+ },
41
+ skippedTestids: ["s-block-link-dark-danger"],
42
+ template: blockLinkTemplate,
43
+ });
44
+
45
+ // All left and rignt variants
46
+ runComponentTests({
47
+ type: "a11y",
48
+ baseClass: "s-block-link",
49
+ variants: ["left is-selected", "right is-selected"],
50
+ modifiers: {
51
+ primary: ["danger"],
52
+ },
53
+ children: {
54
+ default: `block link`,
55
+ },
56
+ options: {
57
+ ...defaultOptions,
58
+ includeNullVariant: false,
59
+ },
60
+ skippedTestids: [
61
+ "s-block-link-dark-left-is-selected-danger",
62
+ "s-block-link-dark-right-is-selected-danger",
63
+ "s-block-link-light-left-is-selected-danger",
64
+ "s-block-link-light-right-is-selected-danger",
65
+ ],
66
+ template: blockLinkTemplate,
67
+ });
68
+ });