@griddo/ax 12.4.0 → 12.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/config/webpack.config.js +5 -0
  2. package/package.json +2 -2
  3. package/src/__tests__/components/ConfigPanel/Form/Form.test.tsx +47 -57
  4. package/src/__tests__/components/ConfigPanel/Header/Header.test.tsx +46 -42
  5. package/src/__tests__/components/ElementsTooltip/ElementsTooltip.test.tsx +6 -17
  6. package/src/__tests__/components/EmptyState/EmptyState.test.tsx +9 -9
  7. package/src/__tests__/components/Fields/AsyncSelect/AsyncSelect.test.tsx +60 -50
  8. package/src/__tests__/components/Fields/ColorPicker/ColorPicker.test.tsx +66 -58
  9. package/src/__tests__/components/Fields/ComponentContainer/ComponentContainer.test.tsx +222 -425
  10. package/src/__tests__/components/Fields/FileField/FileField.test.tsx +13 -14
  11. package/src/__tests__/components/Fields/ImageField/ImageField.test.tsx +275 -259
  12. package/src/__tests__/components/Fields/IntegrationsField/IntegrationsField.test.tsx +50 -48
  13. package/src/__tests__/components/Fields/NoteField/NoteField.test.tsx +9 -8
  14. package/src/__tests__/components/Fields/NumberField/NumberField.test.tsx +8 -12
  15. package/src/__tests__/components/Fields/TextArea/TextArea.test.tsx +6 -2
  16. package/src/__tests__/components/Fields/ToggleField/ToggleField.test.tsx +15 -23
  17. package/src/__tests__/components/Fields/Tooltip/Tooltip.test.tsx +8 -2
  18. package/src/__tests__/components/Fields/VisualUniqueSelection/VisualUniqueSelection.test.tsx +29 -21
  19. package/src/__tests__/components/Fields/Wysiwyg/Wysiwyg.config.test.tsx +103 -0
  20. package/src/__tests__/components/FieldsBehavior/FieldsBehavior.test.tsx +7 -2
  21. package/src/__tests__/components/ResizePanel/ResizePanel.test.tsx +8 -6
  22. package/src/__tests__/components/SideModal/SideModal.test.tsx +150 -104
  23. package/src/__tests__/components/TableFilters/LiveFilter/LiveFilter.test.tsx +15 -29
  24. package/src/__tests__/components/TableFilters/StatusFilter/StatusFilter.test.tsx +61 -36
  25. package/src/__tests__/components/Tabs/Tabs.test.tsx +65 -61
  26. package/src/__tests__/components/Toast/Toast.test.tsx +19 -21
  27. package/src/__tests__/modules/FramePreview/FramePreview.test.tsx +16 -0
  28. package/src/__tests__/modules/Sites/SitesList/ListView/BulkHeader/BulkHeader.test.tsx +24 -19
  29. package/src/__tests__/modules/Sites/SitesList/SitesList.test.tsx +15 -6
  30. package/src/__tests__/modules/Users/Roles/BulkHeader/BulkHeader.test.tsx +69 -64
  31. package/src/__tests__/modules/Users/Roles/Roles.test.tsx +7 -4
  32. package/src/components/Fields/Wysiwyg/config.tsx +68 -17
  33. package/src/components/Fields/Wysiwyg/helpers.tsx +2 -0
  34. package/src/components/Fields/Wysiwyg/index.tsx +41 -10
  35. package/src/components/ResizePanel/index.tsx +7 -2
