@griddo/ax 1.75.111 → 1.75.112
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
|
@@ -2,7 +2,7 @@ module.exports = {
|
|
|
2
2
|
SiteProvider: jest.fn(),
|
|
3
3
|
schemas: {
|
|
4
4
|
key: "schema definition",
|
|
5
|
-
all: {
|
|
5
|
+
all: {
|
|
6
6
|
HeroCard: {
|
|
7
7
|
schemaType: "component",
|
|
8
8
|
component: "HeroCard",
|
|
@@ -1501,5 +1501,126 @@ module.exports = {
|
|
|
1501
1501
|
defaults: null,
|
|
1502
1502
|
},
|
|
1503
1503
|
},
|
|
1504
|
+
templates: {
|
|
1505
|
+
default: {
|
|
1506
|
+
config: [
|
|
1507
|
+
{
|
|
1508
|
+
field: {
|
|
1509
|
+
title: "Name",
|
|
1510
|
+
key: "title",
|
|
1511
|
+
type: "TextField",
|
|
1512
|
+
mandatory: true,
|
|
1513
|
+
modifiable: true,
|
|
1514
|
+
}
|
|
1515
|
+
},
|
|
1516
|
+
]
|
|
1517
|
+
},
|
|
1518
|
+
BasicTemplate: {
|
|
1519
|
+
schemaType: "template",
|
|
1520
|
+
displayName: "Basic Template",
|
|
1521
|
+
component: "BasicTemplate",
|
|
1522
|
+
dataPacks: null,
|
|
1523
|
+
type: { label: "Static", value: "static" },
|
|
1524
|
+
config: [
|
|
1525
|
+
{
|
|
1526
|
+
title: "Style",
|
|
1527
|
+
key: "primaryLinkStyle",
|
|
1528
|
+
type: "VisualUniqueSelection",
|
|
1529
|
+
options: [
|
|
1530
|
+
{
|
|
1531
|
+
value: "primary",
|
|
1532
|
+
img: 'img/themes/primaryStyle',
|
|
1533
|
+
},
|
|
1534
|
+
{
|
|
1535
|
+
value: "secondary",
|
|
1536
|
+
img: 'img/themes/primaryStyle',
|
|
1537
|
+
},
|
|
1538
|
+
{
|
|
1539
|
+
value: "link",
|
|
1540
|
+
img: 'img/themes/primaryStyle',
|
|
1541
|
+
},
|
|
1542
|
+
],
|
|
1543
|
+
columns: 3,
|
|
1544
|
+
},
|
|
1545
|
+
],
|
|
1546
|
+
content: [
|
|
1547
|
+
{
|
|
1548
|
+
title: "Hero Section",
|
|
1549
|
+
type: "ComponentArray",
|
|
1550
|
+
maxItems: 1,
|
|
1551
|
+
whiteList: ["BasicContent"],
|
|
1552
|
+
key: "heroSection",
|
|
1553
|
+
},
|
|
1554
|
+
],
|
|
1555
|
+
default: {
|
|
1556
|
+
type: "template",
|
|
1557
|
+
templateType: "BasicTemplate",
|
|
1558
|
+
heroSection: {
|
|
1559
|
+
component: "Section",
|
|
1560
|
+
name: "Hero Section",
|
|
1561
|
+
modules: [],
|
|
1562
|
+
sectionPosition: 1,
|
|
1563
|
+
},
|
|
1564
|
+
},
|
|
1565
|
+
thumbnails: {
|
|
1566
|
+
"default-theme": {
|
|
1567
|
+
"1x": "/thumbnails/HeroCard",
|
|
1568
|
+
"2x": "/thumbnails/HeroCard@2x",
|
|
1569
|
+
},
|
|
1570
|
+
"griddo-alt-theme": {
|
|
1571
|
+
"1x": "/thumbnails/HeroCard",
|
|
1572
|
+
"2x": "/thumbnails/HeroCard@2x",
|
|
1573
|
+
},
|
|
1574
|
+
},
|
|
1575
|
+
},
|
|
1576
|
+
}
|
|
1504
1577
|
},
|
|
1578
|
+
moduleCategories: [
|
|
1579
|
+
{
|
|
1580
|
+
"label": "Developing",
|
|
1581
|
+
"value": "developing",
|
|
1582
|
+
"featured": true
|
|
1583
|
+
},
|
|
1584
|
+
{
|
|
1585
|
+
"label": "Spacers",
|
|
1586
|
+
"value": "spacers",
|
|
1587
|
+
"featured": true
|
|
1588
|
+
},
|
|
1589
|
+
{
|
|
1590
|
+
"label": "Interactive",
|
|
1591
|
+
"value": "interactive"
|
|
1592
|
+
},
|
|
1593
|
+
{
|
|
1594
|
+
"label": "Collections",
|
|
1595
|
+
"value": "collections"
|
|
1596
|
+
},
|
|
1597
|
+
{
|
|
1598
|
+
"label": "Articles And Events",
|
|
1599
|
+
"value": "articlesAndEvents"
|
|
1600
|
+
},
|
|
1601
|
+
{
|
|
1602
|
+
"label": "Content",
|
|
1603
|
+
"value": "content"
|
|
1604
|
+
},
|
|
1605
|
+
{
|
|
1606
|
+
"label": "Featured",
|
|
1607
|
+
"value": "featured"
|
|
1608
|
+
},
|
|
1609
|
+
{
|
|
1610
|
+
"label": "Studies",
|
|
1611
|
+
"value": "studies"
|
|
1612
|
+
},
|
|
1613
|
+
{
|
|
1614
|
+
"label": "People",
|
|
1615
|
+
"value": "people"
|
|
1616
|
+
},
|
|
1617
|
+
{
|
|
1618
|
+
"label": "Social",
|
|
1619
|
+
"value": "social"
|
|
1620
|
+
},
|
|
1621
|
+
{
|
|
1622
|
+
"label": "Iframe",
|
|
1623
|
+
"value": "iframe"
|
|
1624
|
+
}
|
|
1625
|
+
]
|
|
1505
1626
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "1.75.
|
|
4
|
+
"version": "1.75.112",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -230,5 +230,5 @@
|
|
|
230
230
|
"publishConfig": {
|
|
231
231
|
"access": "public"
|
|
232
232
|
},
|
|
233
|
-
"gitHead": "
|
|
233
|
+
"gitHead": "fe8ce6bd77a4e4a9e19214e5e6e4020db1a25955"
|
|
234
234
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Avatar component rendering should render the component only with name 1`] = `
|
|
4
4
|
<div
|
|
5
|
-
className="sc-
|
|
5
|
+
className="sc-gScZFl gCBoym"
|
|
6
6
|
data-testid="avatar-wrapper"
|
|
7
7
|
>
|
|
8
8
|
<div
|
|
9
|
-
className="sc-
|
|
9
|
+
className="sc-lbVpMG hOAqbs"
|
|
10
10
|
data-testid="avatar"
|
|
11
11
|
/>
|
|
12
12
|
</div>
|
|
@@ -14,11 +14,11 @@ exports[`Avatar component rendering should render the component only with name 1
|
|
|
14
14
|
|
|
15
15
|
exports[`Avatar component rendering should render the component with a wrong image url 1`] = `
|
|
16
16
|
<div
|
|
17
|
-
className="sc-
|
|
17
|
+
className="sc-gScZFl gCBoym"
|
|
18
18
|
data-testid="avatar-wrapper"
|
|
19
19
|
>
|
|
20
20
|
<div
|
|
21
|
-
className="sc-
|
|
21
|
+
className="sc-lbVpMG kLnTvZ"
|
|
22
22
|
data-testid="avatar"
|
|
23
23
|
/>
|
|
24
24
|
</div>
|
|
@@ -26,11 +26,11 @@ exports[`Avatar component rendering should render the component with a wrong ima
|
|
|
26
26
|
|
|
27
27
|
exports[`Avatar component rendering should render the component with an empty string as name 1`] = `
|
|
28
28
|
<div
|
|
29
|
-
className="sc-
|
|
29
|
+
className="sc-gScZFl gCBoym"
|
|
30
30
|
data-testid="avatar-wrapper"
|
|
31
31
|
>
|
|
32
32
|
<div
|
|
33
|
-
className="sc-
|
|
33
|
+
className="sc-lbVpMG dbQJiT"
|
|
34
34
|
data-testid="avatar"
|
|
35
35
|
/>
|
|
36
36
|
</div>
|
|
@@ -38,11 +38,11 @@ exports[`Avatar component rendering should render the component with an empty st
|
|
|
38
38
|
|
|
39
39
|
exports[`Avatar component rendering should render the component with image null 1`] = `
|
|
40
40
|
<div
|
|
41
|
-
className="sc-
|
|
41
|
+
className="sc-gScZFl gCBoym"
|
|
42
42
|
data-testid="avatar-wrapper"
|
|
43
43
|
>
|
|
44
44
|
<div
|
|
45
|
-
className="sc-
|
|
45
|
+
className="sc-lbVpMG jpmXvZ"
|
|
46
46
|
data-testid="avatar"
|
|
47
47
|
/>
|
|
48
48
|
</div>
|
|
@@ -50,11 +50,11 @@ exports[`Avatar component rendering should render the component with image null
|
|
|
50
50
|
|
|
51
51
|
exports[`Avatar component rendering should render the component without name or image 1`] = `
|
|
52
52
|
<div
|
|
53
|
-
className="sc-
|
|
53
|
+
className="sc-gScZFl gCBoym"
|
|
54
54
|
data-testid="avatar-wrapper"
|
|
55
55
|
>
|
|
56
56
|
<div
|
|
57
|
-
className="sc-
|
|
57
|
+
className="sc-lbVpMG dbQJiT"
|
|
58
58
|
data-testid="avatar"
|
|
59
59
|
/>
|
|
60
60
|
</div>
|
|
@@ -0,0 +1,252 @@
|
|
|
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 { mock } from "jest-mock-extended";
|
|
6
|
+
import configureStore from "redux-mock-store";
|
|
7
|
+
import "@testing-library/jest-dom";
|
|
8
|
+
|
|
9
|
+
import { parseTheme } from "@ax/helpers";
|
|
10
|
+
import ConfigPanel, { IStateProps } from "@ax/components/ConfigPanel";
|
|
11
|
+
import globalTheme from "@ax/themes/theme.json";
|
|
12
|
+
|
|
13
|
+
afterEach(cleanup);
|
|
14
|
+
|
|
15
|
+
const middlewares: any = [];
|
|
16
|
+
const mockStore = configureStore(middlewares);
|
|
17
|
+
const initialStore = {
|
|
18
|
+
navigation: {
|
|
19
|
+
currentDefaultsContent: [
|
|
20
|
+
{
|
|
21
|
+
component: "Header",
|
|
22
|
+
type: "header",
|
|
23
|
+
title: "Header name",
|
|
24
|
+
note01: {
|
|
25
|
+
title: "",
|
|
26
|
+
text: "To configure social links go to settings/general/social. To activate search feature go to settings/actionables",
|
|
27
|
+
},
|
|
28
|
+
showTopNavigation: true,
|
|
29
|
+
topNavigationContent: ["showSocialMedia", "showSearchFeature"],
|
|
30
|
+
school: "GRIDDO_BIG",
|
|
31
|
+
primaryLink: {
|
|
32
|
+
component: "Link",
|
|
33
|
+
parentEditorID: 0,
|
|
34
|
+
},
|
|
35
|
+
secondaryLink: {
|
|
36
|
+
component: "Link",
|
|
37
|
+
parentEditorID: 0,
|
|
38
|
+
},
|
|
39
|
+
setAsDefault: false,
|
|
40
|
+
topMenu: null,
|
|
41
|
+
mainMenu: null,
|
|
42
|
+
sticky: true,
|
|
43
|
+
navigationBannerIcon: null,
|
|
44
|
+
navigationBanner: false,
|
|
45
|
+
navigationBannerText: "lorem ipsum",
|
|
46
|
+
navigationBannerLink: {
|
|
47
|
+
component: "Link",
|
|
48
|
+
parentEditorID: 0,
|
|
49
|
+
},
|
|
50
|
+
navigationBannerBGColor: "#50ABFF",
|
|
51
|
+
parentEditorID: null,
|
|
52
|
+
id: 181,
|
|
53
|
+
thumbnail: {
|
|
54
|
+
id: 1005,
|
|
55
|
+
name: "navigation-thumbnail.png",
|
|
56
|
+
title: "Thumbnail for Header name",
|
|
57
|
+
description: "",
|
|
58
|
+
alt: "",
|
|
59
|
+
tags: [],
|
|
60
|
+
url: "https://images.dev.griddo.io/navigation-thumbnail_71",
|
|
61
|
+
thumb: "https://images.dev.griddo.io/w/215/h/161/navigation-thumbnail_71",
|
|
62
|
+
publicId: "thesaurus-dev/navigation-thumbnail_f8d25cc6-daa0-4ea9-b08a-d68670a50a41",
|
|
63
|
+
damId: "navigation-thumbnail_71",
|
|
64
|
+
published: "2022-07-06T14:27:23.553Z",
|
|
65
|
+
size: 4236,
|
|
66
|
+
width: 773,
|
|
67
|
+
height: 92,
|
|
68
|
+
orientation: "L",
|
|
69
|
+
site: 85,
|
|
70
|
+
},
|
|
71
|
+
isDefault: false,
|
|
72
|
+
navigationLanguages: [
|
|
73
|
+
{
|
|
74
|
+
navigationId: 181,
|
|
75
|
+
languageId: 4,
|
|
76
|
+
locale: "en_GB",
|
|
77
|
+
language: "English",
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
site: 85,
|
|
81
|
+
language: 4,
|
|
82
|
+
entity: "73c91b2f-caca-4732-be7e-56fc1b640774",
|
|
83
|
+
deleted: false,
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
pageEditor: {
|
|
88
|
+
selectedContent: {},
|
|
89
|
+
},
|
|
90
|
+
sites: {
|
|
91
|
+
currentSitePages: [
|
|
92
|
+
{
|
|
93
|
+
editorID: 1,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
app: {
|
|
98
|
+
lang: { locale: "es-ES", id: 0 },
|
|
99
|
+
},
|
|
100
|
+
dataPacks: {
|
|
101
|
+
templates: [],
|
|
102
|
+
},
|
|
103
|
+
menu: {
|
|
104
|
+
savedMenus: null,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
const store = mockStore(initialStore);
|
|
108
|
+
|
|
109
|
+
const defaultProps = mock<IStateProps>();
|
|
110
|
+
defaultProps.schema = {
|
|
111
|
+
schemaType: "module",
|
|
112
|
+
displayName: "Header",
|
|
113
|
+
component: "Header",
|
|
114
|
+
type: "header",
|
|
115
|
+
defaultNavigation: true,
|
|
116
|
+
category: "header",
|
|
117
|
+
dataPacks: null,
|
|
118
|
+
configTabs: [
|
|
119
|
+
{
|
|
120
|
+
title: "content",
|
|
121
|
+
fields: [
|
|
122
|
+
{
|
|
123
|
+
title: "Name",
|
|
124
|
+
key: "title",
|
|
125
|
+
type: "TextField",
|
|
126
|
+
mandatory: true,
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
};
|
|
132
|
+
defaultProps.actions = { deleteModule: jest.fn() };
|
|
133
|
+
defaultProps.breadcrumb = [
|
|
134
|
+
{
|
|
135
|
+
editorID: 0,
|
|
136
|
+
displayName: "Header",
|
|
137
|
+
component: "Header",
|
|
138
|
+
},
|
|
139
|
+
];
|
|
140
|
+
defaultProps.selectedParent = null;
|
|
141
|
+
defaultProps.activatedModules = ["Accordion", "AddressCollection"];
|
|
142
|
+
const setSelectedContentMock = defaultProps.setSelectedContent as jest.MockedFunction<(editorID: number) => void>;
|
|
143
|
+
defaultProps.selectedTab = "content";
|
|
144
|
+
const setSelectedTabMocked = defaultProps.setSelectedTab as jest.MockedFunction<(tab: string) => void>;
|
|
145
|
+
defaultProps.isPage = false;
|
|
146
|
+
defaultProps.isEditable = true;
|
|
147
|
+
defaultProps.theme = "default-theme";
|
|
148
|
+
|
|
149
|
+
describe("ConfigPanel component rendering", () => {
|
|
150
|
+
it("should render the component", () => {
|
|
151
|
+
defaultProps.isLoading = false;
|
|
152
|
+
defaultProps.isPage = true;
|
|
153
|
+
|
|
154
|
+
render(
|
|
155
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
156
|
+
<ConfigPanel {...defaultProps} />
|
|
157
|
+
</ThemeProvider>,
|
|
158
|
+
{ store }
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
expect(screen.getByTestId("config-panel-wrapper")).toBeTruthy();
|
|
162
|
+
expect(screen.getByTestId("note-field-wrapper")).toBeTruthy();
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it("should render the loading component", () => {
|
|
166
|
+
defaultProps.isLoading = true;
|
|
167
|
+
|
|
168
|
+
render(
|
|
169
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
170
|
+
<ConfigPanel {...defaultProps} />
|
|
171
|
+
</ThemeProvider>,
|
|
172
|
+
{ store }
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
expect(screen.getByTestId("loading-wrapper")).toBeTruthy();
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it("should render the previewForm", () => {
|
|
179
|
+
defaultProps.isLoading = false;
|
|
180
|
+
defaultProps.isPage = true;
|
|
181
|
+
defaultProps.isReadOnly = true;
|
|
182
|
+
|
|
183
|
+
render(
|
|
184
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
185
|
+
<ConfigPanel {...defaultProps} />
|
|
186
|
+
</ThemeProvider>,
|
|
187
|
+
{ store }
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
expect(screen.getByTestId("config-panel-wrapper")).toBeTruthy();
|
|
191
|
+
expect(screen.getByTestId("preview-form-wrapper")).toBeTruthy();
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
it("should render the globalPageForm", () => {
|
|
195
|
+
defaultProps.isLoading = false;
|
|
196
|
+
defaultProps.isPage = true;
|
|
197
|
+
defaultProps.isGlobal = true;
|
|
198
|
+
defaultProps.isEditable = false;
|
|
199
|
+
defaultProps.isReadOnly = false;
|
|
200
|
+
|
|
201
|
+
defaultProps.schema = {
|
|
202
|
+
schemaType: "module",
|
|
203
|
+
displayName: "Header",
|
|
204
|
+
component: "Header",
|
|
205
|
+
type: "module",
|
|
206
|
+
defaultNavigation: true,
|
|
207
|
+
category: "header",
|
|
208
|
+
dataPacks: null,
|
|
209
|
+
configTabs: [
|
|
210
|
+
{
|
|
211
|
+
title: "content",
|
|
212
|
+
fields: [
|
|
213
|
+
{
|
|
214
|
+
title: "Name",
|
|
215
|
+
key: "title",
|
|
216
|
+
type: "TextField",
|
|
217
|
+
mandatory: true,
|
|
218
|
+
},
|
|
219
|
+
],
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
render(
|
|
225
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
226
|
+
<ConfigPanel {...defaultProps} />
|
|
227
|
+
</ThemeProvider>,
|
|
228
|
+
{ store }
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
expect(screen.getByTestId("config-panel-wrapper")).toBeTruthy();
|
|
232
|
+
expect(screen.getByTestId("global-page-section")).toBeTruthy();
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it("should render the Form", () => {
|
|
236
|
+
defaultProps.isLoading = false;
|
|
237
|
+
defaultProps.isPage = false;
|
|
238
|
+
defaultProps.isGlobal = true;
|
|
239
|
+
defaultProps.isEditable = false;
|
|
240
|
+
defaultProps.isReadOnly = false;
|
|
241
|
+
|
|
242
|
+
render(
|
|
243
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
244
|
+
<ConfigPanel {...defaultProps} />
|
|
245
|
+
</ThemeProvider>,
|
|
246
|
+
{ store }
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
expect(screen.getByTestId("config-panel-wrapper")).toBeTruthy();
|
|
250
|
+
expect(screen.getByTestId("form-section")).toBeTruthy();
|
|
251
|
+
});
|
|
252
|
+
});
|
|
@@ -0,0 +1,177 @@
|
|
|
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 ConnectedField from "@ax/components/ConfigPanel/Form/ConnectedField";
|
|
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 initialStore = {
|
|
20
|
+
navigation: {
|
|
21
|
+
currentDefaultsContent: [
|
|
22
|
+
{
|
|
23
|
+
component: "Header",
|
|
24
|
+
type: "header",
|
|
25
|
+
title: "Header name",
|
|
26
|
+
note01: {
|
|
27
|
+
title: "",
|
|
28
|
+
text: "To configure social links go to settings/general/social. To activate search feature go to settings/actionables",
|
|
29
|
+
},
|
|
30
|
+
showTopNavigation: true,
|
|
31
|
+
topNavigationContent: ["showSocialMedia", "showSearchFeature"],
|
|
32
|
+
school: "GRIDDO_BIG",
|
|
33
|
+
primaryLink: {
|
|
34
|
+
component: "Link",
|
|
35
|
+
parentEditorID: 0,
|
|
36
|
+
},
|
|
37
|
+
secondaryLink: {
|
|
38
|
+
component: "Link",
|
|
39
|
+
parentEditorID: 0,
|
|
40
|
+
},
|
|
41
|
+
setAsDefault: false,
|
|
42
|
+
topMenu: null,
|
|
43
|
+
mainMenu: null,
|
|
44
|
+
sticky: true,
|
|
45
|
+
navigationBannerIcon: null,
|
|
46
|
+
navigationBanner: false,
|
|
47
|
+
navigationBannerText: "lorem ipsum",
|
|
48
|
+
navigationBannerLink: {
|
|
49
|
+
component: "Link",
|
|
50
|
+
parentEditorID: 0,
|
|
51
|
+
},
|
|
52
|
+
navigationBannerBGColor: "#50ABFF",
|
|
53
|
+
parentEditorID: null,
|
|
54
|
+
id: 181,
|
|
55
|
+
thumbnail: {
|
|
56
|
+
id: 1005,
|
|
57
|
+
name: "navigation-thumbnail.png",
|
|
58
|
+
title: "Thumbnail for Header name",
|
|
59
|
+
description: "",
|
|
60
|
+
alt: "",
|
|
61
|
+
tags: [],
|
|
62
|
+
url: "https://images.dev.griddo.io/navigation-thumbnail_71",
|
|
63
|
+
thumb: "https://images.dev.griddo.io/w/215/h/161/navigation-thumbnail_71",
|
|
64
|
+
publicId: "thesaurus-dev/navigation-thumbnail_f8d25cc6-daa0-4ea9-b08a-d68670a50a41",
|
|
65
|
+
damId: "navigation-thumbnail_71",
|
|
66
|
+
published: "2022-07-06T14:27:23.553Z",
|
|
67
|
+
size: 4236,
|
|
68
|
+
width: 773,
|
|
69
|
+
height: 92,
|
|
70
|
+
orientation: "L",
|
|
71
|
+
site: 85,
|
|
72
|
+
},
|
|
73
|
+
isDefault: false,
|
|
74
|
+
navigationLanguages: [
|
|
75
|
+
{
|
|
76
|
+
navigationId: 181,
|
|
77
|
+
languageId: 4,
|
|
78
|
+
locale: "en_GB",
|
|
79
|
+
language: "English",
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
site: 85,
|
|
83
|
+
language: 4,
|
|
84
|
+
entity: "73c91b2f-caca-4732-be7e-56fc1b640774",
|
|
85
|
+
deleted: false,
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
pageEditor: {
|
|
90
|
+
selectedContent: { component: "Page" },
|
|
91
|
+
errors: [{}],
|
|
92
|
+
},
|
|
93
|
+
sites: {
|
|
94
|
+
currentSitePages: [
|
|
95
|
+
{
|
|
96
|
+
editorID: 1,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
app: {
|
|
101
|
+
lang: { locale: "es-ES", id: 0 },
|
|
102
|
+
},
|
|
103
|
+
dataPacks: {
|
|
104
|
+
templates: [],
|
|
105
|
+
},
|
|
106
|
+
menu: {
|
|
107
|
+
savedMenus: null,
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
const store = mockStore(initialStore);
|
|
111
|
+
|
|
112
|
+
const restorePageNavigationActionMock = jest.fn();
|
|
113
|
+
|
|
114
|
+
const defaultProps = {
|
|
115
|
+
field: {
|
|
116
|
+
title: "Name",
|
|
117
|
+
key: "title",
|
|
118
|
+
type: "TextField",
|
|
119
|
+
mandatory: true,
|
|
120
|
+
},
|
|
121
|
+
schema: {
|
|
122
|
+
title: "Header",
|
|
123
|
+
component: "Header",
|
|
124
|
+
type: "header",
|
|
125
|
+
configTabs: [
|
|
126
|
+
{
|
|
127
|
+
title: "content",
|
|
128
|
+
fields: [
|
|
129
|
+
{
|
|
130
|
+
title: "Name",
|
|
131
|
+
key: "title",
|
|
132
|
+
type: "TextField",
|
|
133
|
+
mandatory: true,
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
schemaType: "module",
|
|
139
|
+
},
|
|
140
|
+
isPage: true,
|
|
141
|
+
isGlobal: true,
|
|
142
|
+
actions: {
|
|
143
|
+
restorePageNavigationAction: restorePageNavigationActionMock,
|
|
144
|
+
},
|
|
145
|
+
selectedTab: "content",
|
|
146
|
+
theme: "default-theme",
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
describe("ConnectedField component rendering", () => {
|
|
150
|
+
it("should render PageConnectedField", () => {
|
|
151
|
+
render(
|
|
152
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
153
|
+
<ConnectedField {...defaultProps} />
|
|
154
|
+
</ThemeProvider>,
|
|
155
|
+
{ store }
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
// we passed a textField so if it's rendering this correctly,
|
|
159
|
+
// it has to be rendering a textField component
|
|
160
|
+
const textFieldContainer = screen.getByTestId("text-field-container");
|
|
161
|
+
expect(textFieldContainer).toBeTruthy();
|
|
162
|
+
});
|
|
163
|
+
it("should render NavConnectedField", () => {
|
|
164
|
+
defaultProps.isPage = false;
|
|
165
|
+
|
|
166
|
+
render(
|
|
167
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
168
|
+
<ConnectedField {...defaultProps} />
|
|
169
|
+
</ThemeProvider>,
|
|
170
|
+
{ store }
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
// the NavConnectedField it's rendering the FieldsBehavior component
|
|
174
|
+
const fieldsBehaviorWrapper = screen.getByTestId("fields-behavior-wrapper");
|
|
175
|
+
expect(fieldsBehaviorWrapper).toBeTruthy();
|
|
176
|
+
});
|
|
177
|
+
});
|