@simplysm/solid 13.0.72 → 13.0.74

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 (210) hide show
  1. package/README.md +209 -202
  2. package/dist/components/data/calendar/Calendar.d.ts.map +1 -1
  3. package/dist/components/data/calendar/Calendar.js +3 -11
  4. package/dist/components/data/calendar/Calendar.js.map +2 -2
  5. package/dist/components/data/sheet/DataSheet.js +10 -10
  6. package/dist/components/data/sheet/DataSheet.js.map +2 -2
  7. package/dist/components/data/sheet/DataSheetConfigDialog.d.ts.map +1 -1
  8. package/dist/components/data/sheet/DataSheetConfigDialog.js +27 -9
  9. package/dist/components/data/sheet/DataSheetConfigDialog.js.map +2 -2
  10. package/dist/components/disclosure/Dialog.d.ts +1 -1
  11. package/dist/components/disclosure/Dialog.d.ts.map +1 -1
  12. package/dist/components/disclosure/Dialog.js +5 -5
  13. package/dist/components/disclosure/Dialog.js.map +2 -2
  14. package/dist/components/disclosure/dialogZIndex.d.ts +1 -1
  15. package/dist/components/features/crud-detail/CrudDetail.js +23 -23
  16. package/dist/components/features/crud-detail/CrudDetail.js.map +2 -2
  17. package/dist/components/features/crud-sheet/CrudSheet.js +49 -49
  18. package/dist/components/features/crud-sheet/CrudSheet.js.map +2 -2
  19. package/dist/components/features/crud-sheet/types.d.ts +4 -4
  20. package/dist/components/features/crud-sheet/types.d.ts.map +1 -1
  21. package/dist/components/features/data-select-button/DataSelectButton.d.ts +25 -7
  22. package/dist/components/features/data-select-button/DataSelectButton.d.ts.map +1 -1
  23. package/dist/components/features/data-select-button/DataSelectButton.js +27 -12
  24. package/dist/components/features/data-select-button/DataSelectButton.js.map +2 -2
  25. package/dist/components/features/permission-table/PermissionTable.js +4 -4
  26. package/dist/components/features/permission-table/PermissionTable.js.map +2 -2
  27. package/dist/components/features/shared-data/SharedDataSelect.d.ts +22 -10
  28. package/dist/components/features/shared-data/SharedDataSelect.d.ts.map +1 -1
  29. package/dist/components/features/shared-data/SharedDataSelect.js +113 -29
  30. package/dist/components/features/shared-data/SharedDataSelect.js.map +2 -2
  31. package/dist/components/features/shared-data/SharedDataSelectButton.d.ts +3 -3
  32. package/dist/components/features/shared-data/SharedDataSelectButton.d.ts.map +1 -1
  33. package/dist/components/features/shared-data/SharedDataSelectButton.js.map +1 -1
  34. package/dist/components/features/shared-data/SharedDataSelectList.js +5 -4
  35. package/dist/components/features/shared-data/SharedDataSelectList.js.map +2 -2
  36. package/dist/components/feedback/notification/NotificationBanner.js +3 -3
  37. package/dist/components/feedback/notification/NotificationBanner.js.map +2 -2
  38. package/dist/components/feedback/notification/NotificationBell.d.ts.map +1 -1
  39. package/dist/components/feedback/notification/NotificationBell.js +12 -5
  40. package/dist/components/feedback/notification/NotificationBell.js.map +2 -2
  41. package/dist/components/feedback/notification/NotificationProvider.d.ts.map +1 -1
  42. package/dist/components/feedback/notification/NotificationProvider.js +3 -1
  43. package/dist/components/feedback/notification/NotificationProvider.js.map +2 -2
  44. package/dist/components/form-control/ThemeToggle.d.ts.map +1 -1
  45. package/dist/components/form-control/ThemeToggle.js +9 -6
  46. package/dist/components/form-control/ThemeToggle.js.map +2 -2
  47. package/dist/components/form-control/checkbox/Checkbox.d.ts.map +1 -1
  48. package/dist/components/form-control/checkbox/Checkbox.js +3 -1
  49. package/dist/components/form-control/checkbox/Checkbox.js.map +2 -2
  50. package/dist/components/form-control/checkbox/CheckboxGroup.js +1 -1
  51. package/dist/components/form-control/checkbox/CheckboxGroup.js.map +2 -2
  52. package/dist/components/form-control/checkbox/Radio.d.ts.map +1 -1
  53. package/dist/components/form-control/checkbox/Radio.js +3 -1
  54. package/dist/components/form-control/checkbox/Radio.js.map +2 -2
  55. package/dist/components/form-control/checkbox/RadioGroup.js +1 -1
  56. package/dist/components/form-control/checkbox/RadioGroup.js.map +2 -2
  57. package/dist/components/form-control/color-picker/ColorPicker.d.ts.map +1 -1
  58. package/dist/components/form-control/color-picker/ColorPicker.js +3 -1
  59. package/dist/components/form-control/color-picker/ColorPicker.js.map +2 -2
  60. package/dist/components/form-control/combobox/Combobox.d.ts.map +1 -1
  61. package/dist/components/form-control/combobox/Combobox.js +9 -5
  62. package/dist/components/form-control/combobox/Combobox.js.map +2 -2
  63. package/dist/components/form-control/date-range-picker/DateRangePicker.js +9 -9
  64. package/dist/components/form-control/date-range-picker/DateRangePicker.js.map +2 -2
  65. package/dist/components/form-control/editor/EditorToolbar.js +3 -3
  66. package/dist/components/form-control/editor/EditorToolbar.js.map +2 -2
  67. package/dist/components/form-control/field/DatePicker.d.ts.map +1 -1
  68. package/dist/components/form-control/field/DatePicker.js +9 -3
  69. package/dist/components/form-control/field/DatePicker.js.map +2 -2
  70. package/dist/components/form-control/field/DateTimePicker.d.ts.map +1 -1
  71. package/dist/components/form-control/field/DateTimePicker.js +9 -3
  72. package/dist/components/form-control/field/DateTimePicker.js.map +2 -2
  73. package/dist/components/form-control/field/NumberInput.d.ts.map +1 -1
  74. package/dist/components/form-control/field/NumberInput.js +9 -3
  75. package/dist/components/form-control/field/NumberInput.js.map +2 -2
  76. package/dist/components/form-control/field/TextInput.d.ts.map +1 -1
  77. package/dist/components/form-control/field/TextInput.js +10 -4
  78. package/dist/components/form-control/field/TextInput.js.map +2 -2
  79. package/dist/components/form-control/field/Textarea.d.ts.map +1 -1
  80. package/dist/components/form-control/field/Textarea.js +9 -3
  81. package/dist/components/form-control/field/Textarea.js.map +2 -2
  82. package/dist/components/form-control/field/TimePicker.d.ts.map +1 -1
  83. package/dist/components/form-control/field/TimePicker.js +9 -3
  84. package/dist/components/form-control/field/TimePicker.js.map +2 -2
  85. package/dist/components/form-control/numpad/Numpad.d.ts.map +1 -1
  86. package/dist/components/form-control/numpad/Numpad.js +5 -1
  87. package/dist/components/form-control/numpad/Numpad.js.map +2 -2
  88. package/dist/components/form-control/select/Select.js +7 -7
  89. package/dist/components/form-control/select/Select.js.map +2 -2
  90. package/dist/components/form-control/state-preset/StatePreset.d.ts.map +1 -1
  91. package/dist/components/form-control/state-preset/StatePreset.js +42 -20
  92. package/dist/components/form-control/state-preset/StatePreset.js.map +2 -2
  93. package/dist/components/layout/sidebar/SidebarContainer.js +3 -3
  94. package/dist/components/layout/sidebar/SidebarContainer.js.map +2 -2
  95. package/dist/components/layout/sidebar/SidebarMenu.d.ts.map +1 -1
  96. package/dist/components/layout/sidebar/SidebarMenu.js +5 -2
  97. package/dist/components/layout/sidebar/SidebarMenu.js.map +2 -2
  98. package/dist/components/layout/topbar/Topbar.js +3 -4
  99. package/dist/components/layout/topbar/Topbar.js.map +2 -2
  100. package/dist/components/layout/topbar/TopbarMenu.js +3 -3
  101. package/dist/components/layout/topbar/TopbarMenu.js.map +2 -2
  102. package/dist/hooks/createSelectionGroup.d.ts +2 -2
  103. package/dist/hooks/createSelectionGroup.d.ts.map +1 -1
  104. package/dist/hooks/createSelectionGroup.js +5 -2
  105. package/dist/hooks/createSelectionGroup.js.map +2 -2
  106. package/dist/providers/i18n/I18nContext.d.ts +0 -4
  107. package/dist/providers/i18n/I18nContext.d.ts.map +1 -1
  108. package/dist/providers/i18n/I18nContext.js +1 -5
  109. package/dist/providers/i18n/I18nContext.js.map +2 -2
  110. package/dist/providers/i18n/locales/en.d.ts +38 -0
  111. package/dist/providers/i18n/locales/en.d.ts.map +1 -1
  112. package/dist/providers/i18n/locales/en.js +39 -1
  113. package/dist/providers/i18n/locales/en.js.map +1 -1
  114. package/dist/providers/i18n/locales/ko.d.ts +38 -0
  115. package/dist/providers/i18n/locales/ko.d.ts.map +1 -1
  116. package/dist/providers/i18n/locales/ko.js +39 -1
  117. package/dist/providers/i18n/locales/ko.js.map +1 -1
  118. package/package.json +6 -6
  119. package/src/components/data/calendar/Calendar.tsx +3 -4
  120. package/src/components/data/sheet/DataSheet.tsx +11 -11
  121. package/src/components/data/sheet/DataSheetConfigDialog.tsx +12 -10
  122. package/src/components/data/sheet/types.ts +1 -1
  123. package/src/components/disclosure/Dialog.tsx +10 -10
  124. package/src/components/disclosure/dialogZIndex.ts +1 -1
  125. package/src/components/features/crud-detail/CrudDetail.tsx +25 -25
  126. package/src/components/features/crud-sheet/CrudSheet.tsx +53 -53
  127. package/src/components/features/crud-sheet/types.ts +4 -4
  128. package/src/components/features/data-select-button/DataSelectButton.tsx +51 -21
  129. package/src/components/features/permission-table/PermissionTable.tsx +3 -3
  130. package/src/components/features/shared-data/SharedDataSelect.tsx +172 -33
  131. package/src/components/features/shared-data/SharedDataSelectButton.tsx +3 -2
  132. package/src/components/features/shared-data/SharedDataSelectList.tsx +4 -4
  133. package/src/components/feedback/notification/NotificationBanner.tsx +3 -3
  134. package/src/components/feedback/notification/NotificationBell.tsx +6 -4
  135. package/src/components/feedback/notification/NotificationProvider.tsx +3 -1
  136. package/src/components/form-control/ThemeToggle.tsx +10 -6
  137. package/src/components/form-control/checkbox/Checkbox.tsx +4 -1
  138. package/src/components/form-control/checkbox/CheckboxGroup.tsx +1 -1
  139. package/src/components/form-control/checkbox/Radio.tsx +4 -1
  140. package/src/components/form-control/checkbox/RadioGroup.tsx +1 -1
  141. package/src/components/form-control/color-picker/ColorPicker.tsx +4 -1
  142. package/src/components/form-control/combobox/Combobox.tsx +6 -3
  143. package/src/components/form-control/date-range-picker/DateRangePicker.tsx +8 -8
  144. package/src/components/form-control/editor/EditorToolbar.tsx +23 -23
  145. package/src/components/form-control/field/DatePicker.tsx +6 -3
  146. package/src/components/form-control/field/DateTimePicker.tsx +6 -3
  147. package/src/components/form-control/field/NumberInput.tsx +6 -3
  148. package/src/components/form-control/field/TextInput.tsx +7 -4
  149. package/src/components/form-control/field/Textarea.tsx +6 -3
  150. package/src/components/form-control/field/TimePicker.tsx +6 -3
  151. package/src/components/form-control/numpad/Numpad.tsx +3 -1
  152. package/src/components/form-control/select/Select.tsx +7 -7
  153. package/src/components/form-control/state-preset/StatePreset.tsx +14 -12
  154. package/src/components/layout/sidebar/SidebarContainer.tsx +3 -3
  155. package/src/components/layout/sidebar/SidebarMenu.tsx +3 -1
  156. package/src/components/layout/topbar/Topbar.tsx +3 -3
  157. package/src/components/layout/topbar/TopbarMenu.tsx +3 -3
  158. package/src/hooks/createSelectionGroup.tsx +8 -4
  159. package/src/providers/i18n/I18nContext.tsx +0 -7
  160. package/src/providers/i18n/locales/en.ts +38 -0
  161. package/src/providers/i18n/locales/ko.ts +38 -0
  162. package/tailwind.config.ts +2 -2
  163. package/tests/components/data/kanban/Kanban.selection.spec.tsx +34 -24
  164. package/tests/components/disclosure/Dialog.spec.tsx +28 -28
  165. package/tests/components/disclosure/DialogProvider.spec.tsx +51 -25
  166. package/tests/components/features/address/AddressSearch.spec.tsx +12 -4
  167. package/tests/components/features/crud-detail/CrudDetail.spec.tsx +1 -0
  168. package/tests/components/features/crud-sheet/CrudSheet.spec.tsx +30 -6
  169. package/tests/components/features/data-select-button/DataSelectButton.spec.tsx +77 -56
  170. package/tests/components/features/permission-table/PermissionTable.spec.tsx +12 -8
  171. package/tests/components/features/shared-data/SharedDataSelect.spec.tsx +172 -0
  172. package/tests/components/features/shared-data/SharedDataSelectList.spec.tsx +14 -2
  173. package/tests/components/feedback/notification/LiveRegion.spec.tsx +20 -9
  174. package/tests/components/feedback/notification/NotificationBanner.spec.tsx +64 -46
  175. package/tests/components/feedback/notification/NotificationBell.spec.tsx +70 -51
  176. package/tests/components/feedback/notification/NotificationContext.spec.tsx +105 -78
  177. package/tests/components/form-control/checkbox/Checkbox.spec.tsx +25 -20
  178. package/tests/components/form-control/checkbox/CheckboxGroup.spec.tsx +53 -30
  179. package/tests/components/form-control/checkbox/Radio.spec.tsx +25 -20
  180. package/tests/components/form-control/checkbox/RadioGroup.spec.tsx +53 -30
  181. package/tests/components/form-control/color-picker/ColorPicker.spec.tsx +24 -15
  182. package/tests/components/form-control/combobox/Combobox.spec.tsx +92 -59
  183. package/tests/components/form-control/date-range-picker/DateRangePicker.spec.tsx +2 -2
  184. package/tests/components/form-control/field/DatePicker.spec.tsx +50 -44
  185. package/tests/components/form-control/field/DateTimePicker.spec.tsx +51 -45
  186. package/tests/components/form-control/field/NumberInput.spec.tsx +53 -47
  187. package/tests/components/form-control/field/TextInput.spec.tsx +50 -44
  188. package/tests/components/form-control/field/Textarea.spec.tsx +35 -29
  189. package/tests/components/form-control/field/TimePicker.spec.tsx +43 -37
  190. package/tests/components/form-control/numpad/Numpad.spec.tsx +175 -25
  191. package/tests/components/form-control/select/Select.spec.tsx +5 -0
  192. package/tests/components/form-control/select/SelectItem.spec.tsx +1 -0
  193. package/tests/components/layout/sidebar/Sidebar.spec.tsx +79 -35
  194. package/tests/components/layout/sidebar/SidebarContainer.spec.tsx +1 -0
  195. package/tests/components/layout/sidebar/SidebarMenu.spec.tsx +28 -17
  196. package/tests/components/layout/topbar/TopbarActions.spec.tsx +41 -23
  197. package/tests/components/layout/topbar/createTopbarActions.spec.tsx +1 -0
  198. package/tests/hooks/usePrint.spec.tsx +1 -1
  199. package/tests/hooks/useRouterLink.spec.tsx +2 -0
  200. package/tests/hooks/useSyncConfig.spec.tsx +1 -0
  201. package/tests/providers/ErrorLoggerProvider.spec.tsx +1 -0
  202. package/tests/providers/PwaUpdateProvider.spec.tsx +16 -6
  203. package/tests/providers/ServiceClientContext.spec.tsx +40 -25
  204. package/tests/providers/i18n/I18nContext.spec.tsx +3 -4
  205. package/tests/providers/shared-data/SharedDataProvider.spec.tsx +2 -0
  206. package/dist/hooks/usePrint.d.ts +0 -3
  207. package/dist/hooks/usePrint.d.ts.map +0 -1
  208. package/dist/hooks/usePrint.js +0 -5
  209. package/dist/hooks/usePrint.js.map +0 -6
  210. package/src/hooks/usePrint.ts +0 -2
