@kaizen/components 1.61.0 → 1.61.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 (105) hide show
  1. package/codemods/utils/__snapshots__/transformSource.spec.ts.snap +2 -2
  2. package/dist/cjs/RichTextEditor/RichTextContent/RichTextContent.cjs +10 -1
  3. package/dist/esm/RichTextEditor/RichTextContent/RichTextContent.mjs +11 -2
  4. package/dist/styles.css +115 -114
  5. package/package.json +5 -4
  6. package/src/Avatar/Avatar.spec.tsx +1 -1
  7. package/src/Calendar/utils/setFocusInCalendar.spec.tsx +2 -2
  8. package/src/Checkbox/Checkbox/Checkbox.spec.tsx +2 -2
  9. package/src/Collapsible/Collapsible/Collapsible.spec.tsx +2 -14
  10. package/src/Collapsible/Collapsible/_docs/Collapsible.stickersheet.stories.tsx +49 -0
  11. package/src/Collapsible/Collapsible/_docs/Collapsible.stories.tsx +0 -11
  12. package/src/DateInput/DateInputDescription/DateInputDescription.spec.tsx +5 -6
  13. package/src/DateInput/DateInputWithIconButton/DateInputWithIconButton.spec.tsx +4 -6
  14. package/src/DatePicker/DatePicker.spec.tsx +32 -36
  15. package/src/DatePicker/subcomponents/DateInputField/DateInputField.spec.tsx +13 -13
  16. package/src/DatePicker/utils/validateDate.spec.ts +5 -6
  17. package/src/EmptyState/EmptyState.spec.tsx +1 -1
  18. package/src/ErrorPage/ErrorPage.spec.tsx +19 -19
  19. package/src/Filter/FilterBar/FilterBar.spec.tsx +26 -26
  20. package/src/Filter/FilterBar/context/utils/updateDependentFilters.spec.ts +2 -4
  21. package/src/Filter/FilterBar/subcomponents/AddFiltersMenu/AddFiltersMenu.spec.tsx +3 -4
  22. package/src/Filter/FilterBar/subcomponents/FilterBarButton/FilterBarButton.spec.tsx +3 -6
  23. package/src/Filter/FilterBar/subcomponents/FilterBarDatePicker/FilterBarDatePicker.spec.tsx +10 -12
  24. package/src/Filter/FilterBar/subcomponents/FilterBarDateRangePicker/FilterBarDateRangePicker.spec.tsx +9 -10
  25. package/src/Filter/FilterBar/subcomponents/FilterBarMultiSelect/FilterBarMultiSelect.spec.tsx +12 -14
  26. package/src/Filter/FilterBar/subcomponents/FilterBarSelect/FilterBarSelect.spec.tsx +11 -13
  27. package/src/Filter/FilterButton/FilterButtonRemovable/FilterButtonRemovable.spec.tsx +5 -5
  28. package/src/Filter/FilterDatePicker/FilterDatePicker.spec.tsx +12 -15
  29. package/src/Filter/FilterDatePicker/hooks/useDateInputHandlers.spec.ts +12 -15
  30. package/src/Filter/FilterDatePicker/hooks/useDateValidation.spec.ts +3 -5
  31. package/src/Filter/FilterDatePicker/subcomponents/FilterDatePickerField/FilterDatePickerField.spec.tsx +23 -28
  32. package/src/Filter/FilterDatePicker/utils/getDateValidationHandler.spec.tsx +2 -6
  33. package/src/Filter/FilterDatePicker/utils/validateDate.spec.ts +5 -6
  34. package/src/Filter/FilterDateRangePicker/FilterDateRangePicker.spec.tsx +2 -3
  35. package/src/Filter/FilterDateRangePicker/_docs/FilterDateRangePicker.stickersheet.stories.tsx +27 -0
  36. package/src/Filter/FilterDateRangePicker/subcomponents/DateRangeInputField/DateRangeInputField.spec.tsx +9 -11
  37. package/src/Filter/FilterDateRangePicker/subcomponents/DateRangeValidationMessage/DateRangeValidationMessage.spec.tsx +1 -63
  38. package/src/Filter/FilterDateRangePicker/subcomponents/FilterDateRangePickerField/FilterDateRangePickerField.spec.tsx +32 -32
  39. package/src/Filter/FilterDateRangePicker/subcomponents/FilterDateRangePickerField/hooks/useEndDateValidation.spec.ts +3 -8
  40. package/src/Filter/FilterDateRangePicker/subcomponents/FilterDateRangePickerField/hooks/useStartDateValidation.spec.ts +2 -5
  41. package/src/Filter/FilterDateRangePicker/subcomponents/FilterDateRangePickerField/utils/validateEndDateBeforeStartDate.spec.ts +2 -3
  42. package/src/Filter/FilterMultiSelect/FilterMultiSelect.spec.tsx +9 -10
  43. package/src/Filter/FilterMultiSelect/context/MenuTriggerProvider/MenuTriggerProvider.spec.tsx +2 -1
  44. package/src/Filter/FilterMultiSelect/context/SelectionProvider/SelectionProvider.spec.tsx +32 -32
  45. package/src/Filter/FilterMultiSelect/subcomponents/MultiSelectOption/MultiSelectOption.spec.tsx +9 -7
  46. package/src/Filter/FilterMultiSelect/subcomponents/SearchInput/SearchInput.spec.tsx +12 -12
  47. package/src/Filter/FilterMultiSelect/subcomponents/SelectionControlButton/ClearButton/ClearButton.spec.tsx +7 -7
  48. package/src/Filter/FilterMultiSelect/subcomponents/SelectionControlButton/SelectAllButton/SelectAllButton.spec.tsx +9 -9
  49. package/src/Filter/FilterSelect/FilterSelect.spec.tsx +2 -2
  50. package/src/Heading/Heading.spec.tsx +1 -31
  51. package/src/Illustration/subcomponents/VideoPlayer/VideoPlayer.spec.tsx +43 -97
  52. package/src/Illustration/subcomponents/VideoPlayer/VideoPlayer.stickersheet.stories.tsx +68 -0
  53. package/src/Illustration/subcomponents/VideoPlayer/VideoPlayer.stories.tsx +37 -0
  54. package/src/Input/InputRange/InputRange.spec.tsx +2 -2
  55. package/src/Input/InputSearch/InputSearch.spec.tsx +3 -5
  56. package/src/KaizenProvider/KaizenProvider.spec.tsx +2 -2
  57. package/src/KaizenProvider/subcomponents/OptionalIntlProvider/OptionalIntlProvider.spec.tsx +2 -3
  58. package/src/Modal/ConfirmationModal/ConfirmationModal.spec.tsx +7 -7
  59. package/src/Modal/ContextModal/ContextModal.spec.tsx +5 -5
  60. package/src/Modal/GenericModal/GenericModal.spec.tsx +4 -4
  61. package/src/Modal/InputEditModal/InputEditModal.spec.tsx +7 -7
  62. package/src/MultiSelect/subcomponents/MultiSelectOptionField/MultiSelectOptionField.spec.tsx +3 -3
  63. package/src/MultiSelect/subcomponents/MultiSelectOptions/MultiSelectOptions.spec.tsx +3 -3
  64. package/src/MultiSelect/subcomponents/MultiSelectToggle/MultiSelectToggle.spec.tsx +2 -2
  65. package/src/Notification/subcomponents/GenericNotification/GenericNotification.stories.tsx +60 -0
  66. package/src/Pagination/Pagination.spec.tsx +2 -2
  67. package/src/RichTextEditor/EditableRichTextContent/EditableRichTextContent.spec.tsx +4 -4
  68. package/src/RichTextEditor/RichTextContent/RichTextContent.tsx +11 -2
  69. package/src/RichTextEditor/utils/commands/addMark.spec.ts +2 -2
  70. package/src/RichTextEditor/utils/commands/fixtures/helpers.ts +4 -3
  71. package/src/RichTextEditor/utils/commands/getMarkAttrs.spec.ts +2 -2
  72. package/src/RichTextEditor/utils/commands/getMarkRange.spec.ts +2 -2
  73. package/src/RichTextEditor/utils/commands/listIsActive.spec.ts +2 -2
  74. package/src/RichTextEditor/utils/commands/markContainsSelection.spec.ts +2 -2
  75. package/src/RichTextEditor/utils/commands/markIsActive.spec.ts +2 -2
  76. package/src/RichTextEditor/utils/commands/removeMark.spec.ts +2 -2
  77. package/src/RichTextEditor/utils/commands/updateMark.spec.ts +2 -2
  78. package/src/RichTextEditor/utils/commands/validateAndRemoveMarks.spec.ts +3 -3
  79. package/src/RichTextEditor/utils/core/createRichTextEditor.spec.ts +11 -11
  80. package/src/RichTextEditor/utils/core/hooks/useRichTextEditor.spec.tsx +2 -2
  81. package/src/SplitButton/SplitButton.spec.tsx +5 -5
  82. package/src/SplitButton/subcomponents/DropdownButton/DropdownButton.spec.tsx +3 -4
  83. package/src/Text/Text.spec.tsx +1 -57
  84. package/src/TextArea/TextArea.spec.tsx +2 -2
  85. package/src/TimeField/TimeField.spec.tsx +2 -2
  86. package/src/TitleBlockZen/TitleBlockZen.spec.tsx +36 -68
  87. package/src/TitleBlockZen/_docs/TitleBlockZen.stories.tsx +78 -8
  88. package/src/TitleBlockZen/subcomponents/MobileActions.spec.tsx +2 -2
  89. package/src/TitleBlockZen/subcomponents/NavigationTabs.spec.tsx +8 -2
  90. package/src/ToggleSwitch/ToggleSwitch/ToggleSwitch.spec.tsx +2 -2
  91. package/src/__actions__/Menu/v1/Menu.spec.tsx +2 -2
  92. package/src/__containers__/GuidanceBlock/v1/GuidanceBlock.spec.tsx +5 -5
  93. package/src/__containers__/GuidanceBlock/v2/GuidanceBlock.spec.tsx +5 -5
  94. package/src/__future__/Select/Select.spec.tsx +4 -4
  95. package/src/__layout__/Workflow/v3/_docs/Workflow.stories.tsx +8 -2
  96. package/src/__layout__/Workflow/v3/subcomponents/Footer/components/Root/FooterRoot.module.css +1 -0
  97. package/src/__layout__/Workflow/v3/subcomponents/Header/components/Root/Root.module.css +1 -1
  98. package/src/__overlays__/Tooltip/v1/Tooltip.spec.tsx +1 -1
  99. package/src/__overlays__/Tooltip/v1/utils/isSemanticElement.spec.tsx +4 -9
  100. package/src/utils/useMediaQueries.spec.tsx +7 -7
  101. package/src/Heading/__snapshots__/Heading.spec.tsx.snap +0 -85
  102. package/src/Illustration/utils/usePausePlay.spec.tsx +0 -85
  103. package/src/Notification/subcomponents/GenericNotification/GenericNotification.spec.tsx +0 -76
  104. package/src/Text/__snapshots__/Text.spec.tsx.snap +0 -49
  105. package/src/__overlays__/Tooltip/v1/subcomponents/AppearanceAnim.spec.tsx +0 -39
