@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.
- package/config/webpack.config.js +5 -0
- package/package.json +2 -2
- package/src/__tests__/components/ConfigPanel/Form/Form.test.tsx +47 -57
- package/src/__tests__/components/ConfigPanel/Header/Header.test.tsx +46 -42
- package/src/__tests__/components/ElementsTooltip/ElementsTooltip.test.tsx +6 -17
- package/src/__tests__/components/EmptyState/EmptyState.test.tsx +9 -9
- package/src/__tests__/components/Fields/AsyncSelect/AsyncSelect.test.tsx +60 -50
- package/src/__tests__/components/Fields/ColorPicker/ColorPicker.test.tsx +66 -58
- package/src/__tests__/components/Fields/ComponentContainer/ComponentContainer.test.tsx +222 -425
- package/src/__tests__/components/Fields/FileField/FileField.test.tsx +13 -14
- package/src/__tests__/components/Fields/ImageField/ImageField.test.tsx +275 -259
- package/src/__tests__/components/Fields/IntegrationsField/IntegrationsField.test.tsx +50 -48
- package/src/__tests__/components/Fields/NoteField/NoteField.test.tsx +9 -8
- package/src/__tests__/components/Fields/NumberField/NumberField.test.tsx +8 -12
- package/src/__tests__/components/Fields/TextArea/TextArea.test.tsx +6 -2
- package/src/__tests__/components/Fields/ToggleField/ToggleField.test.tsx +15 -23
- package/src/__tests__/components/Fields/Tooltip/Tooltip.test.tsx +8 -2
- package/src/__tests__/components/Fields/VisualUniqueSelection/VisualUniqueSelection.test.tsx +29 -21
- package/src/__tests__/components/Fields/Wysiwyg/Wysiwyg.config.test.tsx +103 -0
- package/src/__tests__/components/FieldsBehavior/FieldsBehavior.test.tsx +7 -2
- package/src/__tests__/components/ResizePanel/ResizePanel.test.tsx +8 -6
- package/src/__tests__/components/SideModal/SideModal.test.tsx +150 -104
- package/src/__tests__/components/TableFilters/LiveFilter/LiveFilter.test.tsx +15 -29
- package/src/__tests__/components/TableFilters/StatusFilter/StatusFilter.test.tsx +61 -36
- package/src/__tests__/components/Tabs/Tabs.test.tsx +65 -61
- package/src/__tests__/components/Toast/Toast.test.tsx +19 -21
- package/src/__tests__/modules/FramePreview/FramePreview.test.tsx +16 -0
- package/src/__tests__/modules/Sites/SitesList/ListView/BulkHeader/BulkHeader.test.tsx +24 -19
- package/src/__tests__/modules/Sites/SitesList/SitesList.test.tsx +15 -6
- package/src/__tests__/modules/Users/Roles/BulkHeader/BulkHeader.test.tsx +69 -64
- package/src/__tests__/modules/Users/Roles/Roles.test.tsx +7 -4
- package/src/components/Fields/Wysiwyg/config.tsx +68 -17
- package/src/components/Fields/Wysiwyg/helpers.tsx +2 -0
- package/src/components/Fields/Wysiwyg/index.tsx +41 -10
- package/src/components/ResizePanel/index.tsx +7 -2
|
@@ -10,299 +10,250 @@ import globalTheme from "@ax/themes/theme.json";
|
|
|
10
10
|
import ComponentContainer, { IComponentContainerProps } from "@ax/components/Fields/ComponentContainer";
|
|
11
11
|
|
|
12
12
|
afterEach(cleanup);
|
|
13
|
-
const defaultProps = mock<IComponentContainerProps>();
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
// Cada test construye sus propios props. Antes había un único `mock<...>()` a
|
|
15
|
+
// nivel de módulo que los tests iban mutando, así que cada uno heredaba lo que
|
|
16
|
+
// hubieran dejado los anteriores: reordenarlos o lanzar uno suelto los rompía.
|
|
17
|
+
const makeProps = (overrides: Partial<IComponentContainerProps> = {}): IComponentContainerProps =>
|
|
18
|
+
Object.assign(mock<IComponentContainerProps>(), overrides);
|
|
19
|
+
|
|
20
|
+
const makeActions = (): IComponentContainerProps["actions"] => ({
|
|
21
|
+
addComponentAction: vi.fn(),
|
|
22
|
+
deleteModuleAction: vi.fn(),
|
|
23
|
+
duplicateModuleAction: vi.fn(),
|
|
24
|
+
copyModuleAction: vi.fn(),
|
|
25
|
+
replaceModuleAction: vi.fn(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const renderContainer = (props: IComponentContainerProps) =>
|
|
29
|
+
render(
|
|
30
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
31
|
+
<ComponentContainer {...props} />
|
|
32
|
+
</ThemeProvider>,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const linkValue = {
|
|
36
|
+
component: "Link",
|
|
37
|
+
text: "Link 1",
|
|
38
|
+
style: "primary",
|
|
39
|
+
url: {
|
|
40
|
+
url: "",
|
|
41
|
+
linkTo: null,
|
|
42
|
+
newTab: false,
|
|
43
|
+
noFollow: false,
|
|
44
|
+
size: null,
|
|
45
|
+
icon: null,
|
|
46
|
+
linkContainer: null,
|
|
47
|
+
},
|
|
48
|
+
editorID: 5,
|
|
49
|
+
parentEditorID: 4,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const basicContent = {
|
|
53
|
+
component: "BasicContent",
|
|
54
|
+
title: {
|
|
55
|
+
content: "Title",
|
|
56
|
+
tag: "h1",
|
|
57
|
+
},
|
|
58
|
+
anchorID: null,
|
|
59
|
+
verticalSpacing: "medium",
|
|
60
|
+
layout: "L001",
|
|
61
|
+
theme: "default",
|
|
62
|
+
moduleOrder: null,
|
|
63
|
+
subtitle:
|
|
64
|
+
"Lorem ipsum dolor sit amet, consectetur adipiscsdcdscing elit. Morbi dignissim ut nibh eget porttitor. Nunc eleifend mollis arcu.sdcsdc",
|
|
65
|
+
content:
|
|
66
|
+
"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi dignissim ut nibh eget porttitor. Nunc eleifend mollis arcu. Lorem ipsum d</p>",
|
|
67
|
+
primaryLink: linkValue,
|
|
68
|
+
secondaryLink: {
|
|
69
|
+
component: "Link",
|
|
70
|
+
editorID: 6,
|
|
71
|
+
parentEditorID: 4,
|
|
72
|
+
},
|
|
73
|
+
additionalContent: {
|
|
74
|
+
image: {
|
|
75
|
+
component: "LinkableImage",
|
|
76
|
+
editorID: 7,
|
|
77
|
+
parentEditorID: 4,
|
|
78
|
+
},
|
|
79
|
+
video: {
|
|
80
|
+
component: "Video",
|
|
81
|
+
editorID: 8,
|
|
82
|
+
parentEditorID: 4,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
editorID: 4,
|
|
86
|
+
parentEditorID: 3,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const sectionContent = {
|
|
90
|
+
component: "Section",
|
|
91
|
+
name: "Main Content",
|
|
92
|
+
modules: [basicContent],
|
|
93
|
+
sectionPosition: 2,
|
|
94
|
+
editorID: 3,
|
|
95
|
+
parentEditorID: 1,
|
|
96
|
+
key: "mainContent",
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const imageVideoValue = {
|
|
100
|
+
image: { component: "LinkableImage", editorID: 2, parentEditorID: 1 },
|
|
101
|
+
video: { component: "Video", editorID: 3, parentEditorID: 1 },
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const imageVideoWithThumbnail = {
|
|
105
|
+
image: { component: "LinkableImage", editorID: 2, parentEditorID: 1 },
|
|
106
|
+
video: {
|
|
107
|
+
component: "Video",
|
|
108
|
+
editorID: 3,
|
|
109
|
+
parentEditorID: 1,
|
|
110
|
+
thumbnail: { component: "Image", editorID: 4, parentEditorID: 3 },
|
|
111
|
+
url: "",
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// Los cinco últimos tests comparten escenario y solo se diferencian en el
|
|
116
|
+
// tamaño del array y en si el contenedor es un array.
|
|
117
|
+
const floatingMenuProps = (overrides: Partial<IComponentContainerProps> = {}): IComponentContainerProps =>
|
|
118
|
+
makeProps({
|
|
119
|
+
title: "a title",
|
|
120
|
+
text: "texto a mostrar",
|
|
121
|
+
moduleTitle: "module title",
|
|
122
|
+
whiteList: ["LinkImage", "Video"],
|
|
123
|
+
isArray: false,
|
|
124
|
+
arrayLength: 2,
|
|
125
|
+
theme: "griddo-alt-theme",
|
|
126
|
+
editorID: 1,
|
|
127
|
+
disabled: false,
|
|
128
|
+
value: imageVideoWithThumbnail,
|
|
129
|
+
actionReplace: vi.fn(),
|
|
130
|
+
actions: makeActions(),
|
|
131
|
+
canDuplicate: true,
|
|
132
|
+
canReplace: true,
|
|
133
|
+
parentKey: "title",
|
|
134
|
+
objKey: "component",
|
|
135
|
+
selectedContent: basicContent,
|
|
136
|
+
...overrides,
|
|
18
137
|
});
|
|
138
|
+
|
|
139
|
+
describe("ComponentContainer component rendering", () => {
|
|
19
140
|
test("should render the ComponentContainer", () => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
</ThemeProvider>,
|
|
141
|
+
renderContainer(
|
|
142
|
+
makeProps({
|
|
143
|
+
text: "texto",
|
|
144
|
+
editorID: 1,
|
|
145
|
+
whiteList: ["BasicContent", "CardCollection"],
|
|
146
|
+
arrayLength: 10,
|
|
147
|
+
theme: "default",
|
|
148
|
+
isArray: true,
|
|
149
|
+
disabled: false,
|
|
150
|
+
}),
|
|
31
151
|
);
|
|
32
152
|
|
|
33
153
|
expect(screen.getAllByTestId("component-container")).toBeTruthy();
|
|
34
154
|
});
|
|
155
|
+
|
|
35
156
|
test("should render the EmptyContainer with whitelist value", () => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
replaceModuleAction: vi.fn(),
|
|
54
|
-
};
|
|
55
|
-
defaultProps.canDuplicate = true;
|
|
56
|
-
defaultProps.canReplace = true;
|
|
57
|
-
defaultProps.objKey = "component";
|
|
58
|
-
defaultProps.selectedContent = {
|
|
59
|
-
component: "Section",
|
|
60
|
-
name: "Main Content",
|
|
61
|
-
modules: [
|
|
62
|
-
{
|
|
63
|
-
component: "BasicContent",
|
|
64
|
-
title: {
|
|
65
|
-
content: "Title",
|
|
66
|
-
tag: "h1",
|
|
67
|
-
},
|
|
68
|
-
anchorID: null,
|
|
69
|
-
verticalSpacing: "medium",
|
|
70
|
-
layout: "L001",
|
|
71
|
-
theme: "default",
|
|
72
|
-
moduleOrder: null,
|
|
73
|
-
subtitle:
|
|
74
|
-
"Lorem ipsum dolor sit amet, consectetur adipiscsdcdscing elit. Morbi dignissim ut nibh eget porttitor. Nunc eleifend mollis arcu.sdcsdc",
|
|
75
|
-
content:
|
|
76
|
-
"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi dignissim ut nibh eget porttitor. Nunc eleifend mollis arcu. Lorem ipsum d</p>",
|
|
77
|
-
primaryLink: {
|
|
78
|
-
component: "Link",
|
|
79
|
-
text: "Link 1",
|
|
80
|
-
style: "primary",
|
|
81
|
-
url: {
|
|
82
|
-
url: "",
|
|
83
|
-
linkTo: null,
|
|
84
|
-
newTab: false,
|
|
85
|
-
noFollow: false,
|
|
86
|
-
size: null,
|
|
87
|
-
icon: null,
|
|
88
|
-
linkContainer: null,
|
|
89
|
-
},
|
|
90
|
-
editorID: 5,
|
|
91
|
-
parentEditorID: 4,
|
|
92
|
-
},
|
|
93
|
-
secondaryLink: {
|
|
94
|
-
component: "Link",
|
|
95
|
-
editorID: 6,
|
|
96
|
-
parentEditorID: 4,
|
|
97
|
-
},
|
|
98
|
-
additionalContent: {
|
|
99
|
-
image: {
|
|
100
|
-
component: "LinkableImage",
|
|
101
|
-
editorID: 7,
|
|
102
|
-
parentEditorID: 4,
|
|
103
|
-
},
|
|
104
|
-
video: {
|
|
105
|
-
component: "Video",
|
|
106
|
-
editorID: 8,
|
|
107
|
-
parentEditorID: 4,
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
editorID: 4,
|
|
111
|
-
parentEditorID: 3,
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
sectionPosition: 2,
|
|
115
|
-
editorID: 3,
|
|
116
|
-
parentEditorID: 1,
|
|
117
|
-
key: "mainContent",
|
|
118
|
-
};
|
|
119
|
-
render(
|
|
120
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
121
|
-
<ComponentContainer {...defaultProps} />
|
|
122
|
-
</ThemeProvider>,
|
|
157
|
+
renderContainer(
|
|
158
|
+
makeProps({
|
|
159
|
+
text: undefined,
|
|
160
|
+
editorID: undefined,
|
|
161
|
+
whiteList: ["BasicContent", "CardCollection"],
|
|
162
|
+
isArray: false,
|
|
163
|
+
arrayLength: 10,
|
|
164
|
+
theme: "default",
|
|
165
|
+
disabled: false,
|
|
166
|
+
value: {},
|
|
167
|
+
actionReplace: vi.fn(),
|
|
168
|
+
actions: makeActions(),
|
|
169
|
+
canDuplicate: true,
|
|
170
|
+
canReplace: true,
|
|
171
|
+
objKey: "component",
|
|
172
|
+
selectedContent: sectionContent,
|
|
173
|
+
}),
|
|
123
174
|
);
|
|
175
|
+
|
|
124
176
|
expect(screen.getAllByTestId("field-multiple-options")).toBeTruthy();
|
|
125
177
|
});
|
|
178
|
+
|
|
126
179
|
test("should render the EmptyContainer with title", () => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
146
|
-
<ComponentContainer {...defaultProps} />
|
|
147
|
-
</ThemeProvider>,
|
|
180
|
+
renderContainer(
|
|
181
|
+
makeProps({
|
|
182
|
+
title: "a title",
|
|
183
|
+
text: undefined,
|
|
184
|
+
editorID: undefined,
|
|
185
|
+
whiteList: ["BasicContent", "CardCollection"],
|
|
186
|
+
isArray: false,
|
|
187
|
+
arrayLength: 10,
|
|
188
|
+
theme: "default",
|
|
189
|
+
disabled: false,
|
|
190
|
+
value: {},
|
|
191
|
+
actionReplace: vi.fn(),
|
|
192
|
+
actions: makeActions(),
|
|
193
|
+
canDuplicate: true,
|
|
194
|
+
canReplace: true,
|
|
195
|
+
objKey: "component",
|
|
196
|
+
selectedContent: sectionContent,
|
|
197
|
+
}),
|
|
148
198
|
);
|
|
199
|
+
|
|
149
200
|
expect(screen.getAllByTestId("field-multiple-options")).toBeTruthy();
|
|
150
201
|
});
|
|
202
|
+
|
|
151
203
|
test("should render the icon with the container text", () => {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
},
|
|
172
|
-
editorID: 5,
|
|
173
|
-
parentEditorID: 4,
|
|
174
|
-
};
|
|
175
|
-
defaultProps.actions = {
|
|
176
|
-
addComponentAction: vi.fn(),
|
|
177
|
-
deleteModuleAction: vi.fn(),
|
|
178
|
-
duplicateModuleAction: vi.fn(),
|
|
179
|
-
copyModuleAction: vi.fn(),
|
|
180
|
-
replaceModuleAction: vi.fn(),
|
|
181
|
-
};
|
|
182
|
-
defaultProps.parentKey = "title";
|
|
183
|
-
defaultProps.objKey = "content";
|
|
184
|
-
defaultProps.selectedContent = {
|
|
185
|
-
component: "BasicContent",
|
|
186
|
-
title: {
|
|
187
|
-
content: "Title",
|
|
188
|
-
tag: "h1",
|
|
189
|
-
},
|
|
190
|
-
anchorID: null,
|
|
191
|
-
verticalSpacing: "medium",
|
|
192
|
-
layout: "L001",
|
|
193
|
-
theme: "default",
|
|
194
|
-
moduleOrder: null,
|
|
195
|
-
subtitle:
|
|
196
|
-
"Lorem ipsum dolor sit amet, consectetur adipiscsdcdscing elit. Morbi dignissim ut nibh eget porttitor. Nunc eleifend mollis arcu.sdcsdc",
|
|
197
|
-
content:
|
|
198
|
-
"<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi dignissim ut nibh eget porttitor. Nunc eleifend mollis arcu. Lorem ipsum d</p>",
|
|
199
|
-
primaryLink: {
|
|
200
|
-
component: "Link",
|
|
201
|
-
text: "Link 1",
|
|
202
|
-
style: "primary",
|
|
203
|
-
url: {
|
|
204
|
-
url: "",
|
|
205
|
-
linkTo: null,
|
|
206
|
-
newTab: false,
|
|
207
|
-
noFollow: false,
|
|
208
|
-
size: null,
|
|
209
|
-
icon: null,
|
|
210
|
-
linkContainer: null,
|
|
211
|
-
},
|
|
212
|
-
editorID: 5,
|
|
213
|
-
parentEditorID: 4,
|
|
214
|
-
},
|
|
215
|
-
secondaryLink: {
|
|
216
|
-
component: "Link",
|
|
217
|
-
editorID: 6,
|
|
218
|
-
parentEditorID: 4,
|
|
219
|
-
},
|
|
220
|
-
additionalContent: {
|
|
221
|
-
image: {
|
|
222
|
-
component: "LinkableImage",
|
|
223
|
-
editorID: 7,
|
|
224
|
-
parentEditorID: 4,
|
|
225
|
-
},
|
|
226
|
-
video: {
|
|
227
|
-
component: "Video",
|
|
228
|
-
editorID: 8,
|
|
229
|
-
parentEditorID: 4,
|
|
230
|
-
},
|
|
231
|
-
},
|
|
232
|
-
editorID: 4,
|
|
233
|
-
parentEditorID: 3,
|
|
234
|
-
};
|
|
235
|
-
render(
|
|
236
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
237
|
-
<ComponentContainer {...defaultProps} />
|
|
238
|
-
</ThemeProvider>,
|
|
204
|
+
renderContainer(
|
|
205
|
+
makeProps({
|
|
206
|
+
title: "a title",
|
|
207
|
+
text: "texto a mostrar",
|
|
208
|
+
editorID: 1,
|
|
209
|
+
whiteList: ["BasicContent", "CardCollection"],
|
|
210
|
+
isArray: false,
|
|
211
|
+
disabled: false,
|
|
212
|
+
arrayLength: 10,
|
|
213
|
+
theme: "default",
|
|
214
|
+
value: linkValue,
|
|
215
|
+
actionReplace: vi.fn(),
|
|
216
|
+
actions: makeActions(),
|
|
217
|
+
canDuplicate: true,
|
|
218
|
+
canReplace: true,
|
|
219
|
+
parentKey: "title",
|
|
220
|
+
objKey: "content",
|
|
221
|
+
selectedContent: basicContent,
|
|
222
|
+
}),
|
|
239
223
|
);
|
|
224
|
+
|
|
240
225
|
expect(screen.getByTestId("icon-wrapper")).toBeTruthy();
|
|
241
226
|
expect(screen.findByText("texto a mostrar")).toBeTruthy();
|
|
242
227
|
});
|
|
243
228
|
|
|
244
229
|
test("should render the title", () => {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
},
|
|
266
|
-
editorID: 5,
|
|
267
|
-
parentEditorID: 4,
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
render(
|
|
271
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
272
|
-
<ComponentContainer {...defaultProps} />
|
|
273
|
-
</ThemeProvider>,
|
|
230
|
+
renderContainer(
|
|
231
|
+
makeProps({
|
|
232
|
+
title: "a title",
|
|
233
|
+
text: "texto a mostrar",
|
|
234
|
+
moduleTitle: "module title",
|
|
235
|
+
editorID: 1,
|
|
236
|
+
whiteList: [],
|
|
237
|
+
isArray: false,
|
|
238
|
+
disabled: false,
|
|
239
|
+
arrayLength: 10,
|
|
240
|
+
theme: "default",
|
|
241
|
+
value: linkValue,
|
|
242
|
+
actionReplace: vi.fn(),
|
|
243
|
+
actions: makeActions(),
|
|
244
|
+
canDuplicate: true,
|
|
245
|
+
canReplace: true,
|
|
246
|
+
parentKey: "title",
|
|
247
|
+
objKey: "content",
|
|
248
|
+
selectedContent: basicContent,
|
|
249
|
+
}),
|
|
274
250
|
);
|
|
251
|
+
|
|
275
252
|
expect(screen.findByText("module title")).toBeTruthy();
|
|
276
253
|
});
|
|
277
254
|
|
|
278
255
|
test("should render the SideModal when click EmptyContainer", () => {
|
|
279
|
-
|
|
280
|
-
defaultProps.whiteList = ["LinkImage", "Video"];
|
|
281
|
-
defaultProps.isArray = false;
|
|
282
|
-
defaultProps.arrayLength = 2;
|
|
283
|
-
defaultProps.theme = "griddo-alt-theme";
|
|
284
|
-
defaultProps.editorID = 1;
|
|
285
|
-
defaultProps.value = {
|
|
286
|
-
image: { component: "LinkableImage", editorID: 2, parentEditorID: 1 },
|
|
287
|
-
video: { component: "Video", editorID: 3, parentEditorID: 1 },
|
|
288
|
-
};
|
|
289
|
-
defaultProps.actionReplace = vi.fn();
|
|
290
|
-
defaultProps.actions = {
|
|
291
|
-
addComponentAction: vi.fn(),
|
|
292
|
-
deleteModuleAction: vi.fn(),
|
|
293
|
-
duplicateModuleAction: vi.fn(),
|
|
294
|
-
copyModuleAction: vi.fn(),
|
|
295
|
-
replaceModuleAction: vi.fn(),
|
|
296
|
-
};
|
|
297
|
-
defaultProps.canDuplicate = true;
|
|
298
|
-
defaultProps.canReplace = true;
|
|
299
|
-
defaultProps.objKey = "component";
|
|
300
|
-
|
|
301
|
-
render(
|
|
302
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
303
|
-
<ComponentContainer {...defaultProps} />
|
|
304
|
-
</ThemeProvider>,
|
|
305
|
-
);
|
|
256
|
+
renderContainer(floatingMenuProps({ value: imageVideoValue }));
|
|
306
257
|
|
|
307
258
|
const multipleOptionsField = screen.getByTestId("field-multiple-options");
|
|
308
259
|
expect(multipleOptionsField).toBeTruthy();
|
|
@@ -312,33 +263,7 @@ describe("ComponentContainer component rendering", () => {
|
|
|
312
263
|
});
|
|
313
264
|
|
|
314
265
|
test("should render component options on SideModal", () => {
|
|
315
|
-
|
|
316
|
-
defaultProps.whiteList = ["LinkImage", "Video"];
|
|
317
|
-
defaultProps.isArray = false;
|
|
318
|
-
defaultProps.arrayLength = 2;
|
|
319
|
-
defaultProps.theme = "griddo-alt-theme";
|
|
320
|
-
defaultProps.editorID = 1;
|
|
321
|
-
defaultProps.value = {
|
|
322
|
-
image: { component: "LinkableImage", editorID: 2, parentEditorID: 1 },
|
|
323
|
-
video: { component: "Video", editorID: 3, parentEditorID: 1 },
|
|
324
|
-
};
|
|
325
|
-
defaultProps.actionReplace = vi.fn();
|
|
326
|
-
defaultProps.actions = {
|
|
327
|
-
addComponentAction: vi.fn(),
|
|
328
|
-
deleteModuleAction: vi.fn(),
|
|
329
|
-
duplicateModuleAction: vi.fn(),
|
|
330
|
-
copyModuleAction: vi.fn(),
|
|
331
|
-
replaceModuleAction: vi.fn(),
|
|
332
|
-
};
|
|
333
|
-
defaultProps.canDuplicate = true;
|
|
334
|
-
defaultProps.canReplace = true;
|
|
335
|
-
defaultProps.objKey = "component";
|
|
336
|
-
|
|
337
|
-
render(
|
|
338
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
339
|
-
<ComponentContainer {...defaultProps} />
|
|
340
|
-
</ThemeProvider>,
|
|
341
|
-
);
|
|
266
|
+
renderContainer(floatingMenuProps({ value: imageVideoValue }));
|
|
342
267
|
|
|
343
268
|
const multipleOptionsField = screen.getByTestId("field-multiple-options");
|
|
344
269
|
expect(multipleOptionsField).toBeTruthy();
|
|
@@ -351,39 +276,7 @@ describe("ComponentContainer component rendering", () => {
|
|
|
351
276
|
});
|
|
352
277
|
|
|
353
278
|
test("should render the FloatingMenu with options when click Component Container", async () => {
|
|
354
|
-
|
|
355
|
-
defaultProps.whiteList = ["LinkImage", "Video"];
|
|
356
|
-
defaultProps.isArray = false;
|
|
357
|
-
defaultProps.arrayLength = 2;
|
|
358
|
-
defaultProps.theme = "griddo-alt-theme";
|
|
359
|
-
defaultProps.editorID = 1;
|
|
360
|
-
defaultProps.value = {
|
|
361
|
-
image: { component: "LinkableImage", editorID: 2, parentEditorID: 1 },
|
|
362
|
-
video: {
|
|
363
|
-
component: "Video",
|
|
364
|
-
editorID: 3,
|
|
365
|
-
parentEditorID: 1,
|
|
366
|
-
thumbnail: { component: "Image", editorID: 4, parentEditorID: 3 },
|
|
367
|
-
url: "",
|
|
368
|
-
},
|
|
369
|
-
};
|
|
370
|
-
defaultProps.actionReplace = vi.fn();
|
|
371
|
-
defaultProps.actions = {
|
|
372
|
-
addComponentAction: vi.fn(),
|
|
373
|
-
deleteModuleAction: vi.fn(),
|
|
374
|
-
duplicateModuleAction: vi.fn(),
|
|
375
|
-
copyModuleAction: vi.fn(),
|
|
376
|
-
replaceModuleAction: vi.fn(),
|
|
377
|
-
};
|
|
378
|
-
defaultProps.canDuplicate = true;
|
|
379
|
-
defaultProps.canReplace = true;
|
|
380
|
-
defaultProps.objKey = "component";
|
|
381
|
-
|
|
382
|
-
render(
|
|
383
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
384
|
-
<ComponentContainer {...defaultProps} />
|
|
385
|
-
</ThemeProvider>,
|
|
386
|
-
);
|
|
279
|
+
renderContainer(floatingMenuProps());
|
|
387
280
|
|
|
388
281
|
const component = screen.getByTestId("component-container");
|
|
389
282
|
fireEvent.mouseOver(component);
|
|
@@ -397,39 +290,7 @@ test("should render the FloatingMenu with options when click Component Container
|
|
|
397
290
|
});
|
|
398
291
|
|
|
399
292
|
test("should render the SideModal with options when click the replace action", async () => {
|
|
400
|
-
|
|
401
|
-
defaultProps.whiteList = ["LinkImage", "Video"];
|
|
402
|
-
defaultProps.isArray = false;
|
|
403
|
-
defaultProps.arrayLength = 2;
|
|
404
|
-
defaultProps.theme = "griddo-alt-theme";
|
|
405
|
-
defaultProps.editorID = 1;
|
|
406
|
-
defaultProps.value = {
|
|
407
|
-
image: { component: "LinkableImage", editorID: 2, parentEditorID: 1 },
|
|
408
|
-
video: {
|
|
409
|
-
component: "Video",
|
|
410
|
-
editorID: 3,
|
|
411
|
-
parentEditorID: 1,
|
|
412
|
-
thumbnail: { component: "Image", editorID: 4, parentEditorID: 3 },
|
|
413
|
-
url: "",
|
|
414
|
-
},
|
|
415
|
-
};
|
|
416
|
-
defaultProps.actionReplace = vi.fn();
|
|
417
|
-
defaultProps.actions = {
|
|
418
|
-
addComponentAction: vi.fn(),
|
|
419
|
-
deleteModuleAction: vi.fn(),
|
|
420
|
-
duplicateModuleAction: vi.fn(),
|
|
421
|
-
copyModuleAction: vi.fn(),
|
|
422
|
-
replaceModuleAction: vi.fn(),
|
|
423
|
-
};
|
|
424
|
-
defaultProps.canDuplicate = true;
|
|
425
|
-
defaultProps.canReplace = true;
|
|
426
|
-
defaultProps.objKey = "component";
|
|
427
|
-
|
|
428
|
-
render(
|
|
429
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
430
|
-
<ComponentContainer {...defaultProps} />
|
|
431
|
-
</ThemeProvider>,
|
|
432
|
-
);
|
|
293
|
+
renderContainer(floatingMenuProps());
|
|
433
294
|
|
|
434
295
|
const component = screen.getByTestId("component-container");
|
|
435
296
|
fireEvent.mouseOver(component);
|
|
@@ -451,78 +312,14 @@ test("should render the SideModal with options when click the replace action", a
|
|
|
451
312
|
});
|
|
452
313
|
|
|
453
314
|
test("should not render the drag handle if arrays length is lower than two", async () => {
|
|
454
|
-
|
|
455
|
-
defaultProps.whiteList = ["LinkImage", "Video"];
|
|
456
|
-
defaultProps.isArray = false;
|
|
457
|
-
defaultProps.arrayLength = 1;
|
|
458
|
-
defaultProps.theme = "griddo-alt-theme";
|
|
459
|
-
defaultProps.editorID = 1;
|
|
460
|
-
defaultProps.value = {
|
|
461
|
-
image: { component: "LinkableImage", editorID: 2, parentEditorID: 1 },
|
|
462
|
-
video: {
|
|
463
|
-
component: "Video",
|
|
464
|
-
editorID: 3,
|
|
465
|
-
parentEditorID: 1,
|
|
466
|
-
thumbnail: { component: "Image", editorID: 4, parentEditorID: 3 },
|
|
467
|
-
url: "",
|
|
468
|
-
},
|
|
469
|
-
};
|
|
470
|
-
defaultProps.actionReplace = vi.fn();
|
|
471
|
-
defaultProps.actions = {
|
|
472
|
-
addComponentAction: vi.fn(),
|
|
473
|
-
deleteModuleAction: vi.fn(),
|
|
474
|
-
duplicateModuleAction: vi.fn(),
|
|
475
|
-
copyModuleAction: vi.fn(),
|
|
476
|
-
replaceModuleAction: vi.fn(),
|
|
477
|
-
};
|
|
478
|
-
defaultProps.canDuplicate = true;
|
|
479
|
-
defaultProps.canReplace = true;
|
|
480
|
-
defaultProps.objKey = "component";
|
|
481
|
-
|
|
482
|
-
render(
|
|
483
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
484
|
-
<ComponentContainer {...defaultProps} />
|
|
485
|
-
</ThemeProvider>,
|
|
486
|
-
);
|
|
315
|
+
renderContainer(floatingMenuProps({ arrayLength: 1 }));
|
|
487
316
|
|
|
488
317
|
const handleWrapper = screen.queryByTestId("handle-wrapper");
|
|
489
318
|
expect(handleWrapper).toBeFalsy();
|
|
490
319
|
});
|
|
491
320
|
|
|
492
321
|
test("should render the drag handle if arrays length is greater than two", async () => {
|
|
493
|
-
|
|
494
|
-
defaultProps.whiteList = ["LinkImage", "Video"];
|
|
495
|
-
defaultProps.isArray = true;
|
|
496
|
-
defaultProps.arrayLength = 3;
|
|
497
|
-
defaultProps.theme = "griddo-alt-theme";
|
|
498
|
-
defaultProps.editorID = 1;
|
|
499
|
-
defaultProps.value = {
|
|
500
|
-
image: { component: "LinkableImage", editorID: 2, parentEditorID: 1 },
|
|
501
|
-
video: {
|
|
502
|
-
component: "Video",
|
|
503
|
-
editorID: 3,
|
|
504
|
-
parentEditorID: 1,
|
|
505
|
-
thumbnail: { component: "Image", editorID: 4, parentEditorID: 3 },
|
|
506
|
-
url: "",
|
|
507
|
-
},
|
|
508
|
-
};
|
|
509
|
-
defaultProps.actionReplace = vi.fn();
|
|
510
|
-
defaultProps.actions = {
|
|
511
|
-
addComponentAction: vi.fn(),
|
|
512
|
-
deleteModuleAction: vi.fn(),
|
|
513
|
-
duplicateModuleAction: vi.fn(),
|
|
514
|
-
copyModuleAction: vi.fn(),
|
|
515
|
-
replaceModuleAction: vi.fn(),
|
|
516
|
-
};
|
|
517
|
-
defaultProps.canDuplicate = true;
|
|
518
|
-
defaultProps.canReplace = true;
|
|
519
|
-
defaultProps.objKey = "component";
|
|
520
|
-
|
|
521
|
-
render(
|
|
522
|
-
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
523
|
-
<ComponentContainer {...defaultProps} />
|
|
524
|
-
</ThemeProvider>,
|
|
525
|
-
);
|
|
322
|
+
renderContainer(floatingMenuProps({ isArray: true, arrayLength: 3 }));
|
|
526
323
|
|
|
527
324
|
const handleWrapper = screen.getByTestId("handle-wrapper");
|
|
528
325
|
expect(handleWrapper).toBeTruthy();
|