@griddo/ax 1.69.7 → 1.71.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/jest/componentsMock.js +0 -26
- package/package.json +4 -3
- package/src/__tests__/components/ElementsTooltip/ElementsTooltip.test.tsx +97 -0
- package/src/__tests__/components/EmptyState/EmptyState.test.tsx +78 -0
- package/src/__tests__/components/Fields/AnalyticsField/PageAnalytics/PageAnalytics.test.tsx +0 -14
- package/src/__tests__/components/Fields/AnalyticsField/StructuredDataAnalytics/StructuredDataAnalytics.test.tsx +0 -15
- package/src/__tests__/components/Fields/ArrayFieldGroup/ArrayFieldGroup.test.tsx +6 -15
- package/src/__tests__/components/Fields/AsyncCheckGroup/AsyncCheckGroup.test.tsx +1 -13
- package/src/__tests__/components/Fields/AsyncSelect/AsyncSelect.test.tsx +1 -19
- package/src/__tests__/components/Fields/ColorPicker/ColorPicker.test.tsx +1 -10
- package/src/__tests__/components/Fields/ComponentArray/ComponentArray.test.tsx +1 -22
- package/src/__tests__/components/Fields/ComponentArray/MixableComponentArray/MixableComponentArray.test.tsx +4 -24
- package/src/__tests__/components/Fields/ComponentArray/MixableComponentArray/PasteModuleButton/PasteModuleButton.test.tsx +6 -12
- package/src/__tests__/components/Fields/ComponentArray/SameComponentArray/SameComponentArray.test.tsx +1 -20
- package/src/__tests__/components/Fields/ComponentContainer/ComponentContainer.test.tsx +559 -0
- package/src/__tests__/components/Fields/HiddenField/HiddenField.test.tsx +1 -7
- package/src/__tests__/components/Fields/ImageField/ImageField.test.tsx +471 -0
- package/src/__tests__/components/Fields/MultiCheckSelect/MultiCheckSelect.test.tsx +1 -15
- package/src/__tests__/components/Fields/NoteField/NoteField.test.tsx +1 -6
- package/src/__tests__/components/Fields/NumberField/NumberField.test.tsx +1 -14
- package/src/__tests__/components/Fields/RadioField/RadioField.test.tsx +1 -11
- package/src/__tests__/components/Fields/ReferenceField/ReferenceField.test.tsx +77 -13
- package/src/__tests__/components/Fields/RichText/RichText.test.tsx +1 -12
- package/src/__tests__/components/Fields/Select/Select.test.tsx +1 -21
- package/src/__tests__/components/Fields/SliderField/SliderField.test.tsx +1 -14
- package/src/__tests__/components/Fields/TagField/TagField.test.tsx +3 -3
- package/src/__tests__/components/Fields/TimeField/HourInput/HourInput.test.tsx +142 -0
- package/src/__tests__/components/Fields/TimeField/TimeField.test.tsx +100 -0
- package/src/__tests__/components/Fields/ToggleField/ToggleField.test.tsx +1 -9
- package/src/__tests__/components/Fields/Tooltip/Tooltip.test.tsx +151 -0
- package/src/__tests__/components/Fields/VisualUniqueSelection/ImageSelection/ImageSelection.test.tsx +1 -13
- package/src/__tests__/components/Fields/VisualUniqueSelection/ScrollableSelection/ScrollableSelection.test.tsx +3 -17
- package/src/__tests__/components/Fields/VisualUniqueSelection/VisualUniqueSelection.test.tsx +2 -28
- package/src/__tests__/components/TableList/TableList.test.tsx +119 -0
- package/src/__tests__/components/Tabs/Tabs.test.tsx +202 -0
- package/src/__tests__/components/Tag/Tag.test.tsx +138 -0
- package/src/__tests__/components/Toast/Toast.test.tsx +100 -0
- package/src/api/navigation.tsx +1 -1
- package/src/components/Browser/index.tsx +1 -1
- package/src/components/Button/index.tsx +3 -3
- package/src/components/ConfigPanel/NavigationForm/Field/index.tsx +14 -3
- package/src/components/ElementsTooltip/index.tsx +10 -9
- package/src/components/EmptyState/index.tsx +2 -2
- package/src/components/Fields/ArrayFieldGroup/index.tsx +1 -1
- package/src/components/Fields/AsyncCheckGroup/index.tsx +1 -1
- package/src/components/Fields/AsyncSelect/index.tsx +1 -1
- package/src/components/Fields/ComponentContainer/index.tsx +7 -6
- package/src/components/Fields/ComponentContainer/style.tsx +2 -2
- package/src/components/Fields/HiddenField/index.tsx +1 -1
- package/src/components/Fields/ImageField/index.tsx +10 -5
- package/src/components/Fields/MultiCheckSelect/index.tsx +3 -3
- package/src/components/Fields/NumberField/index.tsx +2 -1
- package/src/components/Fields/ReferenceField/ItemList/Item/index.tsx +5 -7
- package/src/components/Fields/ReferenceField/ItemList/Item/style.tsx +2 -2
- package/src/components/Fields/ReferenceField/ItemList/index.tsx +1 -1
- package/src/components/Fields/RichText/index.tsx +10 -6
- package/src/components/Fields/Select/index.tsx +1 -1
- package/src/components/Fields/SliderField/index.tsx +1 -1
- package/src/components/Fields/TimeField/HourInput/index.tsx +103 -0
- package/src/components/Fields/TimeField/HourInput/style.tsx +19 -0
- package/src/components/Fields/TimeField/HourInput/utils.tsx +35 -0
- package/src/components/Fields/TimeField/index.tsx +57 -0
- package/src/components/Fields/TimeField/style.tsx +37 -0
- package/src/components/Fields/index.tsx +2 -0
- package/src/components/FloatingMenu/index.tsx +1 -1
- package/src/components/Gallery/GalleryFilters/Type/index.tsx +50 -0
- package/src/components/Gallery/GalleryFilters/Type/style.tsx +39 -0
- package/src/components/Gallery/GalleryPanel/DetailPanel/index.tsx +2 -1
- package/src/components/Gallery/GalleryPanel/GalleryDragAndDrop/style.tsx +3 -3
- package/src/components/Gallery/hooks.tsx +10 -4
- package/src/components/Gallery/index.tsx +2 -0
- package/src/components/Icon/index.tsx +1 -1
- package/src/components/Loading/index.tsx +1 -1
- package/src/components/Pagination/index.tsx +1 -1
- package/src/components/SideModal/SideModalOption/index.tsx +4 -2
- package/src/components/SideModal/index.tsx +1 -1
- package/src/components/TableList/index.tsx +6 -6
- package/src/components/TableList/style.tsx +1 -1
- package/src/components/Tabs/index.tsx +19 -7
- package/src/components/Tag/index.tsx +6 -6
- package/src/components/Toast/index.tsx +4 -4
- package/src/components/Tooltip/index.tsx +5 -3
- package/src/components/index.tsx +2 -0
- package/src/containers/Navigation/Defaults/actions.tsx +10 -5
- package/src/containers/Navigation/Defaults/utils.tsx +13 -4
- package/src/containers/Sites/actions.tsx +7 -0
- package/src/containers/Sites/constants.tsx +1 -0
- package/src/containers/Sites/interfaces.tsx +6 -0
- package/src/containers/Sites/reducer.tsx +4 -0
- package/src/containers/StructuredData/actions.tsx +21 -8
- package/src/containers/StructuredData/constants.tsx +2 -0
- package/src/containers/StructuredData/interfaces.tsx +7 -1
- package/src/containers/StructuredData/reducer.tsx +5 -1
- package/src/helpers/fields.tsx +2 -2
- package/src/helpers/schemas.tsx +2 -2
- package/src/hooks/forms.tsx +2 -1
- package/src/modules/App/Routing/NavMenu/index.tsx +9 -1
- package/src/modules/Content/BulkHeader/TableHeader/index.tsx +1 -1
- package/src/modules/Content/hooks.tsx +19 -12
- package/src/modules/Content/index.tsx +23 -14
- package/src/modules/Navigation/Defaults/DefaultsEditor/Editor/DefaultsBrowser/index.tsx +3 -0
- package/src/modules/Navigation/Defaults/DefaultsEditor/Editor/index.tsx +3 -1
- package/src/modules/Navigation/Defaults/DefaultsEditor/index.tsx +16 -18
- package/src/modules/Navigation/Defaults/DefaultsEditor/utils.tsx +37 -0
- package/src/modules/StructuredData/Form/ConnectedField/index.tsx +3 -2
- package/src/modules/StructuredData/Form/index.tsx +22 -17
- package/src/modules/StructuredData/StructuredDataList/hooks.tsx +30 -20
- package/src/modules/StructuredData/StructuredDataList/index.tsx +24 -14
- package/src/types/index.tsx +8 -7
|
@@ -1501,30 +1501,4 @@ module.exports = {
|
|
|
1501
1501
|
},
|
|
1502
1502
|
},
|
|
1503
1503
|
},
|
|
1504
|
-
parseTheme: (theme) => {
|
|
1505
|
-
const color = "#000";
|
|
1506
|
-
const gradient = "#000";
|
|
1507
|
-
const shadow = "#000";
|
|
1508
|
-
const mq = "#000";
|
|
1509
|
-
const textStyle = "#000";
|
|
1510
|
-
const breakpoints = "#000";
|
|
1511
|
-
const fontFamily = "#000";
|
|
1512
|
-
|
|
1513
|
-
const returnObject = {
|
|
1514
|
-
...theme,
|
|
1515
|
-
fontFamily,
|
|
1516
|
-
color,
|
|
1517
|
-
colors: color,
|
|
1518
|
-
gradient,
|
|
1519
|
-
shadow,
|
|
1520
|
-
mq,
|
|
1521
|
-
textStyle,
|
|
1522
|
-
breakpoints,
|
|
1523
|
-
fontSizes: "#000",
|
|
1524
|
-
negateSpacing: "#000",
|
|
1525
|
-
halfSpacing: "#000",
|
|
1526
|
-
negateHalfSpacing: "#000",
|
|
1527
|
-
};
|
|
1528
|
-
return returnObject;
|
|
1529
|
-
},
|
|
1530
1504
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.71.0",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
"find-up": "^5.0.0",
|
|
95
95
|
"fs-extra": "7.0.1",
|
|
96
96
|
"html-to-draftjs": "^1.5.0",
|
|
97
|
+
"html-to-image": "^1.9.0",
|
|
97
98
|
"html-webpack-plugin": "4.5.0",
|
|
98
99
|
"identity-obj-proxy": "3.0.0",
|
|
99
100
|
"ignore-loader": "^0.1.2",
|
|
@@ -133,7 +134,7 @@
|
|
|
133
134
|
"redux": "4.0.4",
|
|
134
135
|
"redux-devtools-extension": "2.13.8",
|
|
135
136
|
"redux-persist": "6.0.0",
|
|
136
|
-
"redux-thunk": "2.
|
|
137
|
+
"redux-thunk": "^2.4.1",
|
|
137
138
|
"reflect-metadata": "0.1.13",
|
|
138
139
|
"resolve": "^1.20.0",
|
|
139
140
|
"resolve-url-loader": "^4.0.0",
|
|
@@ -225,5 +226,5 @@
|
|
|
225
226
|
"publishConfig": {
|
|
226
227
|
"access": "public"
|
|
227
228
|
},
|
|
228
|
-
"gitHead": "
|
|
229
|
+
"gitHead": "3ccc775d807b8e42ca60b1e5f17ebe92b97e4f59"
|
|
229
230
|
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import 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
|
+
import { mock } from "jest-mock-extended";
|
|
7
|
+
|
|
8
|
+
import { parseTheme } from "@griddo/core";
|
|
9
|
+
|
|
10
|
+
import ElementsTooltip, { IElementsTooltipProps } from "@ax/components/ElementsTooltip";
|
|
11
|
+
import globalTheme from "@ax/themes/theme.json";
|
|
12
|
+
|
|
13
|
+
afterEach(cleanup);
|
|
14
|
+
|
|
15
|
+
const defaultProps = mock<IElementsTooltipProps>();
|
|
16
|
+
|
|
17
|
+
describe("Tooltip component rendering", () => {
|
|
18
|
+
it("should not render the component", () => {
|
|
19
|
+
render(
|
|
20
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
21
|
+
<ElementsTooltip {...defaultProps} />
|
|
22
|
+
</ThemeProvider>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const elementsTooltipWrapper = screen.queryByTestId("elements-wrapper");
|
|
26
|
+
|
|
27
|
+
expect(elementsTooltipWrapper).not.toBeTruthy();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("should render the component with one element visible", () => {
|
|
31
|
+
defaultProps.elements = ["uno", "dos", "tres"];
|
|
32
|
+
defaultProps.colors = { uno: "#fff" };
|
|
33
|
+
defaultProps.rounded = true;
|
|
34
|
+
|
|
35
|
+
render(
|
|
36
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
37
|
+
<ElementsTooltip {...defaultProps} />
|
|
38
|
+
</ThemeProvider>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const elementsWrapper = screen.findByTestId("elements-wrapper");
|
|
42
|
+
const element = screen.queryAllByTestId("element");
|
|
43
|
+
const remainingElements = screen.queryByTestId("remaining-element");
|
|
44
|
+
const divElement = screen.queryAllByTestId("div-element");
|
|
45
|
+
const rowElement = screen.queryAllByTestId("row-element");
|
|
46
|
+
|
|
47
|
+
expect(elementsWrapper).toBeTruthy();
|
|
48
|
+
expect(element).toHaveLength(1);
|
|
49
|
+
expect(remainingElements).toHaveTextContent("+2");
|
|
50
|
+
expect(divElement).toHaveLength(3);
|
|
51
|
+
expect(rowElement).toHaveLength(3);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("should render the component with three elements visibles", () => {
|
|
55
|
+
defaultProps.elements = ["uno", "dos", "tres"];
|
|
56
|
+
defaultProps.defaultElements = 3;
|
|
57
|
+
defaultProps.maxChar = 1;
|
|
58
|
+
|
|
59
|
+
render(
|
|
60
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
61
|
+
<ElementsTooltip {...defaultProps} />
|
|
62
|
+
</ThemeProvider>
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const elementsTooltipWrapper = screen.findByTestId("elements-wrapper");
|
|
66
|
+
const elementTooltip = screen.queryAllByTestId("element");
|
|
67
|
+
const remainingElements = screen.queryByTestId("remaining-element");
|
|
68
|
+
|
|
69
|
+
expect(elementsTooltipWrapper).toBeTruthy();
|
|
70
|
+
expect(elementTooltip).toHaveLength(3);
|
|
71
|
+
expect(remainingElements).toBeNull();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("should render the component with one row", () => {
|
|
75
|
+
defaultProps.elements = ["uno", "dos", "tres"];
|
|
76
|
+
defaultProps.defaultElements = 1;
|
|
77
|
+
defaultProps.elementsPerRow = 3;
|
|
78
|
+
|
|
79
|
+
render(
|
|
80
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
81
|
+
<ElementsTooltip {...defaultProps} />
|
|
82
|
+
</ThemeProvider>
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
const elementsWrapper = screen.findByTestId("elements-wrapper");
|
|
86
|
+
const element = screen.queryAllByTestId("element");
|
|
87
|
+
const remainingElements = screen.queryByTestId("remaining-element");
|
|
88
|
+
const divElement = screen.queryAllByTestId("div-element");
|
|
89
|
+
const rowElement = screen.queryAllByTestId("row-element");
|
|
90
|
+
|
|
91
|
+
expect(elementsWrapper).toBeTruthy();
|
|
92
|
+
expect(element).toHaveLength(1);
|
|
93
|
+
expect(remainingElements).toHaveTextContent("+2");
|
|
94
|
+
expect(divElement).toHaveLength(3);
|
|
95
|
+
expect(rowElement).toHaveLength(1);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
import { ThemeProvider } from "styled-components";
|
|
4
|
+
import { mock } from "jest-mock-extended";
|
|
5
|
+
import { render, screen, cleanup, fireEvent } from "@testing-library/react";
|
|
6
|
+
import { parseTheme } from "@griddo/core";
|
|
7
|
+
import "@testing-library/jest-dom";
|
|
8
|
+
|
|
9
|
+
import EmptyState from "@ax/components/EmptyState";
|
|
10
|
+
import { IEmptyStateProps } from "@ax/types";
|
|
11
|
+
import globalTheme from "@ax/themes/theme.json";
|
|
12
|
+
|
|
13
|
+
afterEach(cleanup);
|
|
14
|
+
|
|
15
|
+
const defaultProps = mock<IEmptyStateProps>();
|
|
16
|
+
|
|
17
|
+
describe("EmptyState component rendering", () => {
|
|
18
|
+
it("should render the component", () => {
|
|
19
|
+
render(
|
|
20
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
21
|
+
<EmptyState {...defaultProps} />
|
|
22
|
+
</ThemeProvider>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const emptyStateWrapper = screen.getByTestId("wrapper");
|
|
26
|
+
expect(emptyStateWrapper).toBeTruthy();
|
|
27
|
+
expect(emptyStateWrapper).toHaveTextContent("Oh! This Looks so empty");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("should render the component with title", () => {
|
|
31
|
+
defaultProps.title = "The title";
|
|
32
|
+
render(
|
|
33
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
34
|
+
<EmptyState {...defaultProps} />
|
|
35
|
+
</ThemeProvider>
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const emptyStateWrapper = screen.getByTestId("wrapper");
|
|
39
|
+
expect(emptyStateWrapper).toBeTruthy();
|
|
40
|
+
expect(emptyStateWrapper).toHaveTextContent("The title");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("should render the component with message", () => {
|
|
44
|
+
defaultProps.message = "A message";
|
|
45
|
+
render(
|
|
46
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
47
|
+
<EmptyState {...defaultProps} />
|
|
48
|
+
</ThemeProvider>
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const emptyStateWrapper = screen.getByTestId("wrapper");
|
|
52
|
+
expect(emptyStateWrapper).toBeTruthy();
|
|
53
|
+
expect(emptyStateWrapper).toHaveTextContent("A message");
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
describe("EmptyState component events", () => {
|
|
58
|
+
it("should trigger the onClick", () => {
|
|
59
|
+
const actionFunc = jest.fn();
|
|
60
|
+
defaultProps.button = "A button";
|
|
61
|
+
defaultProps.action = actionFunc;
|
|
62
|
+
|
|
63
|
+
render(
|
|
64
|
+
<ThemeProvider theme={parseTheme(globalTheme)}>
|
|
65
|
+
<EmptyState {...defaultProps} />
|
|
66
|
+
</ThemeProvider>
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
const emptyStateWrapper = screen.getByTestId("wrapper");
|
|
70
|
+
const buttonComponent = screen.getByTestId("button-line-inverse");
|
|
71
|
+
|
|
72
|
+
expect(emptyStateWrapper).toBeTruthy();
|
|
73
|
+
expect(buttonComponent).toBeTruthy();
|
|
74
|
+
expect(emptyStateWrapper).toHaveTextContent("A button");
|
|
75
|
+
fireEvent.click(buttonComponent);
|
|
76
|
+
expect(actionFunc).toBeCalled();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -188,17 +188,3 @@ describe("PageAnalytics component rendering", () => {
|
|
|
188
188
|
expect(getAllByText(/Select Dimensions/i)).toHaveLength(2);
|
|
189
189
|
});
|
|
190
190
|
});
|
|
191
|
-
|
|
192
|
-
export interface IAnalyticsFieldProps {
|
|
193
|
-
value: IState;
|
|
194
|
-
template: string;
|
|
195
|
-
onChange: (value: IState) => void;
|
|
196
|
-
analytics: IAnalytics;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export interface IState {
|
|
200
|
-
contentSelect: string;
|
|
201
|
-
groupSelect: string;
|
|
202
|
-
dimensionsSelect: string[];
|
|
203
|
-
values: Record<string, string>;
|
|
204
|
-
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "@testing-library/jest-dom";
|
|
3
3
|
import StructuredDataAnalytics from "@ax/components/Fields/AnalyticsField/StructuredDataAnalytics";
|
|
4
|
-
import { IAnalytics } from "@ax/types";
|
|
5
4
|
import { ThemeProvider } from "styled-components";
|
|
6
5
|
import { parseTheme } from "@griddo/core";
|
|
7
6
|
import globalTheme from "@ax/themes/theme.json";
|
|
@@ -130,17 +129,3 @@ describe("StructuredDataAnalytics component rendering", () => {
|
|
|
130
129
|
expect(getByPlaceholderText(/Type a variable/i)).toBeInTheDocument();
|
|
131
130
|
});
|
|
132
131
|
});
|
|
133
|
-
|
|
134
|
-
export interface IAnalyticsFieldProps {
|
|
135
|
-
value: IState;
|
|
136
|
-
template: string;
|
|
137
|
-
onChange: (value: IState) => void;
|
|
138
|
-
analytics: IAnalytics;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export interface IState {
|
|
142
|
-
contentSelect: string;
|
|
143
|
-
groupSelect: string;
|
|
144
|
-
dimensionsSelect: string[];
|
|
145
|
-
values: Record<string, string>;
|
|
146
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import ArrayFieldGroup from "@ax/components/Fields/ArrayFieldGroup";
|
|
2
|
+
import ArrayFieldGroup, { IProps } from "@ax/components/Fields/ArrayFieldGroup";
|
|
3
3
|
import { ThemeProvider } from "styled-components";
|
|
4
4
|
import { parseTheme } from "@griddo/core";
|
|
5
5
|
import globalTheme from "@ax/themes/theme.json";
|
|
@@ -21,7 +21,7 @@ describe("ArrayFieldGroup component rendering", () => {
|
|
|
21
21
|
);
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
expect(screen.getByTestId("
|
|
24
|
+
expect(screen.getByTestId("button-line-inverse")).toBeTruthy();
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
it("should render the component with ArrayFieldInline", async () => {
|
|
@@ -71,7 +71,7 @@ describe("ArrayFieldGroup component rendering", () => {
|
|
|
71
71
|
);
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
expect(screen.getByTestId("
|
|
74
|
+
expect(screen.getByTestId("button-line-inverse")).toBeTruthy();
|
|
75
75
|
expect(screen.getByTestId("arrayFieldInline")).toBeTruthy();
|
|
76
76
|
|
|
77
77
|
const fieldProps2 = {
|
|
@@ -147,7 +147,7 @@ describe("ArrayFieldGroup component rendering", () => {
|
|
|
147
147
|
);
|
|
148
148
|
});
|
|
149
149
|
|
|
150
|
-
expect(screen.getByTestId("
|
|
150
|
+
expect(screen.getByTestId("button-line-inverse")).toBeTruthy();
|
|
151
151
|
expect(screen.getByTestId("arrayFieldItem")).toBeTruthy();
|
|
152
152
|
|
|
153
153
|
const fieldProps2 = {
|
|
@@ -209,8 +209,8 @@ describe("ArrayFieldGroup component events", () => {
|
|
|
209
209
|
);
|
|
210
210
|
});
|
|
211
211
|
|
|
212
|
-
expect(screen.getByTestId("
|
|
213
|
-
fireEvent.click(screen.getByTestId("
|
|
212
|
+
expect(screen.getByTestId("button-line-inverse")).toBeTruthy();
|
|
213
|
+
fireEvent.click(screen.getByTestId("button-line-inverse"));
|
|
214
214
|
expect(onChangeMock).toHaveBeenCalled();
|
|
215
215
|
});
|
|
216
216
|
|
|
@@ -266,12 +266,3 @@ describe("ArrayFieldGroup component events", () => {
|
|
|
266
266
|
expect(onChangeMock).toHaveBeenCalled();
|
|
267
267
|
});
|
|
268
268
|
});
|
|
269
|
-
|
|
270
|
-
interface IProps {
|
|
271
|
-
value: Record<string, unknown>[];
|
|
272
|
-
name: string;
|
|
273
|
-
onChange: (value: Record<string, unknown>[]) => void;
|
|
274
|
-
innerFields: any[];
|
|
275
|
-
divider: { title: string; text: string };
|
|
276
|
-
arrayType: string;
|
|
277
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import axios from "axios";
|
|
3
|
-
import AsyncCheckGroup from "@ax/components/Fields/AsyncCheckGroup";
|
|
3
|
+
import AsyncCheckGroup, { IAsyncCheckGroup } from "@ax/components/Fields/AsyncCheckGroup";
|
|
4
4
|
import { ThemeProvider } from "styled-components";
|
|
5
5
|
import { parseTheme } from "@griddo/core";
|
|
6
6
|
import globalTheme from "@ax/themes/theme.json";
|
|
@@ -94,15 +94,3 @@ describe("AsyncCheckGroup component rendering", () => {
|
|
|
94
94
|
expect(screen.queryByTestId("checkFieldLabel")).not.toBeTruthy();
|
|
95
95
|
});
|
|
96
96
|
});
|
|
97
|
-
|
|
98
|
-
interface IAsyncCheckGroup {
|
|
99
|
-
value: any[];
|
|
100
|
-
site?: ISite | null;
|
|
101
|
-
source: string;
|
|
102
|
-
onChange: (value: any) => void;
|
|
103
|
-
disabled?: boolean;
|
|
104
|
-
error?: boolean;
|
|
105
|
-
handleValidation?: (value: string | any[]) => void;
|
|
106
|
-
validators?: Record<string, unknown>;
|
|
107
|
-
fullHeight?: boolean;
|
|
108
|
-
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import axios from "axios";
|
|
3
3
|
import "@testing-library/jest-dom";
|
|
4
|
-
import AsyncSelect from "@ax/components/Fields/AsyncSelect";
|
|
4
|
+
import AsyncSelect, { IAsyncSelectProps } from "@ax/components/Fields/AsyncSelect";
|
|
5
5
|
import { ThemeProvider } from "styled-components";
|
|
6
6
|
import { parseTheme } from "@griddo/core";
|
|
7
7
|
import globalTheme from "@ax/themes/theme.json";
|
|
@@ -286,21 +286,3 @@ describe("AsyncSelect component events", () => {
|
|
|
286
286
|
expect(screen.getByTestId("asyncSelect")).toHaveTextContent("English test");
|
|
287
287
|
});
|
|
288
288
|
});
|
|
289
|
-
|
|
290
|
-
interface IAsyncSelectProps {
|
|
291
|
-
name: string;
|
|
292
|
-
value: any;
|
|
293
|
-
entity?: string;
|
|
294
|
-
entityId?: string | number;
|
|
295
|
-
error?: boolean;
|
|
296
|
-
disabled?: boolean;
|
|
297
|
-
onChange: (value: string) => void;
|
|
298
|
-
site: ISite;
|
|
299
|
-
lang: string;
|
|
300
|
-
selectedContent: any;
|
|
301
|
-
mandatory?: boolean;
|
|
302
|
-
placeholder?: string;
|
|
303
|
-
filter?: any[];
|
|
304
|
-
options?: any;
|
|
305
|
-
source?: string;
|
|
306
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "@testing-library/jest-dom";
|
|
3
|
-
import ColorPicker from "@ax/components/Fields/ColorPicker";
|
|
3
|
+
import ColorPicker, { IProps } from "@ax/components/Fields/ColorPicker";
|
|
4
4
|
import { ThemeProvider } from "styled-components";
|
|
5
5
|
import { parseTheme } from "@griddo/core";
|
|
6
6
|
import globalTheme from "@ax/themes/theme.json";
|
|
@@ -184,12 +184,3 @@ describe("AsyncSelect events", () => {
|
|
|
184
184
|
expect(handleValidationMock).toBeCalled();
|
|
185
185
|
});
|
|
186
186
|
});
|
|
187
|
-
|
|
188
|
-
export interface IProps {
|
|
189
|
-
value: string;
|
|
190
|
-
error?: boolean;
|
|
191
|
-
colors?: string[] | Record<string, unknown>[];
|
|
192
|
-
onChange: (newColor: string) => void;
|
|
193
|
-
handleValidation?: (value: string, validators: Record<string, unknown>) => void;
|
|
194
|
-
theme: string;
|
|
195
|
-
}
|
|
@@ -5,6 +5,7 @@ import { parseTheme } from "@griddo/core";
|
|
|
5
5
|
import globalTheme from "@ax/themes/theme.json";
|
|
6
6
|
import { IModule } from "@ax/types";
|
|
7
7
|
import { ISameComponentArrayProps } from "@ax/components/Fields/ComponentArray/SameComponentArray";
|
|
8
|
+
import { IMixableComponentArrayProps } from "@ax/components/Fields/ComponentArray/MixableComponentArray";
|
|
8
9
|
import { render, screen, cleanup } from "@testing-library/react";
|
|
9
10
|
import { mock } from "jest-mock-extended";
|
|
10
11
|
|
|
@@ -160,25 +161,3 @@ describe("ComponentArraySelector component rendering", () => {
|
|
|
160
161
|
expect(screen.getAllByTestId("sameComponentWrapper")).toBeTruthy();
|
|
161
162
|
});
|
|
162
163
|
});
|
|
163
|
-
|
|
164
|
-
export interface IMixableComponentArrayProps {
|
|
165
|
-
maxItems: number;
|
|
166
|
-
title: string;
|
|
167
|
-
whiteList: any[];
|
|
168
|
-
value: IModule[];
|
|
169
|
-
selectedContent: any;
|
|
170
|
-
editorID: number;
|
|
171
|
-
goTo: (editorID: string) => void;
|
|
172
|
-
actions: any;
|
|
173
|
-
categories?: any;
|
|
174
|
-
disabled?: boolean;
|
|
175
|
-
activatedModules: string[];
|
|
176
|
-
objKey: string;
|
|
177
|
-
field: any;
|
|
178
|
-
mandatory?: boolean;
|
|
179
|
-
theme: string;
|
|
180
|
-
moduleCopy: { date: string; element: Record<string, any> } | null;
|
|
181
|
-
availableDataPacks: Record<string, any>[];
|
|
182
|
-
template: any;
|
|
183
|
-
setHistoryPush?: (path: string, isEditor: boolean) => void;
|
|
184
|
-
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import MixableComponentArray
|
|
2
|
+
import MixableComponentArray, {
|
|
3
|
+
IMixableComponentArrayProps,
|
|
4
|
+
} from "@ax/components/Fields/ComponentArray/MixableComponentArray";
|
|
3
5
|
import { ThemeProvider } from "styled-components";
|
|
4
6
|
import { parseTheme } from "@griddo/core";
|
|
5
7
|
import globalTheme from "@ax/themes/theme.json";
|
|
@@ -232,7 +234,7 @@ describe("ComponentArraySelector component rendering", () => {
|
|
|
232
234
|
</ThemeProvider>
|
|
233
235
|
);
|
|
234
236
|
|
|
235
|
-
expect(screen.getAllByTestId("
|
|
237
|
+
expect(screen.getAllByTestId("tooltip-component")).toBeTruthy();
|
|
236
238
|
});
|
|
237
239
|
});
|
|
238
240
|
|
|
@@ -291,25 +293,3 @@ describe("ComponentArraySelector component events trigger", () => {
|
|
|
291
293
|
expect(mixableProps.actions.addComponentAction).toBeCalled();
|
|
292
294
|
});
|
|
293
295
|
});
|
|
294
|
-
|
|
295
|
-
export interface IMixableComponentArrayProps {
|
|
296
|
-
maxItems: number;
|
|
297
|
-
title: string;
|
|
298
|
-
whiteList: any[];
|
|
299
|
-
value: IModule[];
|
|
300
|
-
selectedContent: any;
|
|
301
|
-
editorID: number;
|
|
302
|
-
goTo: (editorID: string) => void;
|
|
303
|
-
actions: any;
|
|
304
|
-
categories?: any;
|
|
305
|
-
disabled?: boolean;
|
|
306
|
-
activatedModules: string[];
|
|
307
|
-
objKey: string;
|
|
308
|
-
field: any;
|
|
309
|
-
mandatory?: boolean;
|
|
310
|
-
theme: string;
|
|
311
|
-
moduleCopy: { date: string; element: Record<string, any> } | null;
|
|
312
|
-
availableDataPacks: Record<string, any>[];
|
|
313
|
-
template: any;
|
|
314
|
-
setHistoryPush?: (path: string, isEditor: boolean) => void;
|
|
315
|
-
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import PasteModuleButton
|
|
2
|
+
import PasteModuleButton, {
|
|
3
|
+
IProps,
|
|
4
|
+
} from "@ax/components/Fields/ComponentArray/MixableComponentArray/PasteModuleButton";
|
|
3
5
|
import { ThemeProvider } from "styled-components";
|
|
4
6
|
import { parseTheme } from "@griddo/core";
|
|
5
7
|
import "@testing-library/jest-dom";
|
|
@@ -64,7 +66,7 @@ describe("ComponentArraySelector trigger events", () => {
|
|
|
64
66
|
},
|
|
65
67
|
});
|
|
66
68
|
|
|
67
|
-
expect(screen.getByTestId("
|
|
69
|
+
expect(screen.getByTestId("tooltip-component")).toHaveTextContent("Paste from clipboard");
|
|
68
70
|
});
|
|
69
71
|
|
|
70
72
|
test("should trigger the onClick and resolve promise", async () => {
|
|
@@ -83,7 +85,7 @@ describe("ComponentArraySelector trigger events", () => {
|
|
|
83
85
|
});
|
|
84
86
|
await expect(mockedFunction).toHaveBeenCalled();
|
|
85
87
|
await expect(mockedFunction(1)).resolves.toEqual({});
|
|
86
|
-
expect(screen.getByTestId("
|
|
88
|
+
expect(screen.getByTestId("toast-message")).toHaveTextContent("Module pasted from clipboard");
|
|
87
89
|
});
|
|
88
90
|
|
|
89
91
|
test("should trigger the onClick and resolve promise without error", async () => {
|
|
@@ -102,14 +104,6 @@ describe("ComponentArraySelector trigger events", () => {
|
|
|
102
104
|
});
|
|
103
105
|
await expect(mockedFunction).toHaveBeenCalled();
|
|
104
106
|
await expect(mockedFunction(1)).resolves.toEqual({ error: undefined });
|
|
105
|
-
expect(screen.getByTestId("
|
|
107
|
+
expect(screen.getByTestId("toast-message")).toHaveTextContent("Module pasted from clipboard");
|
|
106
108
|
});
|
|
107
109
|
});
|
|
108
|
-
|
|
109
|
-
interface IProps {
|
|
110
|
-
pasteModule: (editorID: number) => Promise<{ error?: INotification }>;
|
|
111
|
-
setNotification?: (notification: INotification) => void;
|
|
112
|
-
setHistoryPush?: (path: string, isEditor: boolean) => void;
|
|
113
|
-
editorID: number;
|
|
114
|
-
isModuleCopyUnavailable: boolean;
|
|
115
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import SameComponentArray from "@ax/components/Fields/ComponentArray/SameComponentArray";
|
|
2
|
+
import SameComponentArray, { ISameComponentArrayProps } from "@ax/components/Fields/ComponentArray/SameComponentArray";
|
|
3
3
|
import { ThemeProvider } from "styled-components";
|
|
4
4
|
import { parseTheme } from "@griddo/core";
|
|
5
5
|
import globalTheme from "@ax/themes/theme.json";
|
|
@@ -204,22 +204,3 @@ describe("ComponentArraySelector component events trigger", () => {
|
|
|
204
204
|
expect(sameProps.actions.addComponentAction).toBeCalled();
|
|
205
205
|
});
|
|
206
206
|
});
|
|
207
|
-
|
|
208
|
-
export interface ISameComponentArrayProps {
|
|
209
|
-
maxItems: number;
|
|
210
|
-
title: string;
|
|
211
|
-
whiteList: string[];
|
|
212
|
-
value: IModule[];
|
|
213
|
-
elementUniqueSelection: boolean;
|
|
214
|
-
selectedContent: any;
|
|
215
|
-
editorID: number;
|
|
216
|
-
goTo: (editorID: string) => void;
|
|
217
|
-
actions: any;
|
|
218
|
-
categories?: any;
|
|
219
|
-
disabled?: boolean;
|
|
220
|
-
activatedModules: string[];
|
|
221
|
-
objKey: string;
|
|
222
|
-
field: any;
|
|
223
|
-
mandatory?: boolean;
|
|
224
|
-
theme: string;
|
|
225
|
-
}
|