@@ -31,7 +31,11 @@ const data = {
31
31
 
32
32
  mockedAxios.mockResolvedValue(data);
33
33
 
34
- const defaultProps = mock<IImageFieldProps>();
34
+ // Props por test. Antes era un `mock<IImageFieldProps>()` compartido sin nada
35
+ // puesto: el primer test renderizaba con el proxy virgen (el spread de JSX no
36
+ // pasa ninguna prop hasta que alguien las toca) y los demás se lo iban llenando.
37
+ const makeProps = (overrides: Partial<IImageFieldProps> = {}): IImageFieldProps =>
38
+ Object.assign(mock<IImageFieldProps>(), overrides);
35
39
 
36
40
  const initialStore = {
37
41
  ...defaultStore,
@@ -67,7 +71,7 @@ describe("ImageField component rendering", () => {
67
71
  it("should render the component", () => {
68
72
  render(
69
73
  <ThemeProvider theme={parseTheme(globalTheme)}>
70
- <ImageField {...defaultProps} />
74
+ <ImageField {...makeProps()} />
71
75
  </ThemeProvider>,
72
76
  { store },
73
77
  );
@@ -77,59 +81,59 @@ describe("ImageField component rendering", () => {
77
81
  });
78
82
 
79
83
  it("should render the component with linkableImage", () => {
80
- defaultProps.value = {
81
- id: 857,
82
- name: ".png",
83
- title: "",
84
- description: "",
85
- alt: "",
86
- tags: [],
87
- url: "kjkajsf",
88
- thumb: "jasd",
89
- publicId: "thesaurus",
90
- damId: "screenshot",
91
- published: new Date("2022-04-18T08:52:48.334Z"),
92
- size: 1123589,
93
- width: 1444,
94
- height: 640,
95
- orientation: "L",
96
- site: null,
97
- folderId: null,
98
- };
99
-
100
- defaultProps.selectedContent = {
101
- component: "LinkableImage",
102
- editorID: 7,
103
- parentEditorID: 4,
104
- title: "",
105
- alt: "",
106
- veil: 0,
107
- file: {
108
- id: 1001,
109
- name: "Imagen_Interior_fullstack.png",
84
+ const props = makeProps({
85
+ value: {
86
+ id: 857,
87
+ name: ".png",
110
88
  title: "",
111
89
  description: "",
112
90
  alt: "",
113
91
  tags: [],
114
- url: "https://images.dev.griddo.io/imagen-interior-fullstack",
115
- thumb: "https://images.dev.griddo.io/w/215/h/161/imagen-interior-fullstack",
116
- publicId: "thesaurus-dev/Imagen_Interior_fullstack_6c908d9f-b493-4c93-b4d2-a0439bc00820",
117
- damId: "imagen-interior-fullstack",
118
- published: "2022-06-30T07:06:54.352Z",
119
- size: 55286,
120
- width: 680,
121
- height: 353,
92
+ url: "kjkajsf",
93
+ thumb: "jasd",
94
+ publicId: "thesaurus",
95
+ damId: "screenshot",
96
+ published: new Date("2022-04-18T08:52:48.334Z"),
97
+ size: 1123589,
98
+ width: 1444,
99
+ height: 640,
122
100
  orientation: "L",
123
- site: 113,
101
+ site: null,
124
102
  folderId: null,
125
103
  },
126
- };
127
-
128
- defaultProps.cropPreview = true;
104
+ selectedContent: {
105
+ component: "LinkableImage",
106
+ editorID: 7,
107
+ parentEditorID: 4,
108
+ title: "",
109
+ alt: "",
110
+ veil: 0,
111
+ file: {
112
+ id: 1001,
113
+ name: "Imagen_Interior_fullstack.png",
114
+ title: "",
115
+ description: "",
116
+ alt: "",
117
+ tags: [],
118
+ url: "https://images.dev.griddo.io/imagen-interior-fullstack",
119
+ thumb: "https://images.dev.griddo.io/w/215/h/161/imagen-interior-fullstack",
120
+ publicId: "thesaurus-dev/Imagen_Interior_fullstack_6c908d9f-b493-4c93-b4d2-a0439bc00820",
121
+ damId: "imagen-interior-fullstack",
122
+ published: "2022-06-30T07:06:54.352Z",
123
+ size: 55286,
124
+ width: 680,
125
+ height: 353,
126
+ orientation: "L",
127
+ site: 113,
128
+ folderId: null,
129
+ },
130
+ },
131
+ cropPreview: true,
132
+ });
129
133
 
130
134
  render(
131
135
  <ThemeProvider theme={parseTheme(globalTheme)}>
132
- <ImageField {...defaultProps} />
136
+ <ImageField {...props} />
133
137
  </ThemeProvider>,
134
138
  { store },
135
139
  );
@@ -140,40 +144,41 @@ describe("ImageField component rendering", () => {
140
144
  });
141
145
 
142
146
  it("should render the component with image with no url attr", async () => {
143
- defaultProps.value = "image.png";
144
-
145
- defaultProps.selectedContent = {
146
- component: "LinkableImage",
147
- editorID: 7,
148
- parentEditorID: 4,
149
- title: "",
150
- alt: "",
151
- veil: 0,
152
- file: {
153
- id: 1001,
154
- name: "Imagen_Interior_fullstack.png",
147
+ const props = makeProps({
148
+ value: "image.png",
149
+ selectedContent: {
150
+ component: "LinkableImage",
151
+ editorID: 7,
152
+ parentEditorID: 4,
155
153
  title: "",
156
- description: "",
157
154
  alt: "",
158
- tags: [],
159
- url: "https://images.dev.griddo.io/imagen-interior-fullstack",
160
- thumb: "https://images.dev.griddo.io/w/215/h/161/imagen-interior-fullstack",
161
- publicId: "thesaurus-dev/Imagen_Interior_fullstack_6c908d9f-b493-4c93-b4d2-a0439bc00820",
162
- damId: "imagen-interior-fullstack",
163
- published: "2022-06-30T07:06:54.352Z",
164
- size: 55286,
165
- width: 680,
166
- height: 353,
167
- orientation: "L",
168
- site: 113,
169
- folderId: null,
155
+ veil: 0,
156
+ file: {
157
+ id: 1001,
158
+ name: "Imagen_Interior_fullstack.png",
159
+ title: "",
160
+ description: "",
161
+ alt: "",
162
+ tags: [],
163
+ url: "https://images.dev.griddo.io/imagen-interior-fullstack",
164
+ thumb: "https://images.dev.griddo.io/w/215/h/161/imagen-interior-fullstack",
165
+ publicId: "thesaurus-dev/Imagen_Interior_fullstack_6c908d9f-b493-4c93-b4d2-a0439bc00820",
166
+ damId: "imagen-interior-fullstack",
167
+ published: "2022-06-30T07:06:54.352Z",
168
+ size: 55286,
169
+ width: 680,
170
+ height: 353,
171
+ orientation: "L",
172
+ site: 113,
173
+ folderId: null,
174
+ },
170
175
  },
171
- };
176
+ });
172
177
 
173
178
  await act(async () =>
174
179
  render(
175
180
  <ThemeProvider theme={parseTheme(globalTheme)}>
176
- <ImageField {...defaultProps} />
181
+ <ImageField {...props} />
177
182
  </ThemeProvider>,
178
183
  { store },
179
184
  ),
@@ -185,40 +190,41 @@ describe("ImageField component rendering", () => {
185
190
  });
186
191
 
187
192
  it("should render the component with no image", async () => {
188
- defaultProps.value = null;
189
-
190
- defaultProps.selectedContent = {
191
- component: "LinkableImage",
192
- editorID: 7,
193
- parentEditorID: 4,
194
- title: "",
195
- alt: "",
196
- veil: 0,
197
- file: {
198
- id: 1001,
199
- name: "Imagen_Interior_fullstack.png",
193
+ const props = makeProps({
194
+ value: null,
195
+ selectedContent: {
196
+ component: "LinkableImage",
197
+ editorID: 7,
198
+ parentEditorID: 4,
200
199
  title: "",
201
- description: "",
202
200
  alt: "",
203
- tags: [],
204
- url: "https://images.dev.griddo.io/imagen-interior-fullstack",
205
- thumb: "https://images.dev.griddo.io/w/215/h/161/imagen-interior-fullstack",
206
- publicId: "thesaurus-dev/Imagen_Interior_fullstack_6c908d9f-b493-4c93-b4d2-a0439bc00820",
207
- damId: "imagen-interior-fullstack",
208
- published: "2022-06-30T07:06:54.352Z",
209
- size: 55286,
210
- width: 680,
211
- height: 353,
212
- orientation: "L",
213
- site: 113,
214
- folderId: null,
201
+ veil: 0,
202
+ file: {
203
+ id: 1001,
204
+ name: "Imagen_Interior_fullstack.png",
205
+ title: "",
206
+ description: "",
207
+ alt: "",
208
+ tags: [],
209
+ url: "https://images.dev.griddo.io/imagen-interior-fullstack",
210
+ thumb: "https://images.dev.griddo.io/w/215/h/161/imagen-interior-fullstack",
211
+ publicId: "thesaurus-dev/Imagen_Interior_fullstack_6c908d9f-b493-4c93-b4d2-a0439bc00820",
212
+ damId: "imagen-interior-fullstack",
213
+ published: "2022-06-30T07:06:54.352Z",
214
+ size: 55286,
215
+ width: 680,
216
+ height: 353,
217
+ orientation: "L",
218
+ site: 113,
219
+ folderId: null,
220
+ },
215
221
  },
216
- };
222
+ });
217
223
 
218
224
  await act(async () =>
219
225
  render(
220
226
  <ThemeProvider theme={parseTheme(globalTheme)}>
221
- <ImageField {...defaultProps} />
227
+ <ImageField {...props} />
222
228
  </ThemeProvider>,
223
229
  { store },
224
230
  ),
@@ -230,42 +236,44 @@ describe("ImageField component rendering", () => {
230
236
  });
231
237
 
232
238
  it("should render the component with image with undefined", async () => {
233
- // biome-ignore lint/suspicious/noTsIgnore: TODO: fix this
234
- // @ts-ignore
235
- defaultProps.value = undefined;
236
-
237
- defaultProps.selectedContent = {
238
- component: "LinkableImage",
239
- editorID: 7,
240
- parentEditorID: 4,
241
- title: "",
242
- alt: "",
243
- veil: 0,
244
- file: {
245
- id: 1001,
246
- name: "Imagen_Interior_fullstack.png",
239
+ const props = makeProps({
240
+ value: undefined,
241
+ selectedContent: {
242
+ component: "LinkableImage",
243
+ editorID: 7,
244
+ parentEditorID: 4,
247
245
  title: "",
248
- description: "",
249
246
  alt: "",
250
- tags: [],
251
- url: "https://images.dev.griddo.io/imagen-interior-fullstack",
252
- thumb: "https://images.dev.griddo.io/w/215/h/161/imagen-interior-fullstack",
253
- publicId: "thesaurus-dev/Imagen_Interior_fullstack_6c908d9f-b493-4c93-b4d2-a0439bc00820",
254
- damId: "imagen-interior-fullstack",
255
- published: "2022-06-30T07:06:54.352Z",
256
- size: 55286,
257
- width: 680,
258
- height: 353,
259
- orientation: "L",
260
- site: 113,
261
- folderId: null,
247
+ veil: 0,
248
+ file: {
249
+ id: 1001,
250
+ name: "Imagen_Interior_fullstack.png",
251
+ title: "",
252
+ description: "",
253
+ alt: "",
254
+ tags: [],
255
+ url: "https://images.dev.griddo.io/imagen-interior-fullstack",
256
+ thumb: "https://images.dev.griddo.io/w/215/h/161/imagen-interior-fullstack",
257
+ publicId: "thesaurus-dev/Imagen_Interior_fullstack_6c908d9f-b493-4c93-b4d2-a0439bc00820",
258
+ damId: "imagen-interior-fullstack",
259
+ published: "2022-06-30T07:06:54.352Z",
260
+ size: 55286,
261
+ width: 680,
262
+ height: 353,
263
+ orientation: "L",
264
+ site: 113,
265
+ folderId: null,
266
+ },
262
267
  },
263
- };
268
+ });
269
+
270
+ // biome-ignore lint/suspicious/noTsIgnore: TODO: fix this
271
+ // @ts-ignore
264
272
 
265
273
  await act(async () =>
266
274
  render(
267
275
  <ThemeProvider theme={parseTheme(globalTheme)}>
268
- <ImageField {...defaultProps} />
276
+ <ImageField {...props} />
269
277
  </ThemeProvider>,
270
278
  { store },
271
279
  ),
@@ -279,59 +287,61 @@ describe("ImageField component rendering", () => {
279
287
 
280
288
  describe("ImageField triggers", () => {
281
289
  it("should handle the onClick", async () => {
282
- defaultProps.value = {
283
- id: 857,
284
- name: ".png",
285
- title: "",
286
- description: "",
287
- alt: "",
288
- tags: [],
289
- url: "https://images.dev.griddo.io/screenshot-2022-04-13-at-164915",
290
- thumb: "https://images.dev.griddo.io/w/215/h/161/screenshot-2022-04-13-at-164915",
291
- publicId: "thesaurus-dev/Screenshot_2022-04-13_at_16.49.15_927293bf-d163-402f-b216-4dc8656ea8c1",
292
- damId: "screenshot-2022-04-13-at-164915",
293
- published: new Date("2022-04-18T08:52:48.334Z"),
294
- size: 1123589,
295
- width: 1444,
296
- height: 640,
297
- orientation: "L",
298
- site: null,
299
- folderId: null,
300
- };
301
-
302
- defaultProps.selectedContent = {
303
- component: "LinkableImage",
304
- editorID: 7,
305
- parentEditorID: 4,
306
- title: "",
307
- alt: "",
308
- veil: 0,
309
- file: {
310
- id: 1001,
311
- name: "Imagen_Interior_fullstack.png",
290
+ const setIsGalleryMock = vi.fn();
291
+ const props = makeProps({
292
+ setIsGalleryOpened: setIsGalleryMock,
293
+ value: {
294
+ id: 857,
295
+ name: ".png",
312
296
  title: "",
313
297
  description: "",
314
298
  alt: "",
315
299
  tags: [],
316
- url: "https://images.dev.griddo.io/imagen-interior-fullstack",
317
- thumb: "https://images.dev.griddo.io/w/215/h/161/imagen-interior-fullstack",
318
- publicId: "thesaurus-dev/Imagen_Interior_fullstack_6c908d9f-b493-4c93-b4d2-a0439bc00820",
319
- damId: "imagen-interior-fullstack",
320
- published: "2022-06-30T07:06:54.352Z",
321
- size: 55286,
322
- width: 680,
323
- height: 353,
300
+ url: "https://images.dev.griddo.io/screenshot-2022-04-13-at-164915",
301
+ thumb: "https://images.dev.griddo.io/w/215/h/161/screenshot-2022-04-13-at-164915",
302
+ publicId: "thesaurus-dev/Screenshot_2022-04-13_at_16.49.15_927293bf-d163-402f-b216-4dc8656ea8c1",
303
+ damId: "screenshot-2022-04-13-at-164915",
304
+ published: new Date("2022-04-18T08:52:48.334Z"),
305
+ size: 1123589,
306
+ width: 1444,
307
+ height: 640,
324
308
  orientation: "L",
325
- site: 113,
309
+ site: null,
326
310
  folderId: null,
327
311
  },
328
- };
329
- const setIsGalleryMock = defaultProps.setIsGalleryOpened as MockedFunction<() => void>;
330
- defaultProps.disabled = false;
312
+ selectedContent: {
313
+ component: "LinkableImage",
314
+ editorID: 7,
315
+ parentEditorID: 4,
316
+ title: "",
317
+ alt: "",
318
+ veil: 0,
319
+ file: {
320
+ id: 1001,
321
+ name: "Imagen_Interior_fullstack.png",
322
+ title: "",
323
+ description: "",
324
+ alt: "",
325
+ tags: [],
326
+ url: "https://images.dev.griddo.io/imagen-interior-fullstack",
327
+ thumb: "https://images.dev.griddo.io/w/215/h/161/imagen-interior-fullstack",
328
+ publicId: "thesaurus-dev/Imagen_Interior_fullstack_6c908d9f-b493-4c93-b4d2-a0439bc00820",
329
+ damId: "imagen-interior-fullstack",
330
+ published: "2022-06-30T07:06:54.352Z",
331
+ size: 55286,
332
+ width: 680,
333
+ height: 353,
334
+ orientation: "L",
335
+ site: 113,
336
+ folderId: null,
337
+ },
338
+ },
339
+ disabled: false,
340
+ });
331
341
 
332
342
  render(
333
343
  <ThemeProvider theme={parseTheme(globalTheme)}>
334
- <ImageField {...defaultProps} />
344
+ <ImageField {...props} />
335
345
  </ThemeProvider>,
336
346
  { store },
337
347
  );
@@ -345,58 +355,61 @@ describe("ImageField triggers", () => {
345
355
  });
346
356
 
347
357
  it("should handle the delete action", () => {
348
- defaultProps.value = {
349
- id: 857,
350
- name: ".png",
351
- title: "",
352
- description: "",
353
- alt: "",
354
- tags: [],
355
- url: "https://images.dev.griddo.io/screenshot-2022-04-13-at-164915",
356
- thumb: "https://images.dev.griddo.io/w/215/h/161/screenshot-2022-04-13-at-164915",
357
- publicId: "thesaurus-dev/Screenshot_2022-04-13_at_16.49.15_927293bf-d163-402f-b216-4dc8656ea8c1",
358
- damId: "screenshot-2022-04-13-at-164915",
359
- published: new Date("2022-04-18T08:52:48.334Z"),
360
- size: 1123589,
361
- width: 1444,
362
- height: 640,
363
- orientation: "L",
364
- site: null,
365
- folderId: null,
366
- };
367
-
368
- defaultProps.selectedContent = {
369
- component: "LinkableImage",
370
- editorID: 7,
371
- parentEditorID: 4,
372
- title: "",
373
- alt: "",
374
- veil: 0,
375
- file: {
376
- id: 1001,
377
- name: "Imagen_Interior_fullstack.png",
358
+ const onChangeMock = vi.fn();
359
+ const props = makeProps({
360
+ onChange: onChangeMock,
361
+ value: {
362
+ id: 857,
363
+ name: ".png",
378
364
  title: "",
379
365
  description: "",
380
366
  alt: "",
381
367
  tags: [],
382
- url: "https://images.dev.griddo.io/imagen-interior-fullstack",
383
- thumb: "https://images.dev.griddo.io/w/215/h/161/imagen-interior-fullstack",
384
- publicId: "thesaurus-dev/Imagen_Interior_fullstack_6c908d9f-b493-4c93-b4d2-a0439bc00820",
385
- damId: "imagen-interior-fullstack",
386
- published: "2022-06-30T07:06:54.352Z",
387
- size: 55286,
388
- width: 680,
389
- height: 353,
368
+ url: "https://images.dev.griddo.io/screenshot-2022-04-13-at-164915",
369
+ thumb: "https://images.dev.griddo.io/w/215/h/161/screenshot-2022-04-13-at-164915",
370
+ publicId: "thesaurus-dev/Screenshot_2022-04-13_at_16.49.15_927293bf-d163-402f-b216-4dc8656ea8c1",
371
+ damId: "screenshot-2022-04-13-at-164915",
372
+ published: new Date("2022-04-18T08:52:48.334Z"),
373
+ size: 1123589,
374
+ width: 1444,
375
+ height: 640,
390
376
  orientation: "L",
391
- site: 113,
377
+ site: null,
392
378
  folderId: null,
393
379
  },
394
- };
395
- const onChangeMock = defaultProps.onChange as MockedFunction<(value: any) => void>;
396
- defaultProps.disabled = false;
380
+ selectedContent: {
381
+ component: "LinkableImage",
382
+ editorID: 7,
383
+ parentEditorID: 4,
384
+ title: "",
385
+ alt: "",
386
+ veil: 0,
387
+ file: {
388
+ id: 1001,
389
+ name: "Imagen_Interior_fullstack.png",
390
+ title: "",
391
+ description: "",
392
+ alt: "",
393
+ tags: [],
394
+ url: "https://images.dev.griddo.io/imagen-interior-fullstack",
395
+ thumb: "https://images.dev.griddo.io/w/215/h/161/imagen-interior-fullstack",
396
+ publicId: "thesaurus-dev/Imagen_Interior_fullstack_6c908d9f-b493-4c93-b4d2-a0439bc00820",
397
+ damId: "imagen-interior-fullstack",
398
+ published: "2022-06-30T07:06:54.352Z",
399
+ size: 55286,
400
+ width: 680,
401
+ height: 353,
402
+ orientation: "L",
403
+ site: 113,
404
+ folderId: null,
405
+ },
406
+ },
407
+ disabled: false,
408
+ });
409
+
397
410
  const { rerender } = render(
398
411
  <ThemeProvider theme={parseTheme(globalTheme)}>
399
- <ImageField {...defaultProps} />
412
+ <ImageField {...props} />
400
413
  </ThemeProvider>,
401
414
  { store },
402
415
  );
@@ -409,7 +422,7 @@ describe("ImageField triggers", () => {
409
422
 
410
423
  rerender(
411
424
  <ThemeProvider theme={parseTheme(globalTheme)}>
412
- <ImageField {...defaultProps} />
425
+ <ImageField {...props} />
413
426
  </ThemeProvider>,
414
427
  );
415
428
  const fieldWrapperAction = screen.getByTestId("fieldWrapper");
@@ -419,58 +432,61 @@ describe("ImageField triggers", () => {
419
432
  });
420
433
 
421
434
  it("should handle the change action", async () => {
422
- defaultProps.value = {
423
- id: 857,
424
- name: ".png",
425
- title: "",
426
- description: "",
427
- alt: "",
428
- tags: [],
429
- url: "https://images.dev.griddo.io/screenshot-2022-04-13-at-164915",
430
- thumb: "https://images.dev.griddo.io/w/215/h/161/screenshot-2022-04-13-at-164915",
431
- publicId: "thesaurus-dev/Screenshot_2022-04-13_at_16.49.15_927293bf-d163-402f-b216-4dc8656ea8c1",
432
- damId: "screenshot-2022-04-13-at-164915",
433
- published: new Date("2022-04-18T08:52:48.334Z"),
434
- size: 1123589,
435
- width: 1444,
436
- height: 640,
437
- orientation: "L",
438
- site: null,
439
- folderId: null,
440
- };
441
-
442
- defaultProps.selectedContent = {
443
- component: "LinkableImage",
444
- editorID: 7,
445
- parentEditorID: 4,
446
- title: "",
447
- alt: "",
448
- veil: 0,
449
- file: {
450
- id: 1001,
451
- name: "Imagen_Interior_fullstack.png",
435
+ const setIsGalleryMock = vi.fn();
436
+ const props = makeProps({
437
+ setIsGalleryOpened: setIsGalleryMock,
438
+ value: {
439
+ id: 857,
440
+ name: ".png",
452
441
  title: "",
453
442
  description: "",
454
443
  alt: "",
455
444
  tags: [],
456
- url: "https://images.dev.griddo.io/imagen-interior-fullstack",
457
- thumb: "https://images.dev.griddo.io/w/215/h/161/imagen-interior-fullstack",
458
- publicId: "thesaurus-dev/Imagen_Interior_fullstack_6c908d9f-b493-4c93-b4d2-a0439bc00820",
459
- damId: "imagen-interior-fullstack",
460
- published: "2022-06-30T07:06:54.352Z",
461
- size: 55286,
462
- width: 680,
463
- height: 353,
445
+ url: "https://images.dev.griddo.io/screenshot-2022-04-13-at-164915",
446
+ thumb: "https://images.dev.griddo.io/w/215/h/161/screenshot-2022-04-13-at-164915",
447
+ publicId: "thesaurus-dev/Screenshot_2022-04-13_at_16.49.15_927293bf-d163-402f-b216-4dc8656ea8c1",
448
+ damId: "screenshot-2022-04-13-at-164915",
449
+ published: new Date("2022-04-18T08:52:48.334Z"),
450
+ size: 1123589,
451
+ width: 1444,
452
+ height: 640,
464
453
  orientation: "L",
465
- site: 113,
454
+ site: null,
466
455
  folderId: null,
467
456
  },
468
- };
469
- const setIsGalleryMock = defaultProps.setIsGalleryOpened as MockedFunction<() => void>;
470
- defaultProps.disabled = false;
457
+ selectedContent: {
458
+ component: "LinkableImage",
459
+ editorID: 7,
460
+ parentEditorID: 4,
461
+ title: "",
462
+ alt: "",
463
+ veil: 0,
464
+ file: {
465
+ id: 1001,
466
+ name: "Imagen_Interior_fullstack.png",
467
+ title: "",
468
+ description: "",
469
+ alt: "",
470
+ tags: [],
471
+ url: "https://images.dev.griddo.io/imagen-interior-fullstack",
472
+ thumb: "https://images.dev.griddo.io/w/215/h/161/imagen-interior-fullstack",
473
+ publicId: "thesaurus-dev/Imagen_Interior_fullstack_6c908d9f-b493-4c93-b4d2-a0439bc00820",
474
+ damId: "imagen-interior-fullstack",
475
+ published: "2022-06-30T07:06:54.352Z",
476
+ size: 55286,
477
+ width: 680,
478
+ height: 353,
479
+ orientation: "L",
480
+ site: 113,
481
+ folderId: null,
482
+ },
483
+ },
484
+ disabled: false,
485
+ });
486
+
471
487
  const { rerender } = render(
472
488
  <ThemeProvider theme={parseTheme(globalTheme)}>
473
- <ImageField {...defaultProps} />
489
+ <ImageField {...props} />
474
490
  </ThemeProvider>,
475
491
  { store },
476
492
  );
@@ -483,7 +499,7 @@ describe("ImageField triggers", () => {
483
499
 
484
500
  rerender(
485
501
  <ThemeProvider theme={parseTheme(globalTheme)}>
486
- <ImageField {...defaultProps} />
502
+ <ImageField {...props} />
487
503
  </ThemeProvider>,
488
504
  );
489
505