@@ -1,7 +1,7 @@
1
1
  import React from "react"
2
- import { screen, waitFor } from "@testing-library/react"
2
+ import { screen, waitFor, render } from "@testing-library/react"
3
3
  import userEvent from "@testing-library/user-event"
4
- import { renderWithIntl } from "~tests"
4
+ import { vi } from "vitest"
5
5
  import { MenuItem, MenuList } from "~components/__actions__/v2"
6
6
  import { SplitButton, SplitButtonProps } from "./SplitButton"
7
7
 
@@ -13,7 +13,7 @@ const SplitButtonWrapper = (
13
13
  <SplitButton
14
14
  actionButtonProps={{
15
15
  label: "Action Text",
16
- onClick: jest.fn(),
16
+ onClick: vi.fn(),
17
17
  }}
18
18
  dropdownButtonProps={{
19
19
  "aria-label": "Dropdown Label",
@@ -30,7 +30,7 @@ const SplitButtonWrapper = (
30
30
 
31
31
  describe("<SplitButton />", () => {
32
32
  it("renders the correct structure", async () => {
33
- renderWithIntl(<SplitButtonWrapper />)
33
+ render(<SplitButtonWrapper />)
34
34
  await waitFor(() => {
35
35
  expect(screen.getByText("Action Text")).toBeInTheDocument()
36
36
  })
@@ -46,7 +46,7 @@ describe("<SplitButton />", () => {
46
46
  })
47
47
 
48
48
  it("disables both buttons when disabled is true", async () => {
49
- renderWithIntl(<SplitButtonWrapper disabled />)
49
+ render(<SplitButtonWrapper disabled />)
50
50
  await waitFor(() => {
51
51
  expect(screen.getByText("Action Text").closest("button")).toBeDisabled()
52
52
  })
@@ -1,6 +1,5 @@
1
1
  import React from "react"
2
- import { screen, waitFor } from "@testing-library/react"
3
- import { renderWithIntl } from "~tests"
2
+ import { screen, waitFor, render } from "@testing-library/react"
4
3
  import { DropdownButton, DropdownButtonProps } from "./DropdownButton"
5
4
 
6
5
  const DropdownButtonWrapper = (
@@ -9,7 +8,7 @@ const DropdownButtonWrapper = (
9
8
 
10
9
  describe("<DropdownButton />", () => {
11
10
  it("renders icon with default aria-label", async () => {
12
- renderWithIntl(<DropdownButtonWrapper />)
11
+ render(<DropdownButtonWrapper />)
13
12
  await waitFor(() => {
14
13
  const button = screen.getByRole("button", { name: "Additional actions" })
15
14
  expect(button.getAttribute("aria-label")).toBe("Additional actions")
@@ -18,7 +17,7 @@ describe("<DropdownButton />", () => {
18
17
  })
19
18
 
20
19
  it("renders custom aria-label", async () => {
21
- renderWithIntl(<DropdownButtonWrapper aria-label="Custom aria label" />)
20
+ render(<DropdownButtonWrapper aria-label="Custom aria label" />)
22
21
  await waitFor(() => {
23
22
  const button = screen.getByRole("button", { name: "Custom aria label" })
24
23
  expect(button.getAttribute("aria-label")).toBe("Custom aria label")
@@ -1,30 +1,8 @@
1
1
  import * as React from "react"
2
2
  import { render } from "@testing-library/react"
3
- import { AllowedTextColors, AllowedTextTags, Text, TextVariants } from "./"
3
+ import { AllowedTextTags, Text, TextVariants } from "."
4
4
 
5
5
  describe("<Text />", () => {
6
- describe("renders the correct variant classes", () => {
7
- const testCases: TextVariants[] = [
8
- "intro-lede",
9
- "body",
10
- "small",
11
- "extra-small",
12
- ]
13
-
14
- testCases.forEach(variant => {
15
- it(`renders the correct element for <Text variant={${variant}} />`, () => {
16
- const textMock = render(
17
- <Text variant={variant} tag="div">
18
- Example
19
- </Text>
20
- )
21
- const textClasslist = textMock.getByText("Example").classList
22
- expect(textClasslist).toContain("text")
23
- expect(textClasslist).toContain(variant)
24
- })
25
- })
26
- })
27
-
28
6
  describe("changes rendered HTML element when passed tag", () => {
29
7
  const testCases: TextVariants[] = [
30
8
  "intro-lede",
@@ -45,30 +23,6 @@ describe("<Text />", () => {
45
23
  })
46
24
  })
47
25
 
48
- describe("renders the correct color classes", () => {
49
- const testCases: AllowedTextColors[] = [
50
- "dark",
51
- "dark-reduced-opacity",
52
- "white",
53
- "white-reduced-opacity",
54
- "positive",
55
- "negative",
56
- ]
57
-
58
- testCases.forEach(color => {
59
- it(`renders the correct class for <Text color={${color}} />`, () => {
60
- const textMock = render(
61
- <Text variant="body" color={color} tag="div">
62
- Example
63
- </Text>
64
- )
65
- const textClasslist = textMock.getByText("Example").classList
66
- expect(textClasslist).toContain("text")
67
- expect(textClasslist).toContain(color)
68
- })
69
- })
70
- })
71
-
72
26
  it("passes through data attributes", () => {
73
27
  const { getByTestId } = render(
74
28
  <Text variant="intro-lede" data-testid="test-id">
@@ -91,17 +45,7 @@ describe("<Text />", () => {
91
45
  it(`renders the correct element for <Text variant={${variant}} />`, () => {
92
46
  const textMock = render(<Text variant={variant}>Example</Text>)
93
47
  expect(textMock.getByText("Example").tagName.toLowerCase()).toBe(el)
94
- expect(textMock.baseElement).toMatchSnapshot()
95
48
  })
96
49
  })
97
50
  })
98
-
99
- it("allows consumers to provide a className", () => {
100
- const { getByText } = render(
101
- <Text variant="body" classNameOverride="example-classname">
102
- Example
103
- </Text>
104
- )
105
- expect(getByText("Example").classList).toContain("example-classname")
106
- })
107
51
  })
@@ -1,8 +1,8 @@
1
1
  import React from "react"
2
2
  import { render, waitFor } from "@testing-library/react"
3
3
  import userEvent from "@testing-library/user-event"
4
+ import { vi } from "vitest"
4
5
  import { TextArea } from "./TextArea"
5
-
6
6
  const user = userEvent.setup()
7
7
 
8
8
  describe("<TextArea />", () => {
@@ -22,7 +22,7 @@ describe("<TextArea />", () => {
22
22
  })
23
23
 
24
24
  it("calls the `onChange` event when the value is updated", async () => {
25
- const mockFn = jest.fn()
25
+ const mockFn = vi.fn()
26
26
  const { getByRole } = render(<TextArea onChange={mockFn} />)
27
27
 
28
28
  await user.type(getByRole("textbox"), "Hello")
@@ -1,12 +1,12 @@
1
1
  import React, { useState } from "react"
2
2
  import { render, screen, waitFor } from "@testing-library/react"
3
3
  import userEvent from "@testing-library/user-event"
4
+ import { vi } from "vitest"
4
5
  import { TimeField, TimeFieldProps } from "./TimeField"
5
6
  import { ValueType } from "./types"
6
-
7
7
  const user = userEvent.setup()
8
8
 
9
- const mockOnChange = jest.fn()
9
+ const mockOnChange = vi.fn()
10
10
  const LABEL = "Launch Time Label"
11
11
 
12
12
  const pressArrowKey =
@@ -1,12 +1,28 @@
1
1
  import React from "react"
2
2
  import { render, waitFor, screen, within } from "@testing-library/react"
3
3
  import userEvent from "@testing-library/user-event"
4
- import { mockMatchMedia } from "~components/utils/useMediaQueries.spec"
4
+ import { vi } from "vitest"
5
5
  import { CustomBreadcrumbProps, SectionTitleRenderProps } from "./types"
6
6
  import { TitleBlockZen } from "./index"
7
7
 
8
8
  const user = userEvent.setup()
9
9
 
10
+ const mockMatchMedia = (matches: boolean = false): void => {
11
+ Object.defineProperty(window, "matchMedia", {
12
+ writable: true,
13
+ value: vi.fn().mockImplementation(query => ({
14
+ matches,
15
+ media: query,
16
+ onchange: null,
17
+ addListener: vi.fn(), // Deprecated
18
+ removeListener: vi.fn(), // Deprecated
19
+ addEventListener: vi.fn(),
20
+ removeEventListener: vi.fn(),
21
+ dispatchEvent: vi.fn(),
22
+ })),
23
+ })
24
+ }
25
+
10
26
  describe("<TitleBlockZen />", () => {
11
27
  beforeEach(() => {
12
28
  mockMatchMedia()
@@ -41,7 +57,7 @@ describe("<TitleBlockZen />", () => {
41
57
  })
42
58
 
43
59
  describe("when the primary action is a button with only an onClick", () => {
44
- const testOnClickFn = jest.fn()
60
+ const testOnClickFn = vi.fn()
45
61
  const primaryActionAsButton = {
46
62
  label: "primaryActionLabel",
47
63
  onClick: testOnClickFn,
@@ -84,7 +100,7 @@ describe("<TitleBlockZen />", () => {
84
100
  })
85
101
 
86
102
  describe("when the primary action is disabled", () => {
87
- const testOnClickFn = jest.fn()
103
+ const testOnClickFn = vi.fn()
88
104
  const primaryActionAsButton = {
89
105
  label: "primaryActionLabel",
90
106
  onClick: testOnClickFn,
@@ -166,7 +182,7 @@ describe("<TitleBlockZen />", () => {
166
182
  })
167
183
 
168
184
  describe("when the primary action is a button with both an href and an onClick", () => {
169
- const testOnClickFn = jest.fn()
185
+ const testOnClickFn = vi.fn()
170
186
  const primaryActionAsLinkAndOnClick = {
171
187
  label: "primaryActionLabel",
172
188
  href: "#primaryActionHref",
@@ -307,7 +323,7 @@ describe("<TitleBlockZen />", () => {
307
323
  })
308
324
 
309
325
  describe("when the default action is a button with only an onClick", () => {
310
- const testOnClickFn = jest.fn()
326
+ const testOnClickFn = vi.fn()
311
327
  const defaultActionAsButton = {
312
328
  label: "defaultActionLabel",
313
329
  onClick: testOnClickFn,
@@ -363,7 +379,7 @@ describe("<TitleBlockZen />", () => {
363
379
  })
364
380
 
365
381
  describe("when the default action is a button with both an href and an onClick", () => {
366
- const testOnClickFn = jest.fn()
382
+ const testOnClickFn = vi.fn()
367
383
  const defaultActionAsLinkAndOnClick = {
368
384
  label: "defaultActionLabel",
369
385
  href: "#defaultActionHref",
@@ -423,7 +439,7 @@ describe("<TitleBlockZen />", () => {
423
439
  })
424
440
 
425
441
  describe("when the default action is disabled", () => {
426
- const testOnClickFn = jest.fn()
442
+ const testOnClickFn = vi.fn()
427
443
  const defaultActionAsButton = {
428
444
  label: "defaultActionLabel",
429
445
  onClick: testOnClickFn,
@@ -504,7 +520,7 @@ describe("<TitleBlockZen />", () => {
504
520
  })
505
521
 
506
522
  describe("when a secondary action is passed with both an href and an onClick", () => {
507
- const testOnClickFn = jest.fn()
523
+ const testOnClickFn = vi.fn()
508
524
  const secondaryActionWithLinkAndOnClick = {
509
525
  label: "secondaryActionLabel",
510
526
  href: "#secondaryActionHref",
@@ -516,8 +532,8 @@ describe("<TitleBlockZen />", () => {
516
532
  })
517
533
 
518
534
  it("renders the secondary action with both the href and onClick", async () => {
519
- const mockWarnFn = jest.fn()
520
- const spy = jest
535
+ const mockWarnFn = vi.fn()
536
+ const spy = vi
521
537
  .spyOn(global.console, "warn")
522
538
  .mockImplementation(mockWarnFn)
523
539
  const { getByTestId } = render(
@@ -543,8 +559,8 @@ describe("<TitleBlockZen />", () => {
543
559
  })
544
560
 
545
561
  it("renders the action as a single mobile actions drawer item with an onClick", async () => {
546
- const mockWarnFn = jest.fn()
547
- const spy = jest
562
+ const mockWarnFn = vi.fn()
563
+ const spy = vi
548
564
  .spyOn(global.console, "warn")
549
565
  .mockImplementation(mockWarnFn)
550
566
  const { getAllByTestId } = render(
@@ -681,7 +697,7 @@ describe("<TitleBlockZen />", () => {
681
697
  })
682
698
 
683
699
  describe("when a disabled secondary action is passed with only an onClick", () => {
684
- const testOnClickFn = jest.fn()
700
+ const testOnClickFn = vi.fn()
685
701
  const secondaryActionWithOnClick = {
686
702
  label: "secondaryActionLabel",
687
703
  onClick: testOnClickFn,
@@ -708,7 +724,7 @@ describe("<TitleBlockZen />", () => {
708
724
  })
709
725
 
710
726
  describe("when a disabled secondary overflow menu item is passed with only an onClick for the action", () => {
711
- const testOnClickFn = jest.fn()
727
+ const testOnClickFn = vi.fn()
712
728
  const secondaryOverflowMenuItemWithOnClick = {
713
729
  label: "secondaryActionOverflowMenuItemLabel",
714
730
  action: testOnClickFn,
@@ -737,54 +753,6 @@ describe("<TitleBlockZen />", () => {
737
753
  })
738
754
  })
739
755
 
740
- describe("survey status", () => {
741
- it("doesn't render tag when field is omitted", async () => {
742
- render(<TitleBlockZen title="Test Title">Example</TitleBlockZen>)
743
-
744
- await waitFor(() => {
745
- expect(
746
- screen.queryByTestId("survey-status-tag")
747
- ).not.toBeInTheDocument()
748
- })
749
- })
750
-
751
- it.each([
752
- ["draft", "statusDraft"],
753
- ["live", "statusLive"],
754
- ["closed", "statusClosed"],
755
- ["scheduled", "statusClosed"],
756
- ["sentimentPositive", "sentimentPositive"],
757
- ["default", "default"],
758
- ])(
759
- "renders tag with correct text and variant when %s status",
760
- async (status, expectedClassName) => {
761
- render(
762
- <TitleBlockZen
763
- title="Test Title"
764
- surveyStatus={{
765
- text: `${status} text`,
766
- status: `${status}` as
767
- | "draft"
768
- | "live"
769
- | "scheduled"
770
- | "closed"
771
- | "sentimentPositive"
772
- | "default",
773
- }}
774
- >
775
- Example
776
- </TitleBlockZen>
777
- )
778
-
779
- const tagElement = (await screen.findByTestId("survey-status-tag"))
780
- .firstChild
781
-
782
- expect(tagElement).toHaveTextContent(`${status} text`)
783
- expect(tagElement).toHaveClass(expectedClassName)
784
- }
785
- )
786
- })
787
-
788
756
  describe("automation ID behaviour", () => {
789
757
  describe("when default automation IDs are not provided alongside required conditional renders", () => {
790
758
  it("renders the default automation IDs", () => {
@@ -807,7 +775,7 @@ describe("<TitleBlockZen />", () => {
807
775
  breadcrumb={{
808
776
  text: "Test Breadcrumb",
809
777
  path: "/",
810
- handleClick: jest.fn(),
778
+ handleClick: vi.fn(),
811
779
  }}
812
780
  sectionTitle="Test Section Title"
813
781
  sectionTitleDescription="Test Section Title Description"
@@ -845,7 +813,7 @@ describe("<TitleBlockZen />", () => {
845
813
  breadcrumb={{
846
814
  text: "Test Breadcrumb",
847
815
  path: "/",
848
- handleClick: jest.fn(),
816
+ handleClick: vi.fn(),
849
817
  }}
850
818
  sectionTitle="Test Section Title"
851
819
  sectionTitleDescription="Test Section Title Description"
@@ -909,7 +877,7 @@ describe("<TitleBlockZen />", () => {
909
877
  })
910
878
 
911
879
  it("renders a custom component when you pass a 'render' prop", async () => {
912
- const mockFn = jest.fn()
880
+ const mockFn = vi.fn()
913
881
 
914
882
  const CustomComponent = (props: CustomBreadcrumbProps): JSX.Element => (
915
883
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
@@ -1018,7 +986,7 @@ describe("<TitleBlockZen />", () => {
1018
986
  })
1019
987
 
1020
988
  it("will render custom button with functional onClick", async () => {
1021
- const testClickFunc = jest.fn()
989
+ const testClickFunc = vi.fn()
1022
990
  render(
1023
991
  <TitleBlockZen
1024
992
  title="Test Title"
@@ -1045,7 +1013,7 @@ describe("<TitleBlockZen />", () => {
1045
1013
  })
1046
1014
 
1047
1015
  it("will render custom button with children and not label", () => {
1048
- const testClickFunc = jest.fn()
1016
+ const testClickFunc = vi.fn()
1049
1017
  render(
1050
1018
  <TitleBlockZen
1051
1019
  title="Test Title"
@@ -1177,7 +1145,7 @@ describe("<TitleBlockZen />", () => {
1177
1145
  })
1178
1146
 
1179
1147
  it("will render the component in the top list of the Drawer content if it is a clickable button", () => {
1180
- const testClickFunc = jest.fn()
1148
+ const testClickFunc = vi.fn()
1181
1149
  render(
1182
1150
  <TitleBlockZen
1183
1151
  title="Test Title"
@@ -75,13 +75,6 @@ const meta = {
75
75
  <NavigationTab key="6" text="Label" href="#" />,
76
76
  ],
77
77
  },
78
- decorators: [
79
- Story => (
80
- <div style={{ margin: "-1rem" }}>
81
- <Story />
82
- </div>
83
- ),
84
- ],
85
78
  } satisfies Meta<typeof TitleBlockZen>
86
79
 
87
80
  export default meta
@@ -152,7 +145,7 @@ export const HasLongTitle: Story = {
152
145
  args: { title: "A long title with over thirty characters" },
153
146
  }
154
147
 
155
- export const StickerSheetDefault: Story = {
148
+ export const StickerSheetBreadcrumbs: Story = {
156
149
  parameters: {
157
150
  docs: {
158
151
  canvas: {
@@ -208,4 +201,81 @@ export const StickerSheetDefault: Story = {
208
201
  </StickerSheet.Row>
209
202
  </StickerSheet>
210
203
  ),
204
+ name: "Sticker Sheet (Breadcrumb)",
205
+ }
206
+
207
+ export const StickerSheetDefault: Story = {
208
+ render: () => (
209
+ <StickerSheet title="Survey Status">
210
+ <StickerSheet.Body>
211
+ <StickerSheet.Row rowTitle="Draft">
212
+ <TitleBlockZen
213
+ title="Draft Title"
214
+ surveyStatus={{
215
+ text: "draft text",
216
+ status: "draft",
217
+ }}
218
+ >
219
+ Draft
220
+ </TitleBlockZen>
221
+ </StickerSheet.Row>
222
+ <StickerSheet.Row rowTitle="Default">
223
+ <TitleBlockZen
224
+ title="Default Title"
225
+ surveyStatus={{
226
+ text: "default text",
227
+ status: "default",
228
+ }}
229
+ >
230
+ Default
231
+ </TitleBlockZen>
232
+ </StickerSheet.Row>
233
+ <StickerSheet.Row rowTitle="Scheduled">
234
+ <TitleBlockZen
235
+ title="Scheduled Title"
236
+ surveyStatus={{
237
+ text: "scheduled text",
238
+ status: "scheduled",
239
+ }}
240
+ >
241
+ Due
242
+ </TitleBlockZen>
243
+ </StickerSheet.Row>
244
+ <StickerSheet.Row rowTitle="Live">
245
+ <TitleBlockZen
246
+ title="Live Title"
247
+ surveyStatus={{
248
+ text: "live text",
249
+ status: "live",
250
+ }}
251
+ >
252
+ Overdue
253
+ </TitleBlockZen>
254
+ </StickerSheet.Row>
255
+ <StickerSheet.Row rowTitle="Closed">
256
+ <TitleBlockZen
257
+ title="Closed Title"
258
+ surveyStatus={{
259
+ text: "closed text",
260
+ status: "closed",
261
+ }}
262
+ >
263
+ Completed
264
+ </TitleBlockZen>
265
+ </StickerSheet.Row>
266
+ <StickerSheet.Row rowTitle="Sentiment Positive">
267
+ <TitleBlockZen
268
+ title="Sentiment Positive Title"
269
+ surveyStatus={{
270
+ text: "sentimentPositive text",
271
+ status: "sentimentPositive",
272
+ }}
273
+ >
274
+ Completed
275
+ </TitleBlockZen>
276
+ </StickerSheet.Row>
277
+ </StickerSheet.Body>
278
+ </StickerSheet>
279
+ ),
280
+ name: "Sticker Sheet (Survey Status)",
211
281
  }
@@ -1,8 +1,8 @@
1
1
  import React from "react"
2
2
  import { render, screen, waitFor } from "@testing-library/react"
3
3
  import userEvent from "@testing-library/user-event"
4
+ import { vi } from "vitest"
4
5
  import { MobileActions } from "./MobileActions"
5
-
6
6
  const user = userEvent.setup()
7
7
 
8
8
  const MENU_LINKS = [
@@ -147,7 +147,7 @@ describe("<MobileActions />", () => {
147
147
 
148
148
  describe("when autoHide is true", () => {
149
149
  beforeEach(() => {
150
- window.alert = jest.fn()
150
+ window.alert = vi.fn()
151
151
  render(
152
152
  <MobileActions
153
153
  primaryAction={{
@@ -1,7 +1,9 @@
1
1
  import React from "react"
2
2
  import { render, screen, waitFor } from "@testing-library/react"
3
3
  import userEvent from "@testing-library/user-event"
4
+ import { vi } from "vitest"
4
5
  import { NavigationTab, CustomNavigationTabProps } from "./NavigationTabs"
6
+ import styles from "./NavigationTabs.module.scss"
5
7
 
6
8
  const user = userEvent.setup()
7
9
 
@@ -33,7 +35,7 @@ describe("NavigationTabs", () => {
33
35
 
34
36
  describe("with a render prop", () => {
35
37
  it("renders the component passed with the navigation tab props", async () => {
36
- const handleClick = jest.fn()
38
+ const handleClick = vi.fn()
37
39
  const text = "I am also navigation tabs"
38
40
  const href = "www.cultureamp.com"
39
41
  render(
@@ -50,7 +52,11 @@ describe("NavigationTabs", () => {
50
52
  const button = screen.getByRole("button", {
51
53
  name: `${href} - ${text} - true`,
52
54
  })
53
- expect(button).toHaveClass("linkAnchor", "active", "lightBackground")
55
+ expect(button).toHaveClass(
56
+ styles.linkAnchor,
57
+ styles.active,
58
+ styles.lightBackground
59
+ )
54
60
 
55
61
  await user.click(button)
56
62
  await waitFor(() => {
@@ -1,13 +1,13 @@
1
1
  import React from "react"
2
2
  import { render, screen, waitFor } from "@testing-library/react"
3
3
  import userEvent from "@testing-library/user-event"
4
+ import { vi } from "vitest"
4
5
  import { ToggleSwitch, ToggleSwitchProps } from "./ToggleSwitch"
5
-
6
6
  const user = userEvent.setup()
7
7
 
8
8
  const defaultToggleSwitchProps = {
9
9
  id: "someToggleSwitchId",
10
- onToggle: jest.fn(),
10
+ onToggle: vi.fn(),
11
11
  }
12
12
 
13
13
  const renderToggleSwitch = (
@@ -23,7 +23,7 @@ describe("Dropdown", () => {
23
23
  })
24
24
 
25
25
  it("shows menu & handles onClick set by the consumer when clicking on the button", async () => {
26
- const onButtonClick = jest.fn<void, []>()
26
+ const onButtonClick = vi.fn()
27
27
 
28
28
  render(
29
29
  <Menu button={<Button label="Button" onClick={onButtonClick} />}>
@@ -42,7 +42,7 @@ describe("Dropdown", () => {
42
42
  })
43
43
  })
44
44
  it("shows menu & handles onMouseDown set by the consumer when mousing down on the button", async () => {
45
- const onMouseDown = jest.fn<void, []>()
45
+ const onMouseDown = vi.fn()
46
46
 
47
47
  render(
48
48
  <Menu button={<Button label="Button" onMouseDown={onMouseDown} />}>
@@ -1,25 +1,25 @@
1
1
  import React from "react"
2
2
  import { cleanup, render, waitFor } from "@testing-library/react"
3
3
  import userEvent from "@testing-library/user-event"
4
+ import { vi } from "vitest"
4
5
  import { Informative } from "~components/Illustration"
5
6
  import { GuidanceBlock } from "./GuidanceBlock"
6
-
7
7
  const user = userEvent.setup()
8
8
 
9
9
  // eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
10
- window.matchMedia = jest.fn().mockImplementation(() => ({
10
+ window.matchMedia = vi.fn().mockImplementation(() => ({
11
11
  matches: false,
12
12
  media: "",
13
13
  onchange: null,
14
- addListener: jest.fn(),
15
- removeListener: jest.fn(),
14
+ addListener: vi.fn(),
15
+ removeListener: vi.fn(),
16
16
  }))
17
17
 
18
18
  describe("GuidanceBlock", () => {
19
19
  afterEach(cleanup)
20
20
 
21
21
  it("calls the action function when action button is clicked", async () => {
22
- const onAction = jest.fn()
22
+ const onAction = vi.fn()
23
23
  const { container } = render(
24
24
  <GuidanceBlock
25
25
  illustration={<Informative alt="" />}
@@ -1,25 +1,25 @@
1
1
  import React from "react"
2
2
  import { cleanup, render, waitFor } from "@testing-library/react"
3
3
  import userEvent from "@testing-library/user-event"
4
+ import { vi } from "vitest"
4
5
  import { Informative } from "~components/Illustration"
5
6
  import { GuidanceBlock } from "./GuidanceBlock"
6
-
7
7
  const user = userEvent.setup()
8
8
 
9
9
  // eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
10
- window.matchMedia = jest.fn().mockImplementation(() => ({
10
+ window.matchMedia = vi.fn().mockImplementation(() => ({
11
11
  matches: false,
12
12
  media: "",
13
13
  onchange: null,
14
- addListener: jest.fn(),
15
- removeListener: jest.fn(),
14
+ addListener: vi.fn(),
15
+ removeListener: vi.fn(),
16
16
  }))
17
17
 
18
18
  describe("GuidanceBlock", () => {
19
19
  afterEach(cleanup)
20
20
 
21
21
  it("calls the action function when action button is clicked", async () => {
22
- const onAction = jest.fn()
22
+ const onAction = vi.fn()
23
23
  const { container } = render(
24
24
  <GuidanceBlock
25
25
  illustration={<Informative alt="" />}