@@ -0,0 +1,172 @@
1
+ import { afterEach, beforeEach, describe, it, expect, vi } from "vitest";
2
+ import { render, cleanup } from "@solidjs/testing-library";
3
+ import { createSignal, type Accessor } from "solid-js";
4
+ import {
5
+ SharedDataSelect,
6
+ type InjectedSelectProps,
7
+ } from "@simplysm/solid";
8
+ import { type SharedDataAccessor } from "../../../../src/providers/shared-data/SharedDataContext";
9
+ import { DialogProvider } from "../../../../src/components/disclosure/DialogProvider";
10
+ import { I18nProvider } from "../../../../src/providers/i18n/I18nContext";
11
+ import { ConfigProvider } from "../../../../src/providers/ConfigContext";
12
+
13
+ interface TestItem {
14
+ id: number;
15
+ name: string;
16
+ }
17
+
18
+ const testItems: TestItem[] = [
19
+ { id: 1, name: "Apple" },
20
+ { id: 2, name: "Banana" },
21
+ { id: 3, name: "Cherry" },
22
+ ];
23
+
24
+ function createMockAccessor(itemsSignal: Accessor<TestItem[]>): SharedDataAccessor<TestItem> {
25
+ return {
26
+ items: itemsSignal,
27
+ get: (key) => itemsSignal().find((item) => item.id === key),
28
+ emit: vi.fn(async () => {}),
29
+ getKey: (item) => item.id,
30
+ getSearchText: (item) => item.name,
31
+ };
32
+ }
33
+
34
+ function TestDialogComponent(props: { confirmKeys: number[] } & InjectedSelectProps) {
35
+ return (
36
+ <div data-testid="dialog-content">
37
+ <div data-testid="select-mode">{props.selectMode}</div>
38
+ <div data-testid="selected-keys">{JSON.stringify([...props.selectedKeys])}</div>
39
+ <button
40
+ data-testid="dialog-confirm"
41
+ onClick={() => props.onSelect({ keys: props.confirmKeys })}
42
+ >
43
+ confirm
44
+ </button>
45
+ </div>
46
+ );
47
+ }
48
+
49
+ function renderWithDialog(ui: () => import("solid-js").JSX.Element) {
50
+ return render(() => (
51
+ <ConfigProvider clientName="test"><I18nProvider>
52
+ <DialogProvider>{ui()}</DialogProvider>
53
+ </I18nProvider></ConfigProvider>
54
+ ));
55
+ }
56
+
57
+ describe("SharedDataSelect", () => {
58
+ beforeEach(() => {
59
+ localStorage.setItem("test.i18n-locale", JSON.stringify("en"));
60
+ });
61
+
62
+ afterEach(() => {
63
+ cleanup();
64
+ });
65
+
66
+ it("renders items via ItemTemplate", () => {
67
+ const [items] = createSignal(testItems);
68
+ const accessor = createMockAccessor(items);
69
+
70
+ const { getByText } = renderWithDialog(() => (
71
+ <SharedDataSelect data={accessor} value={1} onValueChange={() => {}}>
72
+ <SharedDataSelect.ItemTemplate>
73
+ {(item: TestItem) => <span>{item.name}</span>}
74
+ </SharedDataSelect.ItemTemplate>
75
+ </SharedDataSelect>
76
+ ));
77
+
78
+ // Select should render with items from accessor
79
+ expect(getByText("Apple")).toBeTruthy();
80
+ });
81
+
82
+ it("renders custom Action button", () => {
83
+ const [items] = createSignal(testItems);
84
+ const accessor = createMockAccessor(items);
85
+ const onClick = vi.fn();
86
+
87
+ const { container } = renderWithDialog(() => (
88
+ <SharedDataSelect data={accessor} value={1} onValueChange={() => {}}>
89
+ <SharedDataSelect.ItemTemplate>
90
+ {(item: TestItem) => <span>{item.name}</span>}
91
+ </SharedDataSelect.ItemTemplate>
92
+ <SharedDataSelect.Action onClick={onClick}>
93
+ <span data-testid="custom-action">Edit</span>
94
+ </SharedDataSelect.Action>
95
+ </SharedDataSelect>
96
+ ));
97
+
98
+ const actionBtn = container.querySelector("[data-testid='custom-action']");
99
+ expect(actionBtn).not.toBeNull();
100
+ });
101
+
102
+ it("opens dialog and applies selection result", async () => {
103
+ const [items] = createSignal(testItems);
104
+ const accessor = createMockAccessor(items);
105
+ const onValueChange = vi.fn();
106
+
107
+ const { container } = renderWithDialog(() => (
108
+ <SharedDataSelect
109
+ data={accessor}
110
+ value={1}
111
+ onValueChange={onValueChange}
112
+ dialog={{
113
+ component: TestDialogComponent,
114
+ props: { confirmKeys: [2] },
115
+ option: { header: "Select Item" },
116
+ }}
117
+ >
118
+ <SharedDataSelect.ItemTemplate>
119
+ {(item: TestItem) => <span>{item.name}</span>}
120
+ </SharedDataSelect.ItemTemplate>
121
+ </SharedDataSelect>
122
+ ));
123
+
124
+ // Click search action button to open dialog
125
+ const searchBtn = container.querySelector("[data-select-action]") as HTMLButtonElement;
126
+ expect(searchBtn).not.toBeNull();
127
+ searchBtn.click();
128
+
129
+ // Confirm in dialog
130
+ await vi.waitFor(() => {
131
+ const confirmBtn = document.querySelector("[data-testid='dialog-confirm']") as HTMLButtonElement;
132
+ expect(confirmBtn).not.toBeNull();
133
+ confirmBtn.click();
134
+ });
135
+
136
+ await vi.waitFor(() => {
137
+ expect(onValueChange).toHaveBeenCalledWith(2);
138
+ });
139
+ });
140
+
141
+ it("passes selectedKeys to dialog component", async () => {
142
+ const [items] = createSignal(testItems);
143
+ const accessor = createMockAccessor(items);
144
+
145
+ const { container } = renderWithDialog(() => (
146
+ <SharedDataSelect
147
+ data={accessor}
148
+ value={3}
149
+ onValueChange={() => {}}
150
+ dialog={{
151
+ component: TestDialogComponent,
152
+ props: { confirmKeys: [] },
153
+ }}
154
+ >
155
+ <SharedDataSelect.ItemTemplate>
156
+ {(item: TestItem) => <span>{item.name}</span>}
157
+ </SharedDataSelect.ItemTemplate>
158
+ </SharedDataSelect>
159
+ ));
160
+
161
+ const searchBtn = container.querySelector("[data-select-action]") as HTMLButtonElement;
162
+ searchBtn.click();
163
+
164
+ await vi.waitFor(() => {
165
+ const selectedKeys = document.querySelector("[data-testid='selected-keys']");
166
+ expect(selectedKeys?.textContent).toBe("[3]");
167
+
168
+ const selectMode = document.querySelector("[data-testid='select-mode']");
169
+ expect(selectMode?.textContent).toBe("single");
170
+ });
171
+ });
172
+ });
@@ -1,8 +1,10 @@
1
- import { afterEach, describe, it, expect, vi } from "vitest";
1
+ import { afterEach, beforeEach, describe, it, expect, vi } from "vitest";
2
2
  import { render, screen, fireEvent, cleanup } from "@solidjs/testing-library";
