@griddo/ax 1.75.111 → 1.75.113

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 (52) hide show
  1. package/config/jest/componentsMock.js +122 -1
  2. package/package.json +2 -2
  3. package/src/__tests__/components/Avatar/__snapshots__/Avatar.test.tsx.snap +10 -10
  4. package/src/__tests__/components/ConfigPanel/ConfigPanel.test.tsx +252 -0
  5. package/src/__tests__/components/ConfigPanel/Form/ConnectedField/ConnectedField.test.tsx +177 -0
  6. package/src/__tests__/components/ConfigPanel/Form/ConnectedField/NavConnectedField/NavConnectedField.test.tsx +161 -0
  7. package/src/__tests__/components/ConfigPanel/Form/ConnectedField/PageConnectedField/Field/Field.test.tsx +115 -0
  8. package/src/__tests__/components/ConfigPanel/Form/ConnectedField/PageConnectedField/PageConnectedField.test.tsx +518 -0
  9. package/src/__tests__/components/ConfigPanel/Form/ConnectedField/PageConnectedField/TemplateManager/TemplateManager.test.tsx +144 -0
  10. package/src/__tests__/components/ConfigPanel/Form/Form.test.tsx +235 -0
  11. package/src/__tests__/components/ConfigPanel/GlobalPageForm/GlobalPageForm.test.tsx +196 -0
  12. package/src/__tests__/components/ConfigPanel/Header/Header.test.tsx +152 -0
  13. package/src/__tests__/components/ConfigPanel/NavigationForm/Field/Field.test.tsx +106 -0
  14. package/src/__tests__/components/ConfigPanel/NavigationForm/NavigationForm.test.tsx +93 -0
  15. package/src/__tests__/components/ConfigPanel/PreviewForm/PreviewForm.test.tsx +93 -0
  16. package/src/__tests__/components/Fields/FieldGroup/FieldGroup.test.tsx +5 -5
  17. package/src/__tests__/components/Fields/NoteField/NoteField.test.tsx +3 -3
  18. package/src/__tests__/components/Fields/SliderField/SliderField.test.tsx +4 -4
  19. package/src/__tests__/components/Fields/TagField/TagField.test.tsx +10 -10
  20. package/src/__tests__/components/Fields/TextArea/TextArea.test.tsx +3 -3
  21. package/src/__tests__/components/Fields/TextField/TextField.test.tsx +8 -8
  22. package/src/__tests__/components/Fields/UrlField/UrlField.test.tsx +2 -2
  23. package/src/__tests__/components/Gallery/Gallery.test.tsx +613 -0
  24. package/src/__tests__/components/Gallery/GalleryFilters/Orientation/Orientation.test.tsx +51 -0
  25. package/src/__tests__/components/Gallery/GalleryFilters/SortBy/SortBy.test.tsx +117 -0
  26. package/src/__tests__/components/Gallery/GalleryFilters/Type/Type.test.tsx +51 -0
  27. package/src/__tests__/components/Gallery/GalleryPanel/DetailPanel/DetailPanel.test.tsx +853 -0
  28. package/src/__tests__/components/Gallery/GalleryPanel/GalleryDragAndDrop/GalleryDragAndDrop.test.tsx +252 -0
  29. package/src/__tests__/components/Gallery/GalleryPanel/GalleryPanel.test.tsx +56 -0
  30. package/src/__tests__/components/Image/Image.test.tsx +5 -5
  31. package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/Field/index.tsx +3 -4
  32. package/src/components/ConfigPanel/Form/index.tsx +13 -5
  33. package/src/components/ConfigPanel/GlobalPageForm/index.tsx +5 -5
  34. package/src/components/ConfigPanel/Header/index.tsx +3 -3
  35. package/src/components/ConfigPanel/NavigationForm/Field/index.tsx +5 -3
  36. package/src/components/ConfigPanel/NavigationForm/index.tsx +2 -2
  37. package/src/components/ConfigPanel/PreviewForm/index.tsx +3 -3
  38. package/src/components/ConfigPanel/index.tsx +2 -3
  39. package/src/components/Fields/FieldGroup/index.tsx +3 -3
  40. package/src/components/Fields/NoteField/index.tsx +2 -2
  41. package/src/components/Fields/SliderField/index.tsx +10 -3
  42. package/src/components/Fields/TagField/index.tsx +2 -2
  43. package/src/components/Fields/TextArea/index.tsx +1 -1
  44. package/src/components/Fields/TextField/index.tsx +3 -3
  45. package/src/components/Gallery/GalleryFilters/Orientation/index.tsx +14 -6
  46. package/src/components/Gallery/GalleryFilters/SortBy/index.tsx +2 -2
  47. package/src/components/Gallery/GalleryFilters/Type/index.tsx +2 -2
  48. package/src/components/Gallery/GalleryPanel/DetailPanel/index.tsx +4 -4
  49. package/src/components/Gallery/GalleryPanel/GalleryDragAndDrop/index.tsx +5 -4
  50. package/src/components/Gallery/GalleryPanel/index.tsx +3 -11
  51. package/src/components/Gallery/index.tsx +6 -5
  52. package/src/containers/PageEditor/actions.tsx +1 -2
