@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
|
@@ -81,7 +81,7 @@ const TextField = (props: ITextFieldProps): JSX.Element => {
|
|
|
81
81
|
<S.FieldWrapper data-testid="text-field-container" error={error} className={className}>
|
|
82
82
|
{prefix && <Prefix />}
|
|
83
83
|
<S.Input
|
|
84
|
-
data-testid="
|
|
84
|
+
data-testid="input-component"
|
|
85
85
|
type={inputType}
|
|
86
86
|
value={inputValue}
|
|
87
87
|
name={name}
|
|
@@ -99,12 +99,12 @@ const TextField = (props: ITextFieldProps): JSX.Element => {
|
|
|
99
99
|
aria-label={name}
|
|
100
100
|
/>
|
|
101
101
|
{hasBackgroundIcon && (
|
|
102
|
-
<S.BackgroundIcon data-testid="
|
|
102
|
+
<S.BackgroundIcon data-testid="background-icon-component" onClick={onClickIcon}>
|
|
103
103
|
<Icon name={icon || ""} size="24" />
|
|
104
104
|
</S.BackgroundIcon>
|
|
105
105
|
)}
|
|
106
106
|
{hasButton && (
|
|
107
|
-
<S.IconWrapper data-testid="
|
|
107
|
+
<S.IconWrapper data-testid="icon-wrapper-component" readonly={readonly} error={error}>
|
|
108
108
|
<IconAction icon={icon || ""} onClick={onClickIcon} disabled={disabled} size="s" />
|
|
109
109
|
</S.IconWrapper>
|
|
110
110
|
)}
|
|
@@ -22,7 +22,7 @@ const Orientation = ({ filterItems }: IOrientationProps): JSX.Element => {
|
|
|
22
22
|
const isActive = !areEquals(selectedValue, initialState);
|
|
23
23
|
|
|
24
24
|
const Header = () => (
|
|
25
|
-
<S.Orientation isActive={isActive}>
|
|
25
|
+
<S.Orientation data-testid="orientation-wrapper" isActive={isActive}>
|
|
26
26
|
Orientation
|
|
27
27
|
<S.IconsWrapper>
|
|
28
28
|
{isActive && <Icon name="Filter" size="16" />}
|
|
@@ -36,15 +36,23 @@ const Orientation = ({ filterItems }: IOrientationProps): JSX.Element => {
|
|
|
36
36
|
return (
|
|
37
37
|
<FloatingMenu Button={Header} position="center" closeOnSelect={true}>
|
|
38
38
|
<ListTitle>Filter by orientation</ListTitle>
|
|
39
|
-
<ListItem isSelected={selectedValue.includes("all")} onClick={() => setQuery("all")}>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<ListItem isSelected={selectedValue.includes("
|
|
39
|
+
<ListItem isSelected={selectedValue.includes("all")} onClick={() => setQuery("all")}>
|
|
40
|
+
All
|
|
41
|
+
</ListItem>
|
|
42
|
+
<ListItem isSelected={selectedValue.includes("landscape")} onClick={() => setQuery("landscape")}>
|
|
43
|
+
Horizontal
|
|
44
|
+
</ListItem>
|
|
45
|
+
<ListItem isSelected={selectedValue.includes("portrait")} onClick={() => setQuery("portrait")}>
|
|
46
|
+
Vertical
|
|
47
|
+
</ListItem>
|
|
48
|
+
<ListItem isSelected={selectedValue.includes("square")} onClick={() => setQuery("square")}>
|
|
49
|
+
Square
|
|
50
|
+
</ListItem>
|
|
43
51
|
</FloatingMenu>
|
|
44
52
|
);
|
|
45
53
|
};
|
|
46
54
|
|
|
47
|
-
interface IOrientationProps {
|
|
55
|
+
export interface IOrientationProps {
|
|
48
56
|
filterItems(pointer: string, filter: string): void;
|
|
49
57
|
}
|
|
50
58
|
|
|
@@ -19,7 +19,7 @@ const SortBy = ({ sortItems, sortedState }: ISortByProps): JSX.Element => {
|
|
|
19
19
|
const isActive = sortedByName || sortedByDate || sortedBySize;
|
|
20
20
|
|
|
21
21
|
const Header = () => (
|
|
22
|
-
<S.SortBy isActive={isActive}>
|
|
22
|
+
<S.SortBy data-testid="sortby-wrapper" isActive={isActive}>
|
|
23
23
|
Sort by
|
|
24
24
|
<S.IconsWrapper>
|
|
25
25
|
{isActive && <SortedStateArrow />}
|
|
@@ -45,7 +45,7 @@ const SortBy = ({ sortItems, sortedState }: ISortByProps): JSX.Element => {
|
|
|
45
45
|
);
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
interface ISortByProps {
|
|
48
|
+
export interface ISortByProps {
|
|
49
49
|
sortedState: ISortedListStatus;
|
|
50
50
|
sortItems(orderPointer: string, isAscendent: boolean): void;
|
|
51
51
|
}
|
|
@@ -22,7 +22,7 @@ const Type = ({ filterItems }: ITypeProps): JSX.Element => {
|
|
|
22
22
|
const isActive = !areEquals(selectedValue, initialState);
|
|
23
23
|
|
|
24
24
|
const Header = () => (
|
|
25
|
-
<S.Type isActive={isActive}>
|
|
25
|
+
<S.Type data-testid="type-wrapper" isActive={isActive}>
|
|
26
26
|
Media type
|
|
27
27
|
<S.IconsWrapper>
|
|
28
28
|
{isActive && <Icon name="Filter" size="16" />}
|
|
@@ -43,7 +43,7 @@ const Type = ({ filterItems }: ITypeProps): JSX.Element => {
|
|
|
43
43
|
);
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
interface ITypeProps {
|
|
46
|
+
export interface ITypeProps {
|
|
47
47
|
filterItems(pointer: string, filter: string): void;
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -118,7 +118,7 @@ const GalleryDetailPanel = (props: IProps) => {
|
|
|
118
118
|
: "";
|
|
119
119
|
|
|
120
120
|
const AddToGlobal = () => (
|
|
121
|
-
<S.AddToGlobal>
|
|
121
|
+
<S.AddToGlobal data-testid="add-to-global-wrapper">
|
|
122
122
|
<CheckField
|
|
123
123
|
key="addToGlobal"
|
|
124
124
|
title="Add to Global Gallery"
|
|
@@ -187,7 +187,7 @@ const GalleryDetailPanel = (props: IProps) => {
|
|
|
187
187
|
);
|
|
188
188
|
|
|
189
189
|
return (
|
|
190
|
-
<S.DetailPanelWrapper hidden={!isImageSelected}>
|
|
190
|
+
<S.DetailPanelWrapper data-testid="detail-panel-wrapper" hidden={!isImageSelected}>
|
|
191
191
|
{renderImageForm}
|
|
192
192
|
<S.PanelActions>
|
|
193
193
|
<Button
|
|
@@ -219,7 +219,7 @@ const GalleryDetailPanel = (props: IProps) => {
|
|
|
219
219
|
);
|
|
220
220
|
};
|
|
221
221
|
|
|
222
|
-
interface IDetailPanelProps {
|
|
222
|
+
export interface IDetailPanelProps {
|
|
223
223
|
setImage: (imageData: any) => void;
|
|
224
224
|
imageSelected: IImage | null;
|
|
225
225
|
isImageSelected: boolean;
|
|
@@ -232,7 +232,7 @@ const mapStateToProps = (state: IRootState) => ({
|
|
|
232
232
|
isSaving: state.gallery.isSaving,
|
|
233
233
|
});
|
|
234
234
|
|
|
235
|
-
interface IDispatchProps {
|
|
235
|
+
export interface IDispatchProps {
|
|
236
236
|
updateImage: (imageID: number, imageData: IImageForm, add?: boolean) => Promise<void>;
|
|
237
237
|
deleteImage: (imageID: number) => Promise<boolean>;
|
|
238
238
|
uploadImage: (imageFile: File, site: number | string) => Promise<IImage>;
|
|
@@ -93,8 +93,8 @@ const GalleryDragAndDrop = (props: IProps) => {
|
|
|
93
93
|
const uploadPercentage = (uploadingState.ready * 100) / uploadingState.total;
|
|
94
94
|
|
|
95
95
|
const handleTryAgain = () => {
|
|
96
|
-
setInDropZone(false);
|
|
97
96
|
uploadError(false);
|
|
97
|
+
setInDropZone(false);
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
const handleFileClick = () => {
|
|
@@ -105,6 +105,7 @@ const GalleryDragAndDrop = (props: IProps) => {
|
|
|
105
105
|
|
|
106
106
|
const renderDragAndDrop = () => (
|
|
107
107
|
<DragAndDrop
|
|
108
|
+
data-testid="drag-drop-wrapper"
|
|
108
109
|
onDrop={handleDrop}
|
|
109
110
|
onDragOver={handleDragOver}
|
|
110
111
|
onDragEnter={handleDragEnter}
|
|
@@ -147,7 +148,7 @@ const GalleryDragAndDrop = (props: IProps) => {
|
|
|
147
148
|
);
|
|
148
149
|
|
|
149
150
|
return (
|
|
150
|
-
<S.Wrapper hidden={isImageSelected}>
|
|
151
|
+
<S.Wrapper hidden={isImageSelected} data-testid="gallery-drag-drop-wrapper">
|
|
151
152
|
<S.DragAndDropWrapper inDropZone={inDropZone} uploading={uploading} success={success} error={isError}>
|
|
152
153
|
{allowUpload ? renderDragAndDrop() : renderPlaceholder()}
|
|
153
154
|
</S.DragAndDropWrapper>
|
|
@@ -184,7 +185,7 @@ const GalleryDragAndDrop = (props: IProps) => {
|
|
|
184
185
|
);
|
|
185
186
|
};
|
|
186
187
|
|
|
187
|
-
interface IGalleryDragAndDropProps {
|
|
188
|
+
export interface IGalleryDragAndDropProps {
|
|
188
189
|
isImageSelected: boolean;
|
|
189
190
|
validFormats: string[];
|
|
190
191
|
site: number | string;
|
|
@@ -203,7 +204,7 @@ const mapStateToProps = (state: IRootState) => ({
|
|
|
203
204
|
errorMsg: state.gallery.errorMsg,
|
|
204
205
|
});
|
|
205
206
|
|
|
206
|
-
interface IDispatchProps {
|
|
207
|
+
export interface IDispatchProps {
|
|
207
208
|
getSiteImages(params: IGetSiteImages): Promise<void>;
|
|
208
209
|
selectImage(item: IImage): void;
|
|
209
210
|
uploadError: (error: boolean, msg?: string) => Promise<void>;
|
|
@@ -7,16 +7,8 @@ import DetailPanel from "./DetailPanel";
|
|
|
7
7
|
import * as S from "./style";
|
|
8
8
|
|
|
9
9
|
const GalleryPanel = (props: IGalleryPanelProps) => {
|
|
10
|
-
const {
|
|
11
|
-
|
|
12
|
-
imageSelected,
|
|
13
|
-
validFormats,
|
|
14
|
-
setImage,
|
|
15
|
-
isGlobalTab,
|
|
16
|
-
site,
|
|
17
|
-
selectedTab,
|
|
18
|
-
refreshImages,
|
|
19
|
-
} = props;
|
|
10
|
+
const { isImageSelected, imageSelected, validFormats, setImage, isGlobalTab, site, selectedTab, refreshImages } =
|
|
11
|
+
props;
|
|
20
12
|
const allowUpload = !isGlobalTab || !selectedTab;
|
|
21
13
|
|
|
22
14
|
return (
|
|
@@ -39,7 +31,7 @@ const GalleryPanel = (props: IGalleryPanelProps) => {
|
|
|
39
31
|
);
|
|
40
32
|
};
|
|
41
33
|
|
|
42
|
-
interface IGalleryPanelProps {
|
|
34
|
+
export interface IGalleryPanelProps {
|
|
43
35
|
isImageSelected: boolean;
|
|
44
36
|
imageSelected: IImage | null;
|
|
45
37
|
validFormats: string[];
|
|
@@ -127,7 +127,7 @@ const Gallery = (props: IProps): JSX.Element => {
|
|
|
127
127
|
const noSearchResults = !data?.items?.length && isSearching;
|
|
128
128
|
|
|
129
129
|
return (
|
|
130
|
-
<S.Wrapper>
|
|
130
|
+
<S.Wrapper data-testid="gallery-wrapper">
|
|
131
131
|
<S.GalleryTabs>
|
|
132
132
|
<S.Header>
|
|
133
133
|
{!!tabs.length && (
|
|
@@ -165,7 +165,7 @@ const Gallery = (props: IProps): JSX.Element => {
|
|
|
165
165
|
<EmptyState {...emptyStateProps} />
|
|
166
166
|
</S.EmptyWrapper>
|
|
167
167
|
) : (
|
|
168
|
-
<S.Grid>
|
|
168
|
+
<S.Grid data-testid="grid-wrapper">
|
|
169
169
|
{data &&
|
|
170
170
|
data.items &&
|
|
171
171
|
data.items.map((item: IImage, index: number) => {
|
|
@@ -175,8 +175,9 @@ const Gallery = (props: IProps): JSX.Element => {
|
|
|
175
175
|
setImageSelectedData(data);
|
|
176
176
|
}
|
|
177
177
|
return (
|
|
178
|
-
<S.GridItem key={item.name + index} orientation={item.orientation}>
|
|
178
|
+
<S.GridItem data-testid="grid-item" key={item.name + index} orientation={item.orientation}>
|
|
179
179
|
<S.ImageWrapper
|
|
180
|
+
data-testid="image-item"
|
|
180
181
|
onClick={handleClick(item)}
|
|
181
182
|
selected={isSelected}
|
|
182
183
|
orientation={item.orientation}
|
|
@@ -217,7 +218,7 @@ const Gallery = (props: IProps): JSX.Element => {
|
|
|
217
218
|
);
|
|
218
219
|
};
|
|
219
220
|
|
|
220
|
-
interface IGalleryProps {
|
|
221
|
+
export interface IGalleryProps {
|
|
221
222
|
getImageSelected: (img: IImage | null) => void;
|
|
222
223
|
toggleModal: () => void;
|
|
223
224
|
site: ISite;
|
|
@@ -230,7 +231,7 @@ const mapStateToProps = (state: IRootState) => ({
|
|
|
230
231
|
isLoading: state.gallery.isLoading,
|
|
231
232
|
});
|
|
232
233
|
|
|
233
|
-
interface IDispatchProps {
|
|
234
|
+
export interface IDispatchProps {
|
|
234
235
|
getSiteImages(params: IGetSiteImages): Promise<void>;
|
|
235
236
|
selectImage(item: IImage): void;
|
|
236
237
|
uploadError: (error: boolean, msg?: string) => Promise<void>;
|
|
@@ -1020,6 +1020,7 @@ function setSelectedContent(editorID: number): (dispatch: Dispatch, getState: an
|
|
|
1020
1020
|
*/
|
|
1021
1021
|
|
|
1022
1022
|
const { element: selectedContent, parent: selectedParent } = findByEditorID({ header, editorContent }, editorID);
|
|
1023
|
+
|
|
1023
1024
|
const { component } = selectedContent;
|
|
1024
1025
|
const defaultSchema = getDefaultSchema(component);
|
|
1025
1026
|
|
|
@@ -1294,9 +1295,7 @@ function removeNavigationFromPage(key: string): (dispatch: Dispatch, getState: a
|
|
|
1294
1295
|
const {
|
|
1295
1296
|
pageEditor: { editorContent },
|
|
1296
1297
|
} = getState();
|
|
1297
|
-
|
|
1298
1298
|
const updatedEditorContent = { ...editorContent, [key]: 0 };
|
|
1299
|
-
|
|
1300
1299
|
setSelectedContent(0)(dispatch, getState);
|
|
1301
1300
|
dispatch(setEditorContent(updatedEditorContent));
|
|
1302
1301
|
};
|