3
3
  import { createSignal } from "solid-js";
4
4
  import { SharedDataSelectList } from "@simplysm/solid";
5
5
  import { DialogProvider } from "../../../../src/components/disclosure/DialogProvider";
6
+ import { I18nProvider } from "../../../../src/providers/i18n/I18nContext";
7
+ import { ConfigProvider } from "../../../../src/providers/ConfigContext";
6
8
 
7
9
  // SharedDataAccessor mock factory
8
10
  function createMockAccessor<T>(
@@ -25,10 +27,20 @@ function createMockAccessor<T>(
25
27
 
26
28
  // DialogProvider wrapper
27
29
  function renderWithDialog(ui: () => import("solid-js").JSX.Element) {
28
- return render(() => <DialogProvider>{ui()}</DialogProvider>);
30
+ return render(() => (
31
+ <ConfigProvider clientName="test">
32
+ <I18nProvider>
33
+ <DialogProvider>{ui()}</DialogProvider>
34
+ </I18nProvider>
35
+ </ConfigProvider>
36
+ ));
29
37
  }
30
38
 
31
39
  describe("SharedDataSelectList", () => {
40
+ beforeEach(() => {
41
+ localStorage.setItem("test.i18n-locale", JSON.stringify("en"));
42
+ });
43
+
32
44
  afterEach(() => {
33
45
  cleanup();
34
46
  });
@@ -1,14 +1,21 @@
1
1
  import { render, waitFor } from "@solidjs/testing-library";
2
- import { describe, it, expect } from "vitest";
2
+ import { describe, it, expect, beforeEach } from "vitest";
3
3
  import { NotificationProvider } from "../../../../src/components/feedback/notification/NotificationProvider";
4
4
  import { ConfigContext } from "../../../../src/providers/ConfigContext";
5
+ import { I18nProvider } from "../../../../src/providers/i18n/I18nContext";
5
6
  import { useNotification } from "../../../../src/components/feedback/notification/NotificationContext";
6
7
 
7
8
  describe("Notification Live Region", () => {
9
+ beforeEach(() => {
10
+ localStorage.setItem("testApp.i18n-locale", JSON.stringify("en"));
11
+ });
12
+
8
13
  it("Provider has live region with role=status", () => {
9
14
  render(() => (
10
15
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
11
- <NotificationProvider>content</NotificationProvider>
16
+ <I18nProvider>
17
+ <NotificationProvider>content</NotificationProvider>
18
+ </I18nProvider>
12
19
  </ConfigContext.Provider>
13
20
  ));
14
21
 
@@ -21,12 +28,14 @@ describe("Notification Live Region", () => {
21
28
 
22
29
  render(() => (
23
30
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
24
- <NotificationProvider>
25
- {(() => {
26
- notification = useNotification();
27
- return null;
28
- })()}
29
- </NotificationProvider>
31
+ <I18nProvider>
32
+ <NotificationProvider>
33
+ {(() => {
34
+ notification = useNotification();
35
+ return null;
36
+ })()}
37
+ </NotificationProvider>
38
+ </I18nProvider>
30
39
  </ConfigContext.Provider>
31
40
  ));
32
41
 
@@ -42,7 +51,9 @@ describe("Notification Live Region", () => {
42
51
  it("live region is visually hidden (sr-only)", () => {
43
52
  render(() => (
44
53
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
45
- <NotificationProvider>content</NotificationProvider>
54
+ <I18nProvider>
55
+ <NotificationProvider>content</NotificationProvider>
56
+ </I18nProvider>
46
57
  </ConfigContext.Provider>
47
58
  ));
48
59
 
@@ -1,17 +1,23 @@
1
1
  import { render, fireEvent, waitFor } from "@solidjs/testing-library";
2
- import { describe, it, expect, vi } from "vitest";
2
+ import { describe, it, expect, vi, beforeEach } from "vitest";
3
3
  import { NotificationProvider } from "../../../../src/components/feedback/notification/NotificationProvider";
4
4
  import { ConfigContext } from "../../../../src/providers/ConfigContext";
5
+ import { I18nProvider } from "../../../../src/providers/i18n/I18nContext";
5
6
  import { NotificationBanner } from "../../../../src/components/feedback/notification/NotificationBanner";
6
7
  import { useNotification } from "../../../../src/components/feedback/notification/NotificationContext";
7
8
 
8
9
  describe("NotificationBanner", () => {
10
+ beforeEach(() => {
11
+ localStorage.setItem("testApp.i18n-locale", JSON.stringify("en"));
12
+ });
9
13
  it("does not display banner when no notification", () => {
10
14
  const { container } = render(() => (
11
15
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
12
- <NotificationProvider>
13
- <NotificationBanner />
14
- </NotificationProvider>
16
+ <I18nProvider>
17
+ <NotificationProvider>
18
+ <NotificationBanner />
19
+ </NotificationProvider>
20
+ </I18nProvider>
15
21
  </ConfigContext.Provider>
16
22
  ));
17
23
 
@@ -23,13 +29,15 @@ describe("NotificationBanner", () => {
23
29
 
24
30
  render(() => (
25
31
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
26
- <NotificationProvider>
27
- {(() => {
28
- notification = useNotification();
29
- return null;
30
- })()}
31
- <NotificationBanner />
32
- </NotificationProvider>
32
+ <I18nProvider>
33
+ <NotificationProvider>
34
+ {(() => {
35
+ notification = useNotification();
36
+ return null;
37
+ })()}
38
+ <NotificationBanner />
39
+ </NotificationProvider>
40
+ </I18nProvider>
33
41
  </ConfigContext.Provider>
34
42
  ));
35
43
 
@@ -48,13 +56,15 @@ describe("NotificationBanner", () => {
48
56
 
49
57
  render(() => (
50
58
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
51
- <NotificationProvider>
52
- {(() => {
53
- notification = useNotification();
54
- return null;
55
- })()}
56
- <NotificationBanner />
57
- </NotificationProvider>
59
+ <I18nProvider>
60
+ <NotificationProvider>
61
+ {(() => {
62
+ notification = useNotification();
63
+ return null;
64
+ })()}
65
+ <NotificationBanner />
66
+ </NotificationProvider>
67
+ </I18nProvider>
58
68
  </ConfigContext.Provider>
59
69
  ));
60
70
 
@@ -79,13 +89,15 @@ describe("NotificationBanner", () => {
79
89
 
80
90
  render(() => (
81
91
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
82
- <NotificationProvider>
83
- {(() => {
84
- notification = useNotification();
85
- return null;
86
- })()}
87
- <NotificationBanner />
88
- </NotificationProvider>
92
+ <I18nProvider>
93
+ <NotificationProvider>
94
+ {(() => {
95
+ notification = useNotification();
96
+ return null;
97
+ })()}
98
+ <NotificationBanner />
99
+ </NotificationProvider>
100
+ </I18nProvider>
89
101
  </ConfigContext.Provider>
90
102
  ));
91
103
 
@@ -102,13 +114,15 @@ describe("NotificationBanner", () => {
102
114
 
103
115
  render(() => (
104
116
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
105
- <NotificationProvider>
106
- {(() => {
107
- notification = useNotification();
108
- return null;
109
- })()}
110
- <NotificationBanner />
111
- </NotificationProvider>
117
+ <I18nProvider>
118
+ <NotificationProvider>
119
+ {(() => {
120
+ notification = useNotification();
121
+ return null;
122
+ })()}
123
+ <NotificationBanner />
124
+ </NotificationProvider>
125
+ </I18nProvider>
112
126
  </ConfigContext.Provider>
113
127
  ));
114
128
 
@@ -126,13 +140,15 @@ describe("NotificationBanner", () => {
126
140
 
127
141
  render(() => (
128
142
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
129
- <NotificationProvider>
130
- {(() => {
131
- notification = useNotification();
132
- return null;
133
- })()}
134
- <NotificationBanner />
135
- </NotificationProvider>
143
+ <I18nProvider>
144
+ <NotificationProvider>
145
+ {(() => {
146
+ notification = useNotification();
147
+ return null;
148
+ })()}
149
+ <NotificationBanner />
150
+ </NotificationProvider>
151
+ </I18nProvider>
136
152
  </ConfigContext.Provider>
137
153
  ));
138
154
 
@@ -160,13 +176,15 @@ describe("NotificationBanner", () => {
160
176
 
161
177
  render(() => (
162
178
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
163
- <NotificationProvider>
164
- {(() => {
165
- notification = useNotification();
166
- return null;
167
- })()}
168
- <NotificationBanner />
169
- </NotificationProvider>
179
+ <I18nProvider>
180
+ <NotificationProvider>
181
+ {(() => {
182
+ notification = useNotification();
183
+ return null;
184
+ })()}
185
+ <NotificationBanner />
186
+ </NotificationProvider>
187
+ </I18nProvider>
170
188
  </ConfigContext.Provider>
171
189
  ));
172
190
 
@@ -2,6 +2,7 @@ import { render, fireEvent, waitFor } from "@solidjs/testing-library";
2
2
  import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
3
3
  import { NotificationProvider } from "../../../../src/components/feedback/notification/NotificationProvider";
4
4
  import { ConfigContext } from "../../../../src/providers/ConfigContext";
5
+ import { I18nProvider } from "../../../../src/providers/i18n/I18nContext";
5
6
  import { NotificationBell } from "../../../../src/components/feedback/notification/NotificationBell";
6
7
  import { useNotification } from "../../../../src/components/feedback/notification/NotificationContext";
7
8
 
@@ -18,9 +19,11 @@ describe("NotificationBell", () => {
18
19
  it("renders button", () => {
19
20
  const { container } = render(() => (
20
21
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
21
- <NotificationProvider>
22
- <NotificationBell />
23
- </NotificationProvider>
22
+ <I18nProvider>
23
+ <NotificationProvider>
24
+ <NotificationBell />
25
+ </NotificationProvider>
26
+ </I18nProvider>
24
27
  </ConfigContext.Provider>
25
28
  ));
26
29
 
@@ -30,9 +33,11 @@ describe("NotificationBell", () => {
30
33
  it("does not show badge when there are no notifications", () => {
31
34
  render(() => (
32
35
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
33
- <NotificationProvider>
34
- <NotificationBell />
35
- </NotificationProvider>
36
+ <I18nProvider>
37
+ <NotificationProvider>
38
+ <NotificationBell />
39
+ </NotificationProvider>
40
+ </I18nProvider>
36
41
  </ConfigContext.Provider>
37
42
  ));
38
43
 
@@ -45,13 +50,15 @@ describe("NotificationBell", () => {
45
50
 
46
51
  render(() => (
47
52
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
48
- <NotificationProvider>
49
- {(() => {
50
- notification = useNotification();
51
- return null;
52
- })()}
53
- <NotificationBell />
54
- </NotificationProvider>
53
+ <I18nProvider>
54
+ <NotificationProvider>
55
+ {(() => {
56
+ notification = useNotification();
57
+ return null;
58
+ })()}
59
+ <NotificationBell />
60
+ </NotificationProvider>
61
+ </I18nProvider>
55
62
  </ConfigContext.Provider>
56
63
  ));
57
64
 
@@ -69,13 +76,15 @@ describe("NotificationBell", () => {
69
76
 
70
77
  render(() => (
71
78
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
72
- <NotificationProvider>
73
- {(() => {
74
- notification = useNotification();
75
- return null;
76
- })()}
77
- <NotificationBell />
78
- </NotificationProvider>
79
+ <I18nProvider>
80
+ <NotificationProvider>
81
+ {(() => {
82
+ notification = useNotification();
83
+ return null;
84
+ })()}
85
+ <NotificationBell />
86
+ </NotificationProvider>
87
+ </I18nProvider>
79
88
  </ConfigContext.Provider>
80
89
  ));
81
90
 
@@ -95,13 +104,15 @@ describe("NotificationBell", () => {
95
104
 
96
105
  render(() => (
97
106
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
98
- <NotificationProvider>
99
- {(() => {
100
- notification = useNotification();
101
- return null;
102
- })()}
103
- <NotificationBell />
104
- </NotificationProvider>
107
+ <I18nProvider>
108
+ <NotificationProvider>
109
+ {(() => {
110
+ notification = useNotification();
111
+ return null;
112
+ })()}
113
+ <NotificationBell />
114
+ </NotificationProvider>
115
+ </I18nProvider>
105
116
  </ConfigContext.Provider>
106
117
  ));
107
118
 
@@ -123,13 +134,15 @@ describe("NotificationBell", () => {
123
134
 
124
135
  render(() => (
125
136
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
126
- <NotificationProvider>
127
- {(() => {
128
- notification = useNotification();
129
- return null;
130
- })()}
131
- <NotificationBell />
132
- </NotificationProvider>
137
+ <I18nProvider>
138
+ <NotificationProvider>
139
+ {(() => {
140
+ notification = useNotification();
141
+ return null;
142
+ })()}
143
+ <NotificationBell />
144
+ </NotificationProvider>
145
+ </I18nProvider>
133
146
  </ConfigContext.Provider>
134
147
  ));
135
148
 
@@ -144,9 +157,11 @@ describe("NotificationBell", () => {
144
157
  it("sets aria-haspopup and aria-expanded correctly", async () => {
145
158
  render(() => (
146
159
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
147
- <NotificationProvider>
148
- <NotificationBell />
149
- </NotificationProvider>
160
+ <I18nProvider>
161
+ <NotificationProvider>
162
+ <NotificationBell />
163
+ </NotificationProvider>
164
+ </I18nProvider>
150
165
  </ConfigContext.Provider>
151
166
  ));
152
167
 
@@ -166,13 +181,15 @@ describe("NotificationBell", () => {
166
181
 
167
182
  render(() => (
168
183
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
169
- <NotificationProvider>
170
- {(() => {
171
- notification = useNotification();
172
- return null;
173
- })()}
174
- <NotificationBell />
175
- </NotificationProvider>
184
+ <I18nProvider>
185
+ <NotificationProvider>
186
+ {(() => {
187
+ notification = useNotification();
188
+ return null;
189
+ })()}
190
+ <NotificationBell />
191
+ </NotificationProvider>
192
+ </I18nProvider>
176
193
  </ConfigContext.Provider>
177
194
  ));
178
195
 
@@ -196,13 +213,15 @@ describe("NotificationBell", () => {
196
213
 
197
214
  render(() => (
198
215
  <ConfigContext.Provider value={{ clientName: "testApp" }}>
199
- <NotificationProvider>
200
- {(() => {
201
- notification = useNotification();
202
- return null;
203
- })()}
204
- <NotificationBell />
205
- </NotificationProvider>
216
+ <I18nProvider>
217
+ <NotificationProvider>
218
+ {(() => {
219
+ notification = useNotification();
220
+ return null;
221
+ })()}
222
+ <NotificationBell />
223
+ </NotificationProvider>
224
+ </I18nProvider>
206
225
  </ConfigContext.Provider>
207
226
  ));
208
227