@@ -0,0 +1,518 @@
1
+ import * as React from "react";
2
+ import axios from "axios";
3
+
4
+ import { ThemeProvider } from "styled-components";
5
+ import { render, cleanup, screen, fireEvent } from "../../../../../../../config/jest/test-utils";
6
+ import configureStore from "redux-mock-store";
7
+ import "@testing-library/jest-dom";
8
+ import thunk from "redux-thunk";
9
+
10
+ import { parseTheme } from "@ax/helpers";
11
+ import PageConnectedField from "@ax/components/ConfigPanel/Form/ConnectedField/PageConnectedField";
12
+ import globalTheme from "@ax/themes/theme.json";
13
+
14
+ beforeEach(() => {
15
+ cleanup();
16
+ });
17
+
18
+ jest.mock("axios");
19
+ const mockedAxios = axios as jest.MockedFunction<typeof axios>;
20
+
21
+ const middlewares: any = [thunk];
22
+ const mockStore = configureStore(middlewares);
23
+ const updateEditorContentMock = jest.fn();
24
+ const initialStore = {
25
+ pageEditor: {
26
+ selectedContent: {
27
+ title: {
28
+ component: "Page",
29
+ templateType: "default",
30
+ },
31
+ template: {
32
+ type: "template",
33
+ templateType: "BasicTemplate",
34
+ heroSection: {
35
+ component: "Section",
36
+ name: "Hero Section",
37
+ modules: [],
38
+ sectionPosition: 1,
39
+ editorID: 2,
40
+ parentEditorID: 1,
41
+ key: "heroSection",
42
+ },
43
+ editorID: 1,
44
+ parentEditorID: 0,
45
+ },
46
+ },
47
+ errors: [{}],
48
+ },
49
+ sites: {
50
+ currentSitePages: [
51
+ {
52
+ editorID: 1,
53
+ },
54
+ ],
55
+ },
56
+ app: {
57
+ lang: { locale: "es-ES", id: 0 },
58
+ },
59
+ dataPacks: {
60
+ templates: [{ id: "default" }, { id: "BasicTemplate" }],
61
+ activated: [],
62
+ },
63
+ menu: {
64
+ savedMenus: null,
65
+ },
66
+ navigationActions: {
67
+ updateEditorContent: updateEditorContentMock,
68
+ },
69
+ };
70
+
71
+ const defaultProps = {
72
+ field: {
73
+ title: "Name",
74
+ key: "parent",
75
+ type: "TextField",
76
+ mandatory: true,
77
+ modifiable: true,
78
+ autoComplete: "a",
79
+ slugTo: "la",
80
+ },
81
+ schema: {
82
+ title: "Header",
83
+ component: "Header",
84
+ type: "header",
85
+ configTabs: [
86
+ {
87
+ title: "content",
88
+ fields: [
89
+ {
90
+ title: "Name",
91
+ key: "title",
92
+ type: "TextField",
93
+ mandatory: true,
94
+ autoComplete: "a",
95
+ },
96
+ ],
97
+ },
98
+ ],
99
+ schemaType: "module",
100
+ },
101
+ componentType: "page",
102
+ isPage: true,
103
+ isGlobal: true,
104
+ selectedTab: "content",
105
+ theme: "default-theme",
106
+ };
107
+
108
+ const templateProps = {
109
+ field: {
110
+ title: "Name",
111
+ key: "template",
112
+ type: "template",
113
+ modifiable: true,
114
+ },
115
+ schema: {
116
+ title: "Header",
117
+ component: "Header",
118
+ type: "header",
119
+ configTabs: [
120
+ {
121
+ title: "content",
122
+ fields: [
123
+ {
124
+ title: "Name",
125
+ key: "title",
126
+ type: "TextField",
127
+ mandatory: true,
128
+ },
129
+ ],
130
+ },
131
+ ],
132
+ schemaType: "template",
133
+ },
134
+ isPage: true,
135
+ isGlobal: true,
136
+ selectedTab: "config",
137
+ theme: "default-theme",
138
+ };
139
+
140
+ const data = {
141
+ data: [],
142
+ status: 200,
143
+ statusText: "Ok",
144
+ headers: {},
145
+ config: {},
146
+ };
147
+
148
+ mockedAxios.mockResolvedValue(data);
149
+
150
+ describe("PageConnectedField component rendering", () => {
151
+ it("should render PageConnectedField", () => {
152
+ const store = mockStore(initialStore);
153
+
154
+ render(
155
+ <ThemeProvider theme={parseTheme(globalTheme)}>
156
+ <PageConnectedField {...defaultProps} />
157
+ </ThemeProvider>,
158
+ { store }
159
+ );
160
+
161
+ // It's loading Field -> FieldContainer with a TextField
162
+ const textFieldContainer = screen.getByTestId("text-field-container");
163
+ expect(textFieldContainer).toBeTruthy();
164
+ });
165
+
166
+ it("should render the TemplateManager", () => {
167
+ const store = mockStore(initialStore);
168
+
169
+ render(
170
+ <ThemeProvider theme={parseTheme(globalTheme)}>
171
+ <PageConnectedField {...templateProps} />
172
+ </ThemeProvider>,
173
+ { store }
174
+ );
175
+
176
+ const templateText = screen.getByText(/Template Options/i);
177
+ expect(templateText).toBeInTheDocument();
178
+ });
179
+
180
+ it("should call updateEditorContent and overWriteHeaderConfig if isOverride", () => {
181
+ const initialStore = {
182
+ pageEditor: {
183
+ selectedEditorID: 1,
184
+ selectedContent: {
185
+ type: "header",
186
+ isHome: true,
187
+ title: {
188
+ component: "Page",
189
+ templateType: "default",
190
+ },
191
+ template: {
192
+ type: "template",
193
+ templateType: "BasicTemplate",
194
+ heroSection: {
195
+ component: "Section",
196
+ name: "Hero Section",
197
+ modules: [],
198
+ sectionPosition: 1,
199
+ editorID: 2,
200
+ parentEditorID: 1,
201
+ key: "heroSection",
202
+ },
203
+ editorID: 1,
204
+ parentEditorID: 0,
205
+ },
206
+ },
207
+ editorContent: {
208
+ isHome: true,
209
+ setAsHome: true,
210
+ editorContent: {
211
+ headerConfig: {},
212
+ },
213
+ },
214
+ errors: [{}],
215
+ },
216
+ sites: {
217
+ currentSitePages: [
218
+ {
219
+ editorID: 1,
220
+ },
221
+ ],
222
+ },
223
+ app: {
224
+ lang: { locale: "es-ES", id: 0 },
225
+ },
226
+ dataPacks: {
227
+ templates: [{ id: "default" }, { id: "BasicTemplate" }],
228
+ activated: [],
229
+ },
230
+ };
231
+
232
+ const store = mockStore(initialStore);
233
+
234
+ render(
235
+ <ThemeProvider theme={parseTheme(globalTheme)}>
236
+ <PageConnectedField {...defaultProps} />
237
+ </ThemeProvider>,
238
+ { store }
239
+ );
240
+
241
+ expect(store.getActions()).toContainEqual({
242
+ payload: { editorContent: initialStore.pageEditor.editorContent },
243
+ type: "pageEditor/SET_EDITOR_CONTENT",
244
+ });
245
+ });
246
+
247
+ it("should call getPageBreadCrumb", () => {
248
+ defaultProps.field.key = "parent";
249
+ const initialStore = {
250
+ pageEditor: {
251
+ selectedEditorID: 1,
252
+ selectedContent: {
253
+ type: "TextField",
254
+ isHome: false,
255
+ component: "Image",
256
+ },
257
+ editorContent: {
258
+ isHome: false,
259
+ setAsHome: false,
260
+ editorContent: {
261
+ headerConfig: {},
262
+ },
263
+ },
264
+ errors: [{}],
265
+ },
266
+ sites: {
267
+ currentSitePages: [
268
+ {
269
+ editorID: 1,
270
+ },
271
+ ],
272
+ },
273
+ app: {
274
+ lang: { locale: "es-ES", id: 0 },
275
+ },
276
+ dataPacks: {
277
+ templates: [{ id: "default" }, { id: "BasicTemplate" }],
278
+ activated: [],
279
+ },
280
+ };
281
+
282
+ const store = mockStore(initialStore);
283
+ const component = (
284
+ <ThemeProvider theme={parseTheme(globalTheme)}>
285
+ <PageConnectedField {...defaultProps} />
286
+ </ThemeProvider>
287
+ );
288
+
289
+ render(component, { store });
290
+
291
+ // It's loading Field -> FieldContainer with a TextField
292
+ const inputComponent = screen.getByTestId<HTMLInputElement>("input-component");
293
+ expect(inputComponent).toBeTruthy();
294
+ fireEvent.change(inputComponent, { target: { value: "value" } });
295
+ expect(store.getActions()).toContainEqual({
296
+ payload: { editorContent: initialStore.pageEditor.editorContent },
297
+ type: "pageEditor/SET_EDITOR_CONTENT",
298
+ });
299
+ });
300
+
301
+ it("should call updateEditorContent if key is setAsHome", () => {
302
+ defaultProps.field.key = "setAsHome";
303
+ const initialStore = {
304
+ pageEditor: {
305
+ selectedEditorID: 1,
306
+ selectedContent: {
307
+ type: "TextField",
308
+ isHome: false,
309
+ component: "Image",
310
+ },
311
+ editorContent: {
312
+ isHome: false,
313
+ setAsHome: false,
314
+ editorContent: {
315
+ headerConfig: {},
316
+ },
317
+ },
318
+ errors: [{}],
319
+ },
320
+ sites: {
321
+ currentSitePages: [
322
+ {
323
+ editorID: 1,
324
+ },
325
+ ],
326
+ },
327
+ app: {
328
+ lang: { locale: "es-ES", id: 0 },
329
+ },
330
+ dataPacks: {
331
+ templates: [{ id: "default" }, { id: "BasicTemplate" }],
332
+ activated: [],
333
+ },
334
+ };
335
+
336
+ const store = mockStore(initialStore);
337
+ const component = (
338
+ <ThemeProvider theme={parseTheme(globalTheme)}>
339
+ <PageConnectedField {...defaultProps} />
340
+ </ThemeProvider>
341
+ );
342
+
343
+ render(component, { store });
344
+
345
+ // It's loading Field -> FieldContainer with a TextField
346
+ const inputComponent = screen.getByTestId<HTMLInputElement>("input-component");
347
+ expect(inputComponent).toBeTruthy();
348
+ fireEvent.change(inputComponent, { target: { value: "value" } });
349
+ expect(store.getActions()).toContainEqual({
350
+ payload: { editorContent: initialStore.pageEditor.editorContent },
351
+ type: "pageEditor/SET_EDITOR_CONTENT",
352
+ });
353
+ });
354
+
355
+ it("should call updateEditorContent if key is title and isPageTitle", () => {
356
+ defaultProps.field.key = "title";
357
+ const initialStore = {
358
+ pageEditor: {
359
+ selectedEditorID: 1,
360
+ selectedContent: {
361
+ type: "TextField",
362
+ isHome: false,
363
+ component: "Page",
364
+ },
365
+ editorContent: {
366
+ isHome: false,
367
+ setAsHome: false,
368
+ editorContent: {
369
+ headerConfig: {},
370
+ },
371
+ },
372
+ errors: [{}],
373
+ },
374
+ sites: {
375
+ currentSitePages: [
376
+ {
377
+ editorID: 1,
378
+ },
379
+ ],
380
+ },
381
+ app: {
382
+ lang: { locale: "es-ES", id: 0 },
383
+ },
384
+ dataPacks: {
385
+ templates: [{ id: "default" }, { id: "BasicTemplate" }],
386
+ activated: [],
387
+ },
388
+ };
389
+
390
+ const store = mockStore(initialStore);
391
+ const component = (
392
+ <ThemeProvider theme={parseTheme(globalTheme)}>
393
+ <PageConnectedField {...defaultProps} />
394
+ </ThemeProvider>
395
+ );
396
+
397
+ render(component, { store });
398
+
399
+ // It's loading Field -> FieldContainer with a TextField
400
+ const inputComponent = screen.getByTestId<HTMLInputElement>("input-component");
401
+ expect(inputComponent).toBeTruthy();
402
+ fireEvent.change(inputComponent, { target: { value: "value" } });
403
+ expect(store.getActions()).toContainEqual({
404
+ payload: { editorContent: initialStore.pageEditor.editorContent },
405
+ type: "pageEditor/SET_EDITOR_CONTENT",
406
+ });
407
+ });
408
+
409
+ it("should call updateEditorContent if key is file and isComponentImage", () => {
410
+ defaultProps.field.key = "file";
411
+ const initialStore = {
412
+ pageEditor: {
413
+ selectedEditorID: 1,
414
+ selectedContent: {
415
+ type: "TextField",
416
+ isHome: false,
417
+ component: "Image",
418
+ },
419
+ editorContent: {
420
+ isHome: false,
421
+ setAsHome: false,
422
+ editorContent: {
423
+ headerConfig: {},
424
+ },
425
+ },
426
+ errors: [{}],
427
+ },
428
+ sites: {
429
+ currentSitePages: [
430
+ {
431
+ editorID: 1,
432
+ },
433
+ ],
434
+ },
435
+ app: {
436
+ lang: { locale: "es-ES", id: 0 },
437
+ },
438
+ dataPacks: {
439
+ templates: [{ id: "default" }, { id: "BasicTemplate" }],
440
+ activated: [],
441
+ },
442
+ };
443
+
444
+ const store = mockStore(initialStore);
445
+ const component = (
446
+ <ThemeProvider theme={parseTheme(globalTheme)}>
447
+ <PageConnectedField {...defaultProps} />
448
+ </ThemeProvider>
449
+ );
450
+
451
+ render(component, { store });
452
+
453
+ // It's loading Field -> FieldContainer with a TextField
454
+ const inputComponent = screen.getByTestId<HTMLInputElement>("input-component");
455
+ expect(inputComponent).toBeTruthy();
456
+ fireEvent.change(inputComponent, { target: { value: "value" } });
457
+ expect(store.getActions()).toContainEqual({
458
+ payload: { editorContent: initialStore.pageEditor.editorContent },
459
+ type: "pageEditor/SET_EDITOR_CONTENT",
460
+ });
461
+ });
462
+
463
+ it("should call updateEditorContent if key is slugTo is present", () => {
464
+ defaultProps.field.key = "file";
465
+ defaultProps.field.slugTo = "value";
466
+
467
+ const initialStore = {
468
+ pageEditor: {
469
+ selectedEditorID: 1,
470
+ selectedContent: {
471
+ type: "TextField",
472
+ isHome: false,
473
+ component: "Image",
474
+ },
475
+ editorContent: {
476
+ isHome: false,
477
+ setAsHome: false,
478
+ editorContent: {
479
+ headerConfig: {},
480
+ },
481
+ },
482
+ errors: [{}],
483
+ },
484
+ sites: {
485
+ currentSitePages: [
486
+ {
487
+ editorID: 1,
488
+ },
489
+ ],
490
+ },
491
+ app: {
492
+ lang: { locale: "es-ES", id: 0 },
493
+ },
494
+ dataPacks: {
495
+ templates: [{ id: "default" }, { id: "BasicTemplate" }],
496
+ activated: [],
497
+ },
498
+ };
499
+
500
+ const store = mockStore(initialStore);
501
+ const component = (
502
+ <ThemeProvider theme={parseTheme(globalTheme)}>
503
+ <PageConnectedField {...defaultProps} />
504
+ </ThemeProvider>
505
+ );
506
+
507
+ render(component, { store });
508
+
509
+ // It's loading Field -> FieldContainer with a TextField
510
+ const inputComponent = screen.getByTestId<HTMLInputElement>("input-component");
511
+ expect(inputComponent).toBeTruthy();
512
+ fireEvent.change(inputComponent, { target: { value: "value" } });
513
+ expect(store.getActions()).toContainEqual({
514
+ payload: { editorContent: initialStore.pageEditor.editorContent },
515
+ type: "pageEditor/SET_EDITOR_CONTENT",
516
+ });
517
+ });
518
+ });
@@ -0,0 +1,144 @@
1
+ import * as React from "react";
2
+
3
+ import { ThemeProvider } from "styled-components";
4
+ import { render, cleanup, screen, fireEvent } from "../../../../../../../../config/jest/test-utils";
5
+ import configureStore from "redux-mock-store";
6
+ import "@testing-library/jest-dom";
7
+
8
+ import { parseTheme } from "@ax/helpers";
9
+ import TemplateManager from "@ax/components/ConfigPanel/Form/ConnectedField/PageConnectedField/TemplateManager";
10
+ import globalTheme from "@ax/themes/theme.json";
11
+
12
+ beforeEach(() => {
13
+ cleanup();
14
+ });
15
+
16
+ const middlewares: any = [];
17
+ const mockStore = configureStore(middlewares);
18
+ const updateValueMock = jest.fn();
19
+
20
+ const defaultProps = {
21
+ template: {
22
+ schemaType: "template",
23
+ displayName: "Basic Template",
24
+ component: "BasicTemplate",
25
+ dataPacks: null,
26
+ type: {
27
+ label: "Static",
28
+ value: "static",
29
+ },
30
+ config: [
31
+ {
32
+ title: "Hero Section",
33
+ type: "TextField",
34
+ maxItems: 1,
35
+ whiteList: ["BasicContent", "CardCollection"],
36
+ key: "heroSection",
37
+ autoComplete: "a",
38
+ },
39
+ ],
40
+ },
41
+ updateValue: updateValueMock,
42
+ goTo: jest.fn(),
43
+ objKey: "template",
44
+ pages: [],
45
+ selectedTab: "config",
46
+ selectedContent: {
47
+ title: {
48
+ component: "Page",
49
+ templateType: "default",
50
+ },
51
+ template: {
52
+ type: "template",
53
+ templateType: "BasicTemplate",
54
+ heroSection: {
55
+ component: "Section",
56
+ name: "Hero Section",
57
+ modules: [],
58
+ sectionPosition: 1,
59
+ editorID: 2,
60
+ parentEditorID: 1,
61
+ key: "heroSection",
62
+ },
63
+ editorID: 1,
64
+ parentEditorID: 0,
65
+ },
66
+ },
67
+ actions: {},
68
+ activatedPacks: [],
69
+ isTemplateActivated: true,
70
+ deleteError: jest.fn(),
71
+ errors: [],
72
+ theme: "griddo-alt-theme",
73
+ moduleCopy: null,
74
+ availableDataPacks: [],
75
+ };
76
+
77
+ const initialStore = {
78
+ dataPacks: {
79
+ activated: [
80
+ {
81
+ id: "ARTICLES",
82
+ title: "Articles",
83
+ category: {
84
+ id: "ARTICLES",
85
+ label: "Articles",
86
+ },
87
+ description: "Allows you to hightlight articles",
88
+ image:
89
+ "https://res.cloudinary.com/thesaurus-cms/image/upload/griddo-components/data-packs-thumbnails/articles.png",
90
+ templates: [],
91
+ modules: [
92
+ {
93
+ id: "ArticlesDistributor",
94
+ title: "Articles Distributor",
95
+ category: "articlesAndEvents",
96
+ thumbnails: {
97
+ "1x": "https://res.cloudinary.com/thesaurus-cms/image/upload/griddo-components/thumbnails/ArticlesDistributor",
98
+ "2x": "https://res.cloudinary.com/thesaurus-cms/image/upload/griddo-components/thumbnails/ArticlesDistributor@2x",
99
+ },
100
+ dataPacks: ["ARTICLES"],
101
+ type: {},
102
+ sectionList: {
103
+ BasicTemplate: ["mainContent"],
104
+ },
105
+ },
106
+ ],
107
+ categories: [],
108
+ activated: true,
109
+ config: "config",
110
+ },
111
+ ],
112
+ available: [],
113
+ modules: [],
114
+ },
115
+ };
116
+
117
+ const store = mockStore(initialStore);
118
+
119
+ describe("TemplateManager component rendering", () => {
120
+ it("should render the component", () => {
121
+ render(
122
+ <ThemeProvider theme={parseTheme(globalTheme)}>
123
+ <TemplateManager {...defaultProps} />
124
+ </ThemeProvider>,
125
+ { store }
126
+ );
127
+
128
+ expect(screen.getByText(/Template Options/i)).toBeInTheDocument();
129
+ });
130
+
131
+ it("should trigger the handleUpdate", () => {
132
+ render(
133
+ <ThemeProvider theme={parseTheme(globalTheme)}>
134
+ <TemplateManager {...defaultProps} />
135
+ </ThemeProvider>,
136
+ { store }
137
+ );
138
+
139
+ expect(screen.getByText(/Template Options/i)).toBeInTheDocument();
140
+ expect(screen.getByTestId("input-component")).toBeTruthy();
141
+ fireEvent.change(screen.getByTestId<HTMLInputElement>("input-component"), { target: { value: "test" } });
142
+ expect(updateValueMock).toBeCalled();
143
+ });
144
+ });