@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.
- package/config/jest/componentsMock.js +122 -1
- package/package.json +2 -2
- package/src/__tests__/components/Avatar/__snapshots__/Avatar.test.tsx.snap +10 -10
- package/src/__tests__/components/ConfigPanel/ConfigPanel.test.tsx +252 -0
- package/src/__tests__/components/ConfigPanel/Form/ConnectedField/ConnectedField.test.tsx +177 -0
- package/src/__tests__/components/ConfigPanel/Form/ConnectedField/NavConnectedField/NavConnectedField.test.tsx +161 -0
- package/src/__tests__/components/ConfigPanel/Form/ConnectedField/PageConnectedField/Field/Field.test.tsx +115 -0
- package/src/__tests__/components/ConfigPanel/Form/ConnectedField/PageConnectedField/PageConnectedField.test.tsx +518 -0
- package/src/__tests__/components/ConfigPanel/Form/ConnectedField/PageConnectedField/TemplateManager/TemplateManager.test.tsx +144 -0
- package/src/__tests__/components/ConfigPanel/Form/Form.test.tsx +235 -0
- package/src/__tests__/components/ConfigPanel/GlobalPageForm/GlobalPageForm.test.tsx +196 -0
- package/src/__tests__/components/ConfigPanel/Header/Header.test.tsx +152 -0
- package/src/__tests__/components/ConfigPanel/NavigationForm/Field/Field.test.tsx +106 -0
- package/src/__tests__/components/ConfigPanel/NavigationForm/NavigationForm.test.tsx +93 -0
- package/src/__tests__/components/ConfigPanel/PreviewForm/PreviewForm.test.tsx +93 -0
- package/src/__tests__/components/Fields/FieldGroup/FieldGroup.test.tsx +5 -5
- package/src/__tests__/components/Fields/NoteField/NoteField.test.tsx +3 -3
- package/src/__tests__/components/Fields/SliderField/SliderField.test.tsx +4 -4
- package/src/__tests__/components/Fields/TagField/TagField.test.tsx +10 -10
- package/src/__tests__/components/Fields/TextArea/TextArea.test.tsx +3 -3
- package/src/__tests__/components/Fields/TextField/TextField.test.tsx +8 -8
- package/src/__tests__/components/Fields/UrlField/UrlField.test.tsx +2 -2
- package/src/__tests__/components/Gallery/Gallery.test.tsx +613 -0
- package/src/__tests__/components/Gallery/GalleryFilters/Orientation/Orientation.test.tsx +51 -0
- package/src/__tests__/components/Gallery/GalleryFilters/SortBy/SortBy.test.tsx +117 -0
- package/src/__tests__/components/Gallery/GalleryFilters/Type/Type.test.tsx +51 -0
- package/src/__tests__/components/Gallery/GalleryPanel/DetailPanel/DetailPanel.test.tsx +853 -0
- package/src/__tests__/components/Gallery/GalleryPanel/GalleryDragAndDrop/GalleryDragAndDrop.test.tsx +252 -0
- package/src/__tests__/components/Gallery/GalleryPanel/GalleryPanel.test.tsx +56 -0
- package/src/__tests__/components/Image/Image.test.tsx +5 -5
- package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/Field/index.tsx +3 -4
- package/src/components/ConfigPanel/Form/index.tsx +13 -5
- package/src/components/ConfigPanel/GlobalPageForm/index.tsx +5 -5
- package/src/components/ConfigPanel/Header/index.tsx +3 -3
- package/src/components/ConfigPanel/NavigationForm/Field/index.tsx +5 -3
- package/src/components/ConfigPanel/NavigationForm/index.tsx +2 -2
- package/src/components/ConfigPanel/PreviewForm/index.tsx +3 -3
- package/src/components/ConfigPanel/index.tsx +2 -3
- package/src/components/Fields/FieldGroup/index.tsx +3 -3
- package/src/components/Fields/NoteField/index.tsx +2 -2
- package/src/components/Fields/SliderField/index.tsx +10 -3
- package/src/components/Fields/TagField/index.tsx +2 -2
- package/src/components/Fields/TextArea/index.tsx +1 -1
- package/src/components/Fields/TextField/index.tsx +3 -3
- package/src/components/Gallery/GalleryFilters/Orientation/index.tsx +14 -6
- package/src/components/Gallery/GalleryFilters/SortBy/index.tsx +2 -2
- package/src/components/Gallery/GalleryFilters/Type/index.tsx +2 -2
- package/src/components/Gallery/GalleryPanel/DetailPanel/index.tsx +4 -4
- package/src/components/Gallery/GalleryPanel/GalleryDragAndDrop/index.tsx +5 -4
- package/src/components/Gallery/GalleryPanel/index.tsx +3 -11
- package/src/components/Gallery/index.tsx +6 -5
- package/src/containers/PageEditor/actions.tsx +1 -2
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { ThemeProvider } from "styled-components";
|
|
4
|
+
import { render, cleanup, screen } from "../../../../../../../config/jest/test-utils";
|
|
5
|
+
import configureStore from "redux-mock-store";
|
|
6
|
+
import "@testing-library/jest-dom";
|
|
7
|
+
import thunk from "redux-thunk";
|
|
8
|
+
|
|
9
|
+
import { parseTheme } from "@ax/helpers";
|
|
10
|
+
import NavConnectedField from "@ax/components/ConfigPanel/Form/ConnectedField/NavConnectedField";
|
|
11
|
+
import globalTheme from "@ax/themes/theme.json";
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
cleanup();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const middlewares: any = [thunk];
|
|
18
|
+
const mockStore = configureStore(middlewares);
|
|
19
|
+
const updateEditorContentMock = jest.fn();
|
|
20
|
+
const initialStore = {
|
|
21
|
+
navigation: {
|
|
22
|
+
selectedContent: { template: "default" },
|
|
23
|
+
currentDefaultsContent: [
|
|
24
|
+
{
|
|
25
|
+
component: "Header",
|
|
26
|
+
type: "header",
|
|
27
|
+
title: "Header name",
|
|
28
|
+
note01: {
|
|
29
|
+
title: "",
|
|
30
|
+
text: "To configure social links go to settings/general/social. To activate search feature go to settings/actionables",
|
|
31
|
+
},
|
|
32
|
+
showTopNavigation: true,
|
|
33
|
+
topNavigationContent: ["showSocialMedia", "showSearchFeature"],
|
|
34
|
+
school: "GRIDDO_BIG",
|
|
35
|
+
primaryLink: {
|
|
36
|
+
component: "Link",
|
|
37
|
+
parentEditorID: 0,
|
|
38
|
+
},
|
|
39
|
+
secondaryLink: {
|
|
40
|
+
component: "Link",
|
|
41
|
+
parentEditorID: 0,
|
|
42
|
+
},
|
|
43
|
+
setAsDefault: false,
|
|
44
|
+
topMenu: null,
|
|
45
|
+
mainMenu: null,
|
|
46
|
+
sticky: true,
|
|
47
|
+
navigationBannerIcon: null,
|
|
48
|
+
navigationBanner: false,
|
|
49
|
+
navigationBannerText: "lorem ipsum",
|
|
50
|
+
navigationBannerLink: {
|
|
51
|
+
component: "Link",
|
|
52
|
+
parentEditorID: 0,
|
|
53
|
+
},
|
|
54
|
+
navigationBannerBGColor: "#50ABFF",
|
|
55
|
+
parentEditorID: null,
|
|
56
|
+
id: 181,
|
|
57
|
+
thumbnail: {
|
|
58
|
+
id: 1005,
|
|
59
|
+
name: "navigation-thumbnail.png",
|
|
60
|
+
title: "Thumbnail for Header name",
|
|
61
|
+
description: "",
|
|
62
|
+
alt: "",
|
|
63
|
+
tags: [],
|
|
64
|
+
url: "https://images.dev.griddo.io/navigation-thumbnail_71",
|
|
65
|
+
thumb: "https://images.dev.griddo.io/w/215/h/161/navigation-thumbnail_71",
|
|
66
|
+
publicId: "thesaurus-dev/navigation-thumbnail_f8d25cc6-daa0-4ea9-b08a-d68670a50a41",
|
|
67
|
+
damId: "navigation-thumbnail_71",
|
|
68
|
+
published: "2022-07-06T14:27:23.553Z",
|
|
69
|
+
size: 4236,
|
|
70
|
+
width: 773,
|
|
71
|
+
height: 92,
|
|
72
|
+
orientation: "L",
|
|
73
|
+
site: 85,
|
|
74
|
+
},
|
|
75
|
+
isDefault: false,
|
|
76
|
+
navigationLanguages: [
|
|
77
|
+
{
|
|
78
|
+
navigationId: 181,
|
|
79
|
+
languageId: 4,
|
|
80
|
+
locale: "en_GB",
|
|
81
|
+
language: "English",
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
site: 85,
|
|
85
|
+
language: 4,
|
|
86
|
+
entity: "73c91b2f-caca-4732-be7e-56fc1b640774",
|
|
87
|
+
deleted: false,
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
pageEditor: {
|
|
92
|
+
selectedContent: { component: "Page" },
|
|
93
|
+
errors: [{}],
|
|
94
|
+
},
|
|
95
|
+
sites: {
|
|
96
|
+
currentSitePages: [
|
|
97
|
+
{
|
|
98
|
+
editorID: 1,
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
app: {
|
|
103
|
+
lang: { locale: "es-ES", id: 0 },
|
|
104
|
+
},
|
|
105
|
+
dataPacks: {
|
|
106
|
+
templates: [{ id: "default" }],
|
|
107
|
+
},
|
|
108
|
+
menu: {
|
|
109
|
+
savedMenus: null,
|
|
110
|
+
},
|
|
111
|
+
navigationActions: {
|
|
112
|
+
updateEditorContent: updateEditorContentMock,
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
const store = mockStore(initialStore);
|
|
116
|
+
|
|
117
|
+
const defaultProps = {
|
|
118
|
+
field: {
|
|
119
|
+
title: "Name",
|
|
120
|
+
key: "title",
|
|
121
|
+
type: "TextField",
|
|
122
|
+
mandatory: true,
|
|
123
|
+
},
|
|
124
|
+
schema: {
|
|
125
|
+
title: "Header",
|
|
126
|
+
component: "Header",
|
|
127
|
+
type: "header",
|
|
128
|
+
configTabs: [
|
|
129
|
+
{
|
|
130
|
+
title: "content",
|
|
131
|
+
fields: [
|
|
132
|
+
{
|
|
133
|
+
title: "Name",
|
|
134
|
+
key: "title",
|
|
135
|
+
type: "TextField",
|
|
136
|
+
mandatory: true,
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
schemaType: "module",
|
|
142
|
+
},
|
|
143
|
+
isPage: true,
|
|
144
|
+
isGlobal: true,
|
|
145
|
+
selectedTab: "content",
|
|
146
|
+
theme: "default-theme",
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
describe("NavConnectedField component rendering", () => {
|
|
150
|
+
it("should render PageConnectedField", () => {
|
|
151
|
+
render(
|
|
152
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
153
|
+
<NavConnectedField {...defaultProps} />
|
|
154
|
+
</ThemeProvider>,
|
|
155
|
+
{ store }
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
const textFieldContainer = screen.getByTestId("text-field-container");
|
|
159
|
+
expect(textFieldContainer).toBeTruthy();
|
|
160
|
+
});
|
|
161
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { ThemeProvider } from "styled-components";
|
|
4
|
+
import { render, screen, cleanup } from "@testing-library/react";
|
|
5
|
+
import "@testing-library/jest-dom";
|
|
6
|
+
|
|
7
|
+
import { parseTheme } from "@ax/helpers";
|
|
8
|
+
import Field from "@ax/components/ConfigPanel/Form/ConnectedField/PageConnectedField/Field";
|
|
9
|
+
import globalTheme from "@ax/themes/theme.json";
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
cleanup();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const defaultProps = {
|
|
16
|
+
goTo: jest.fn(),
|
|
17
|
+
updateValue: jest.fn(),
|
|
18
|
+
deleteError: jest.fn(),
|
|
19
|
+
whiteList: undefined,
|
|
20
|
+
objKey: "title",
|
|
21
|
+
field: {},
|
|
22
|
+
selectedContent: {
|
|
23
|
+
id: 4380,
|
|
24
|
+
entity: "7387163a-969a-4dae-aa41-f7f3b5a1e21d",
|
|
25
|
+
site: 81,
|
|
26
|
+
title: "Page 36",
|
|
27
|
+
slug: "/page-36",
|
|
28
|
+
language: 4,
|
|
29
|
+
author: 2,
|
|
30
|
+
isHome: false,
|
|
31
|
+
canonicalURL: "",
|
|
32
|
+
parent: null,
|
|
33
|
+
component: "Page",
|
|
34
|
+
deleted: false,
|
|
35
|
+
follow: true,
|
|
36
|
+
header: null,
|
|
37
|
+
footer: null,
|
|
38
|
+
isIndexed: true,
|
|
39
|
+
liveStatus: {
|
|
40
|
+
id: 4,
|
|
41
|
+
title: "Offline pending",
|
|
42
|
+
status: "offline-pending",
|
|
43
|
+
},
|
|
44
|
+
locale: null,
|
|
45
|
+
metaDescription: "",
|
|
46
|
+
metaTitle: "Page 1",
|
|
47
|
+
metasAdvanced: "",
|
|
48
|
+
socialTitle: "",
|
|
49
|
+
socialDescription: "",
|
|
50
|
+
socialImage: null,
|
|
51
|
+
template: {},
|
|
52
|
+
url: null,
|
|
53
|
+
workflowStatus: null,
|
|
54
|
+
modified: "2022-12-01T16:37:27.000Z",
|
|
55
|
+
published: "2022-09-27T14:32:13.000Z",
|
|
56
|
+
pageLanguages: [],
|
|
57
|
+
templateId: "BasicTemplate",
|
|
58
|
+
structuredData: null,
|
|
59
|
+
hash: "01e8b056-9769-41f3-aeab-373324b19d34",
|
|
60
|
+
origin: "EDITOR",
|
|
61
|
+
fullUrl: "//cx.dev.griddo.io/pre-griddo/sergio-site/page-36/",
|
|
62
|
+
templateConfig: {},
|
|
63
|
+
editorID: 0,
|
|
64
|
+
parentEditorID: null,
|
|
65
|
+
},
|
|
66
|
+
pages: [],
|
|
67
|
+
actions: {},
|
|
68
|
+
disabled: false,
|
|
69
|
+
readonly: false,
|
|
70
|
+
activatedModules: ["Accordion"],
|
|
71
|
+
isTemplateActivated: true,
|
|
72
|
+
errors: [],
|
|
73
|
+
theme: "griddo-alt-theme",
|
|
74
|
+
moduleCopy: null,
|
|
75
|
+
availableDataPacks: [],
|
|
76
|
+
template: "BasicTemplate",
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
describe("Field component rendering", () => {
|
|
80
|
+
it("should render the component with FieldContainer", () => {
|
|
81
|
+
defaultProps.field = {
|
|
82
|
+
title: "Title",
|
|
83
|
+
type: "TextField",
|
|
84
|
+
key: "title",
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
render(
|
|
88
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
89
|
+
<Field {...defaultProps} />
|
|
90
|
+
</ThemeProvider>
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
// It's loading Field -> FieldContainer with a TextField
|
|
94
|
+
const inputComponent = screen.getByTestId<HTMLInputElement>("input-component");
|
|
95
|
+
expect(inputComponent).toBeTruthy();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("should render the component with FieldGroup", () => {
|
|
99
|
+
defaultProps.field = {
|
|
100
|
+
title: "Title",
|
|
101
|
+
type: "FieldGroup",
|
|
102
|
+
key: "title",
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
render(
|
|
106
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
107
|
+
<Field {...defaultProps} />
|
|
108
|
+
</ThemeProvider>
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
// It's loading Field -> FieldGroup with a TextField
|
|
112
|
+
const fieldGroupWrapper = screen.getByTestId("field-group-wrapper");
|
|
113
|
+
expect(fieldGroupWrapper).toBeTruthy();
|
|
114
|
+
});
|
|
115
|
+
});
|