slice-machine-ui 1.18.1-dev-next-release.3 → 1.18.1-dev-next-release.4
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/components/Button/index.tsx +2 -2
- package/components/Changelog/index.tsx +1 -1
- package/components/Changelog/versionDetails/UpdateCommandBox.tsx +1 -1
- package/components/ChangesItems/ChangesItems.tsx +2 -2
- package/components/CustomTypeTable/changesPage.tsx +1 -1
- package/components/DeleteDocumentsDrawer/HardDeleteDocumentsDrawer.tsx +3 -3
- package/components/DeleteDocumentsDrawer/ReferencesErrorDrawer.tsx +3 -3
- package/components/DeleteDocumentsDrawer/SoftDeleteDocumentsDrawer.tsx +3 -3
- package/components/DeleteSliceModal/index.tsx +1 -1
- package/components/FormFields/CheckboxControl.jsx +1 -1
- package/components/Forms/CreateCustomTypeModal/CreateCustomTypeModal.tsx +5 -5
- package/components/Forms/CreateSliceModal/CreateSliceModal.tsx +1 -1
- package/components/Forms/RenameSliceModal/RenameSliceModal.tsx +1 -1
- package/components/Forms/formsValidator.ts +2 -2
- package/components/Grid/index.tsx +1 -1
- package/components/Li/index.tsx +2 -2
- package/components/ListItem/index.tsx +2 -2
- package/components/ListItem/utils.js +1 -1
- package/components/LoginModal/index.tsx +2 -2
- package/components/ModalFormCard/index.tsx +2 -2
- package/components/Navigation/VideoItem.tsx +2 -2
- package/components/Navigation/index.test.tsx +8 -8
- package/components/Navigation/index.tsx +2 -2
- package/components/ReviewModal/ReviewForm.tsx +1 -1
- package/components/ReviewModal/ReviewModal.tsx +4 -4
- package/components/ScreenshotChangesModal/VariationDropZone.tsx +6 -6
- package/components/ScreenshotChangesModal/index.tsx +3 -3
- package/components/ScreenshotPreviewModal/index.tsx +2 -2
- package/components/Simulator/components/Header/index.tsx +1 -1
- package/components/Simulator/components/IframeRenderer/index.tsx +2 -2
- package/components/Simulator/components/SetupModal/index.tsx +1 -1
- package/components/Simulator/components/Toolbar/index.tsx +2 -2
- package/components/Simulator/index.tsx +5 -5
- package/components/Tooltip/TextWithTooltip.tsx +1 -1
- package/lib/builders/CustomTypeBuilder/SliceZone/List.tsx +2 -2
- package/lib/builders/CustomTypeBuilder/SliceZone/SlicesTemplatesModal.tsx +4 -4
- package/lib/builders/CustomTypeBuilder/SliceZone/UpdateSliceZoneModal.tsx +1 -1
- package/lib/builders/CustomTypeBuilder/SliceZone/index.tsx +12 -12
- package/lib/builders/CustomTypeBuilder/TabZone/index.tsx +1 -1
- package/lib/builders/CustomTypeBuilder/index.tsx +1 -1
- package/lib/builders/SliceBuilder/FieldZones/index.tsx +4 -4
- package/lib/builders/SliceBuilder/Header/SimulatorButton/index.tsx +1 -1
- package/lib/builders/SliceBuilder/Header/VariationsPopover/index.tsx +1 -1
- package/lib/builders/SliceBuilder/Header/index.tsx +2 -2
- package/lib/builders/SliceBuilder/index.tsx +2 -2
- package/lib/builders/common/EditModal/Form.jsx +1 -1
- package/lib/builders/common/EditModal/index.jsx +3 -3
- package/lib/builders/common/Zone/Card/components/NewField.tsx +7 -7
- package/lib/builders/common/Zone/index.jsx +2 -2
- package/lib/builders/utils/index.ts +1 -1
- package/lib/forms/defaults.ts +3 -3
- package/lib/forms/fields.ts +3 -3
- package/lib/forms/index.ts +3 -3
- package/lib/models/common/ComponentUI.ts +3 -3
- package/lib/models/common/CustomType/group.ts +2 -2
- package/lib/models/common/CustomType/index.ts +4 -4
- package/lib/models/common/CustomType/tab.ts +7 -7
- package/lib/models/common/ErrorWithStatus.ts +4 -1
- package/lib/models/common/Fields.ts +1 -1
- package/lib/models/common/Group.ts +5 -5
- package/lib/models/common/Library.ts +1 -1
- package/lib/models/common/Manifest.ts +4 -4
- package/lib/models/common/ModelData.ts +6 -6
- package/lib/models/common/ModelStatus/compareCustomTypeModels.ts +1 -1
- package/lib/models/common/ModelStatus/compareSliceModels.ts +4 -4
- package/lib/models/common/ModelStatus/index.ts +5 -5
- package/lib/models/common/Screenshots.ts +1 -1
- package/lib/models/common/Slice.ts +7 -7
- package/lib/models/common/Slices.ts +5 -5
- package/lib/models/common/UserProfile.ts +1 -1
- package/lib/models/common/Variation.ts +6 -6
- package/lib/models/common/normalizers/customType.ts +3 -3
- package/lib/models/common/normalizers/slices.ts +2 -2
- package/lib/models/common/widgets/Boolean/index.ts +2 -2
- package/lib/models/common/widgets/ContentRelationship/Form.tsx +2 -2
- package/lib/models/common/widgets/ContentRelationship/index.ts +2 -2
- package/lib/models/common/widgets/Group/ListItem/index.jsx +3 -3
- package/lib/models/common/widgets/Image/Form.tsx +3 -3
- package/lib/models/common/widgets/StructuredText/Form.tsx +2 -2
- package/lib/models/common/widgets/StructuredText/index.ts +2 -2
- package/lib/utils/index.ts +1 -1
- package/lib/utils/poll.ts +3 -3
- package/lib/utils/shared/customTypes.ts +1 -1
- package/next.config.mjs +3 -3
- package/out/404.html +1 -1
- package/out/_next/static/{cjz0yUXdEAw1xeqGTjS8s → HGF5llOreY_Hv9IuGfW25}/_buildManifest.js +1 -1
- package/out/_next/static/chunks/125-e3857af2068bbedf.js +11 -0
- package/out/_next/static/chunks/pages/{_app-24537d01d860293a.js → _app-925e9450acf20963.js} +12 -12
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/screenshot.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +5 -5
- package/pages/_app.tsx +1 -1
- package/pages/api/embed.js +1 -1
- package/pages/slices.tsx +4 -4
- package/src/apiClient.ts +11 -11
- package/src/components/BaseHoverCard/BaseHoverCard.test.tsx +1 -1
- package/src/components/HoverCard/HoverCard.tsx +1 -1
- package/src/components/SideNav/SideNav.tsx +2 -2
- package/src/components/Table/Table.test.tsx +1 -1
- package/src/components/TextLink/TextLink.tsx +1 -1
- package/src/domain/__tests__/CustomTypeModel.test.ts +19 -19
- package/src/domain/customType.ts +10 -10
- package/src/domain/slice.ts +5 -5
- package/src/features/changes/StatusBadge.tsx +1 -1
- package/src/features/customTypes/EditDropdown.tsx +1 -1
- package/src/features/customTypes/PageTypeOnboarding.tsx +2 -2
- package/src/features/customTypes/__tests__/CustomTypeBuilderPage.test.tsx +7 -7
- package/src/features/customTypes/__tests__/CustomTypesTablePage.test.tsx +24 -22
- package/src/features/customTypes/actions/convertCustomToPageType.ts +3 -3
- package/src/features/customTypes/actions/deleteCustomType.ts +1 -1
- package/src/features/customTypes/actions/renameCustomType.ts +1 -1
- package/src/features/customTypes/customTypesBuilder/CustomTypesBuilderPage.tsx +3 -3
- package/src/features/customTypes/customTypesConfig.ts +3 -3
- package/src/features/customTypes/customTypesTable/CustomTypesTable.tsx +2 -2
- package/src/features/customTypes/customTypesTable/CustomTypesTablePage.tsx +3 -3
- package/src/features/customTypes/customTypesTable/createCustomType.ts +2 -2
- package/src/features/customTypes/customTypesTable/useCustomTypes.ts +7 -7
- package/src/features/labs/labsList/LabsList.tsx +3 -3
- package/src/features/labs/labsList/useLab.tsx +1 -1
- package/src/features/slices/actions/addSlicesToSliceZone.ts +1 -1
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewSliceDialog.tsx +2 -2
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceAsNewVariationDialog.tsx +5 -5
- package/src/features/slices/convertLegacySlice/ConvertLegacySliceButton.tsx +11 -11
- package/src/features/slicesTemplates/useSlicesTemplates.ts +1 -1
- package/src/hooks/useCurrentSlice.tsx +2 -2
- package/src/hooks/useElementSize.ts +1 -1
- package/src/hooks/useModelStatus.ts +13 -10
- package/src/hooks/useRouteChange.tsx +1 -1
- package/src/hooks/useSMTracker.ts +2 -2
- package/src/hooks/useSliceMachineConfig.ts +1 -1
- package/src/hooks/useThrottle.ts +10 -7
- package/src/hooks/useUnSyncChanges.ts +5 -5
- package/src/hooks/useWindowDimensions.ts +1 -1
- package/src/modules/availableCustomTypes/index.ts +19 -19
- package/src/modules/environment/index.ts +6 -6
- package/src/modules/loading/index.ts +3 -3
- package/src/modules/modal/index.ts +2 -2
- package/src/modules/pushChangesSaga/index.ts +7 -7
- package/src/modules/pushChangesSaga/trackPushChangesSuccess.ts +3 -3
- package/src/modules/screenshots/actions.ts +2 -2
- package/src/modules/screenshots/sagas.ts +9 -9
- package/src/modules/selectedCustomType/actions.ts +10 -10
- package/src/modules/selectedCustomType/reducer.ts +26 -26
- package/src/modules/selectedCustomType/sagas.ts +5 -5
- package/src/modules/selectedCustomType/selectors.ts +4 -4
- package/src/modules/selectedCustomType/stateHelpers.ts +1 -1
- package/src/modules/selectedSlice/actions.ts +4 -4
- package/src/modules/selectedSlice/reducer.ts +7 -7
- package/src/modules/selectedSlice/sagas.ts +4 -4
- package/src/modules/selectedSlice/selectors.ts +5 -5
- package/src/modules/simulator/index.ts +20 -17
- package/src/modules/slices/index.ts +18 -18
- package/src/modules/toaster/index.tsx +3 -3
- package/src/modules/toaster/utils.tsx +1 -1
- package/src/modules/useSliceMachineActions.ts +43 -41
- package/src/modules/userContext/index.ts +9 -9
- package/src/redux/store.ts +2 -2
- package/src/theme.ts +1 -1
- package/src/utils/editor.ts +1 -1
- package/src/utils/fieldNameCreator.ts +2 -2
- package/test/__setup__.ts +18 -7
- package/test/__testutils__/createPrismicAuthLoginResponse.ts +1 -1
- package/test/__testutils__/createTestPlugin.ts +1 -1
- package/test/__testutils__/createTestProject.ts +3 -3
- package/test/__testutils__/index.tsx +1 -1
- package/test/__testutils__/mockAWSACLAPI.ts +9 -9
- package/test/__testutils__/mockCustomTypesAPI.ts +16 -16
- package/test/__testutils__/mockPrismicAuthAPI.ts +3 -3
- package/test/__testutils__/mockPrismicUserAPI.ts +4 -4
- package/test/__testutils__/readMSWFormData.ts +3 -3
- package/test/components/CreateCustomTypeModal.test.tsx +1 -1
- package/test/components/LoginModal.test.tsx +2 -2
- package/test/lib/builders/EditModal.test.tsx +5 -5
- package/test/lib/builders/buildersUtils.test.ts +13 -13
- package/test/lib/models/common/CustomType/sliceZone.test.ts +2 -2
- package/test/lib/models/common/ModelStatus.test.ts +1 -1
- package/test/lib/models/common/widgets/index.test.ts +6 -6
- package/test/lib/utils/shared/customTypes.test.ts +1 -1
- package/test/pages/custom-types.test.tsx +7 -7
- package/test/pages/simulator.test.tsx +5 -5
- package/test/pages/slices.test.tsx +4 -4
- package/test/src/hooks/useModelStatus.test.ts +2 -3
- package/test/src/modules/__fixtures__/sliceUtilsFactory.ts +2 -2
- package/test/src/modules/availableCustomTypes/index.test.ts +20 -18
- package/test/src/modules/environment.test.ts +2 -2
- package/test/src/modules/loading.test.ts +1 -1
- package/test/src/modules/modal.test.ts +1 -1
- package/test/src/modules/pushChangesSaga.test.ts +10 -10
- package/test/src/modules/screenshots/sagas.test.ts +5 -5
- package/test/src/modules/selectedCustomType/reducer.test.ts +25 -25
- package/test/src/modules/selectedCustomType/sagas.test.ts +3 -3
- package/test/src/modules/selectedSlice/__testutils__/getRefreshStateCreatorPayloadData.ts +1 -1
- package/test/src/modules/selectedSlice/reducer.test.ts +12 -12
- package/test/src/modules/selectedSlice/sagas.test.ts +6 -6
- package/test/src/modules/simulator.test.ts +10 -10
- package/test/src/modules/slices.test.ts +5 -5
- package/test/src/modules/toaster/utils.test.ts +3 -3
- package/test/src/normalizers/customType.test.ts +5 -5
- package/test/src/utils/fieldNameCreator.test.ts +1 -1
- package/out/_next/static/chunks/125-84464edfe25651eb.js +0 -19
- /package/out/_next/static/{cjz0yUXdEAw1xeqGTjS8s → HGF5llOreY_Hv9IuGfW25}/_ssgManifest.js +0 -0
|
@@ -25,14 +25,16 @@ describe("[Available Custom types module]", () => {
|
|
|
25
25
|
it("should return the initial state if no action", () => {
|
|
26
26
|
// @ts-expect-error TS(2345) FIXME: Argument of type '{}' is not assignable to paramet... Remove this comment to see the full error message
|
|
27
27
|
expect(availableCustomTypesReducer(dummyCustomTypesState, {})).toEqual(
|
|
28
|
-
dummyCustomTypesState
|
|
28
|
+
dummyCustomTypesState,
|
|
29
29
|
);
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
it("should return the initial state if no matching action", () => {
|
|
33
33
|
expect(
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
availableCustomTypesReducer(dummyCustomTypesState, {
|
|
35
|
+
// @ts-expect-error TS(2322) FIXME: Type '"NO.MATCH"' is not assignable to type '"CUST... Remove this comment to see the full error message
|
|
36
|
+
type: "NO.MATCH",
|
|
37
|
+
}),
|
|
36
38
|
).toEqual(dummyCustomTypesState);
|
|
37
39
|
});
|
|
38
40
|
|
|
@@ -47,7 +49,7 @@ describe("[Available Custom types module]", () => {
|
|
|
47
49
|
});
|
|
48
50
|
|
|
49
51
|
expect(
|
|
50
|
-
availableCustomTypesReducer(dummyCustomTypesState, action)
|
|
52
|
+
availableCustomTypesReducer(dummyCustomTypesState, action),
|
|
51
53
|
).toEqual({
|
|
52
54
|
...dummyCustomTypesState,
|
|
53
55
|
about: {
|
|
@@ -75,7 +77,7 @@ describe("[Available Custom types module]", () => {
|
|
|
75
77
|
});
|
|
76
78
|
|
|
77
79
|
expect(
|
|
78
|
-
availableCustomTypesReducer(dummyCustomTypesState, action)
|
|
80
|
+
availableCustomTypesReducer(dummyCustomTypesState, action),
|
|
79
81
|
).toEqual({
|
|
80
82
|
...dummyCustomTypesState,
|
|
81
83
|
[createdCustomType.id]: {
|
|
@@ -167,13 +169,13 @@ describe("[Available Custom types module]", () => {
|
|
|
167
169
|
|
|
168
170
|
const result = availableCustomTypesReducer(
|
|
169
171
|
originalState,
|
|
170
|
-
action
|
|
172
|
+
action,
|
|
171
173
|
) as AvailableCustomTypesStoreType;
|
|
172
174
|
|
|
173
175
|
expect(
|
|
174
176
|
Object.values(result).flatMap((localAndRemote) => {
|
|
175
177
|
return Object.values(localAndRemote);
|
|
176
|
-
})
|
|
178
|
+
}),
|
|
177
179
|
).not.toContain(undefined);
|
|
178
180
|
|
|
179
181
|
expect(result).toEqual({
|
|
@@ -221,26 +223,26 @@ describe("[Available Custom types module]", () => {
|
|
|
221
223
|
actionPayload.id,
|
|
222
224
|
actionPayload.label,
|
|
223
225
|
actionPayload.repeatable,
|
|
224
|
-
actionPayload.format
|
|
225
|
-
)
|
|
226
|
+
actionPayload.format,
|
|
227
|
+
),
|
|
226
228
|
);
|
|
227
229
|
const saga = testSaga(
|
|
228
230
|
createCustomTypeSaga,
|
|
229
|
-
createCustomTypeCreator.request(actionPayload)
|
|
231
|
+
createCustomTypeCreator.request(actionPayload),
|
|
230
232
|
);
|
|
231
233
|
|
|
232
234
|
saga.next().call(saveCustomType, customTypeCreated);
|
|
233
235
|
saga
|
|
234
236
|
.next()
|
|
235
237
|
.put(
|
|
236
|
-
createCustomTypeCreator.success({ newCustomType: customTypeCreated })
|
|
238
|
+
createCustomTypeCreator.success({ newCustomType: customTypeCreated }),
|
|
237
239
|
);
|
|
238
240
|
saga.next().put(modalCloseCreator());
|
|
239
241
|
saga.next().put(
|
|
240
242
|
push({
|
|
241
243
|
pathname: "/custom-types/id",
|
|
242
244
|
query: undefined,
|
|
243
|
-
})
|
|
245
|
+
}),
|
|
244
246
|
);
|
|
245
247
|
saga
|
|
246
248
|
.next()
|
|
@@ -250,9 +252,9 @@ describe("[Available Custom types module]", () => {
|
|
|
250
252
|
}) => {
|
|
251
253
|
expect(action.payload.action.type).toBe("TOASTER/OPEN");
|
|
252
254
|
expect(action.payload.action.payload.type).toBe(
|
|
253
|
-
ToasterType.SUCCESS
|
|
255
|
+
ToasterType.SUCCESS,
|
|
254
256
|
);
|
|
255
|
-
}
|
|
257
|
+
},
|
|
256
258
|
);
|
|
257
259
|
saga.next().isDone();
|
|
258
260
|
});
|
|
@@ -269,12 +271,12 @@ describe("[Available Custom types module]", () => {
|
|
|
269
271
|
actionPayload.id,
|
|
270
272
|
actionPayload.label,
|
|
271
273
|
actionPayload.repeatable,
|
|
272
|
-
actionPayload.format
|
|
273
|
-
)
|
|
274
|
+
actionPayload.format,
|
|
275
|
+
),
|
|
274
276
|
);
|
|
275
277
|
const saga = testSaga(
|
|
276
278
|
createCustomTypeSaga,
|
|
277
|
-
createCustomTypeCreator.request(actionPayload)
|
|
279
|
+
createCustomTypeCreator.request(actionPayload),
|
|
278
280
|
);
|
|
279
281
|
|
|
280
282
|
saga.next().call(saveCustomType, customTypeCreated);
|
|
@@ -282,7 +284,7 @@ describe("[Available Custom types module]", () => {
|
|
|
282
284
|
openToasterCreator({
|
|
283
285
|
content: "Internal Error: Custom type not saved",
|
|
284
286
|
type: ToasterType.ERROR,
|
|
285
|
-
})
|
|
287
|
+
}),
|
|
286
288
|
);
|
|
287
289
|
saga.next().isDone();
|
|
288
290
|
});
|
|
@@ -17,14 +17,14 @@ describe("[Environment module]", () => {
|
|
|
17
17
|
it("should return the initial state if no action", () => {
|
|
18
18
|
// @ts-expect-error TS(2345) FIXME: Argument of type '{}' is not assignable to paramet... Remove this comment to see the full error message
|
|
19
19
|
expect(environmentReducer(dummyEnvironmentState, {})).toEqual(
|
|
20
|
-
dummyEnvironmentState
|
|
20
|
+
dummyEnvironmentState,
|
|
21
21
|
);
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
it("should return the initial state if no matching action", () => {
|
|
25
25
|
expect(
|
|
26
26
|
// @ts-expect-error TS(2322) FIXME: Type '"NO.MATCH"' is not assignable to type '"STAT... Remove this comment to see the full error message
|
|
27
|
-
environmentReducer(dummyEnvironmentState, { type: "NO.MATCH" })
|
|
27
|
+
environmentReducer(dummyEnvironmentState, { type: "NO.MATCH" }),
|
|
28
28
|
).toEqual(dummyEnvironmentState);
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -20,7 +20,7 @@ describe("[Loading module]", () => {
|
|
|
20
20
|
it("should return the initial state if no matching action", () => {
|
|
21
21
|
// @ts-expect-error TS(2322) FIXME: Type '"NO.MATCH"' is not assignable to type '"LOAD... Remove this comment to see the full error message
|
|
22
22
|
expect(loadingReducer(dummyLoadingState, { type: "NO.MATCH" })).toEqual(
|
|
23
|
-
dummyLoadingState
|
|
23
|
+
dummyLoadingState,
|
|
24
24
|
);
|
|
25
25
|
});
|
|
26
26
|
|
|
@@ -18,7 +18,7 @@ describe("[Modal module]", () => {
|
|
|
18
18
|
it("should return the initial state if no matching action", () => {
|
|
19
19
|
// @ts-expect-error TS(2322) FIXME: Type '"NO.MATCH"' is not assignable to type '"MODA... Remove this comment to see the full error message
|
|
20
20
|
expect(modalReducer(undefined, { type: "NO.MATCH" })).toEqual(
|
|
21
|
-
modalInitialState
|
|
21
|
+
modalInitialState,
|
|
22
22
|
);
|
|
23
23
|
});
|
|
24
24
|
|
|
@@ -90,7 +90,7 @@ describe("[pushChanges module]", () => {
|
|
|
90
90
|
beforeEach(() => {
|
|
91
91
|
saga = testSaga(
|
|
92
92
|
changesPushSaga,
|
|
93
|
-
changesPushCreator.request(changesPayload)
|
|
93
|
+
changesPushCreator.request(changesPayload),
|
|
94
94
|
);
|
|
95
95
|
});
|
|
96
96
|
test("Pushes changes when API response is OK display success toaster", async () => {
|
|
@@ -106,7 +106,7 @@ describe("[pushChanges module]", () => {
|
|
|
106
106
|
libraries: dummyServerState.libraries,
|
|
107
107
|
remoteSlices: [],
|
|
108
108
|
clientError: undefined,
|
|
109
|
-
})
|
|
109
|
+
}),
|
|
110
110
|
);
|
|
111
111
|
|
|
112
112
|
saga.next().put(changesPushCreator.success());
|
|
@@ -115,7 +115,7 @@ describe("[pushChanges module]", () => {
|
|
|
115
115
|
openToasterCreator({
|
|
116
116
|
content: "All slices and types have been pushed",
|
|
117
117
|
type: ToasterType.SUCCESS,
|
|
118
|
-
})
|
|
118
|
+
}),
|
|
119
119
|
);
|
|
120
120
|
|
|
121
121
|
saga.next().isDone();
|
|
@@ -169,13 +169,13 @@ describe("[pushChanges module]", () => {
|
|
|
169
169
|
},
|
|
170
170
|
],
|
|
171
171
|
},
|
|
172
|
-
})
|
|
172
|
+
}),
|
|
173
173
|
);
|
|
174
174
|
|
|
175
175
|
saga.next().put(
|
|
176
176
|
modalOpenCreator({
|
|
177
177
|
modalKey: expectedModalKey,
|
|
178
|
-
})
|
|
178
|
+
}),
|
|
179
179
|
);
|
|
180
180
|
|
|
181
181
|
saga.next().isDone();
|
|
@@ -183,7 +183,7 @@ describe("[pushChanges module]", () => {
|
|
|
183
183
|
// Wait for network request to be performed
|
|
184
184
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
185
185
|
expect(SegmentClient.prototype.track).toHaveBeenCalledOnce();
|
|
186
|
-
}
|
|
186
|
+
},
|
|
187
187
|
);
|
|
188
188
|
|
|
189
189
|
test("Displays an error toaster when there is an API error on push", () => {
|
|
@@ -194,7 +194,7 @@ describe("[pushChanges module]", () => {
|
|
|
194
194
|
content:
|
|
195
195
|
"Something went wrong when pushing your changes. Check your terminal logs.",
|
|
196
196
|
type: ToasterType.ERROR,
|
|
197
|
-
})
|
|
197
|
+
}),
|
|
198
198
|
);
|
|
199
199
|
|
|
200
200
|
saga.next().isDone();
|
|
@@ -213,7 +213,7 @@ describe("[pushChanges module]", () => {
|
|
|
213
213
|
.put(modalOpenCreator({ modalKey: ModalKeysEnum.LOGIN }));
|
|
214
214
|
|
|
215
215
|
saga.next().isDone();
|
|
216
|
-
}
|
|
216
|
+
},
|
|
217
217
|
);
|
|
218
218
|
|
|
219
219
|
// TODO: unskip when invalid references are handled
|
|
@@ -246,13 +246,13 @@ describe("[pushChanges module]", () => {
|
|
|
246
246
|
details: {
|
|
247
247
|
customTypes: [{ id: "CT1" }, { id: "CT2" }],
|
|
248
248
|
},
|
|
249
|
-
})
|
|
249
|
+
}),
|
|
250
250
|
);
|
|
251
251
|
|
|
252
252
|
saga.next().put(
|
|
253
253
|
modalOpenCreator({
|
|
254
254
|
modalKey: ModalKeysEnum.REFERENCES_MISSING_DRAWER,
|
|
255
|
-
})
|
|
255
|
+
}),
|
|
256
256
|
);
|
|
257
257
|
|
|
258
258
|
saga.next().isDone();
|
|
@@ -21,7 +21,7 @@ describe("[Selected Slice sagas]", () => {
|
|
|
21
21
|
component: dummySliceState,
|
|
22
22
|
screenDimensions,
|
|
23
23
|
method: "fromSimulator",
|
|
24
|
-
})
|
|
24
|
+
}),
|
|
25
25
|
);
|
|
26
26
|
|
|
27
27
|
saga.next().call(generateSliceScreenshotApiClient, {
|
|
@@ -39,7 +39,7 @@ describe("[Selected Slice sagas]", () => {
|
|
|
39
39
|
openToasterCreator({
|
|
40
40
|
url: "testScreenshotUrl",
|
|
41
41
|
type: ToasterType.SCREENSHOT_CAPTURED,
|
|
42
|
-
})
|
|
42
|
+
}),
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
saga.next().put(
|
|
@@ -49,7 +49,7 @@ describe("[Selected Slice sagas]", () => {
|
|
|
49
49
|
},
|
|
50
50
|
component: dummySliceState,
|
|
51
51
|
variationId: dummyModelVariationID,
|
|
52
|
-
})
|
|
52
|
+
}),
|
|
53
53
|
);
|
|
54
54
|
|
|
55
55
|
saga.next().isDone();
|
|
@@ -67,14 +67,14 @@ describe("[Selected Slice sagas]", () => {
|
|
|
67
67
|
component: dummySliceState,
|
|
68
68
|
screenDimensions,
|
|
69
69
|
method: "fromSimulator",
|
|
70
|
-
})
|
|
70
|
+
}),
|
|
71
71
|
).next();
|
|
72
72
|
|
|
73
73
|
saga.throw(new Error()).put(
|
|
74
74
|
openToasterCreator({
|
|
75
75
|
content: "Internal Error: Screenshot not saved",
|
|
76
76
|
type: ToasterType.ERROR,
|
|
77
|
-
})
|
|
77
|
+
}),
|
|
78
78
|
);
|
|
79
79
|
saga.next().isDone();
|
|
80
80
|
});
|
|
@@ -32,14 +32,14 @@ describe("[Selected Custom type module]", () => {
|
|
|
32
32
|
it("should return the initial state if no action", () => {
|
|
33
33
|
// @ts-expect-error TS(2345) FIXME: Argument of type '{}' is not assignable to paramet... Remove this comment to see the full error message
|
|
34
34
|
expect(selectedCustomTypeReducer(dummyCustomTypesState, {})).toEqual(
|
|
35
|
-
dummyCustomTypesState
|
|
35
|
+
dummyCustomTypesState,
|
|
36
36
|
);
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
it("should return the initial state if no matching action", () => {
|
|
40
40
|
expect(
|
|
41
41
|
// @ts-expect-error TS(2322) FIXME: Type '"NO.MATCH"' is not assignable to type '"CUST... Remove this comment to see the full error message
|
|
42
|
-
selectedCustomTypeReducer(dummyCustomTypesState, { type: "NO.MATCH" })
|
|
42
|
+
selectedCustomTypeReducer(dummyCustomTypesState, { type: "NO.MATCH" }),
|
|
43
43
|
).toEqual(dummyCustomTypesState);
|
|
44
44
|
});
|
|
45
45
|
|
|
@@ -47,8 +47,8 @@ describe("[Selected Custom type module]", () => {
|
|
|
47
47
|
expect(
|
|
48
48
|
selectedCustomTypeReducer(
|
|
49
49
|
dummyCustomTypesState,
|
|
50
|
-
cleanupCustomTypeStoreCreator()
|
|
51
|
-
)
|
|
50
|
+
cleanupCustomTypeStoreCreator(),
|
|
51
|
+
),
|
|
52
52
|
).toEqual(null);
|
|
53
53
|
});
|
|
54
54
|
|
|
@@ -59,8 +59,8 @@ describe("[Selected Custom type module]", () => {
|
|
|
59
59
|
initCustomTypeStoreCreator({
|
|
60
60
|
model: customTypeAsArray,
|
|
61
61
|
remoteModel: undefined,
|
|
62
|
-
})
|
|
63
|
-
)
|
|
62
|
+
}),
|
|
63
|
+
),
|
|
64
64
|
).toEqual({
|
|
65
65
|
model: customTypeAsArray,
|
|
66
66
|
initialModel: customTypeAsArray,
|
|
@@ -74,7 +74,7 @@ describe("[Selected Custom type module]", () => {
|
|
|
74
74
|
dummyCustomTypesState,
|
|
75
75
|
createTabCreator({
|
|
76
76
|
tabId: newTabId,
|
|
77
|
-
})
|
|
77
|
+
}),
|
|
78
78
|
);
|
|
79
79
|
// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
|
|
80
80
|
const tabs = newState.model.tabs;
|
|
@@ -86,7 +86,7 @@ describe("[Selected Custom type module]", () => {
|
|
|
86
86
|
dummyCustomTypesState,
|
|
87
87
|
createTabCreator({
|
|
88
88
|
tabId: newTabId,
|
|
89
|
-
})
|
|
89
|
+
}),
|
|
90
90
|
);
|
|
91
91
|
// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
|
|
92
92
|
const tabs2 = newState2.model.tabs;
|
|
@@ -101,7 +101,7 @@ describe("[Selected Custom type module]", () => {
|
|
|
101
101
|
updateTabCreator({
|
|
102
102
|
newTabId,
|
|
103
103
|
tabId: initialTab.key,
|
|
104
|
-
})
|
|
104
|
+
}),
|
|
105
105
|
);
|
|
106
106
|
// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
|
|
107
107
|
const tabs = newState.model.tabs[0];
|
|
@@ -117,7 +117,7 @@ describe("[Selected Custom type module]", () => {
|
|
|
117
117
|
updateTabCreator({
|
|
118
118
|
newTabId,
|
|
119
119
|
tabId: unknownTabId,
|
|
120
|
-
})
|
|
120
|
+
}),
|
|
121
121
|
);
|
|
122
122
|
|
|
123
123
|
// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
|
|
@@ -126,7 +126,7 @@ describe("[Selected Custom type module]", () => {
|
|
|
126
126
|
|
|
127
127
|
// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
|
|
128
128
|
expect(!!newState.model.tabs.find((e) => e.key === unknownTabId)).toBe(
|
|
129
|
-
false
|
|
129
|
+
false,
|
|
130
130
|
);
|
|
131
131
|
});
|
|
132
132
|
it("should add a field into a custom type given CUSTOM_TYPE/ADD_FIELD action", () => {
|
|
@@ -139,7 +139,7 @@ describe("[Selected Custom type module]", () => {
|
|
|
139
139
|
tabId: initialTab.key,
|
|
140
140
|
fieldId,
|
|
141
141
|
field: widgets.Boolean.create(fieldId),
|
|
142
|
-
})
|
|
142
|
+
}),
|
|
143
143
|
);
|
|
144
144
|
|
|
145
145
|
// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
|
|
@@ -155,12 +155,12 @@ describe("[Selected Custom type module]", () => {
|
|
|
155
155
|
deleteFieldCreator({
|
|
156
156
|
tabId: initialTab.key,
|
|
157
157
|
fieldId: initialTab.value[0].key,
|
|
158
|
-
})
|
|
158
|
+
}),
|
|
159
159
|
);
|
|
160
160
|
|
|
161
161
|
// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
|
|
162
162
|
expect(newState.model.tabs[0].value.length).toEqual(
|
|
163
|
-
initialTab.value.length - 1
|
|
163
|
+
initialTab.value.length - 1,
|
|
164
164
|
);
|
|
165
165
|
});
|
|
166
166
|
it("should reorder fields into a custom type given CUSTOM_TYPE/REORDER_FIELD action", () => {
|
|
@@ -175,7 +175,7 @@ describe("[Selected Custom type module]", () => {
|
|
|
175
175
|
tabId: initialTab.key,
|
|
176
176
|
start: 0,
|
|
177
177
|
end: 1,
|
|
178
|
-
})
|
|
178
|
+
}),
|
|
179
179
|
);
|
|
180
180
|
|
|
181
181
|
// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
|
|
@@ -189,7 +189,7 @@ describe("[Selected Custom type module]", () => {
|
|
|
189
189
|
tabId: initialTab.key,
|
|
190
190
|
start: 0,
|
|
191
191
|
end: 1,
|
|
192
|
-
})
|
|
192
|
+
}),
|
|
193
193
|
);
|
|
194
194
|
|
|
195
195
|
// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
|
|
@@ -203,7 +203,7 @@ describe("[Selected Custom type module]", () => {
|
|
|
203
203
|
tabId: initialTab.key,
|
|
204
204
|
start: 0,
|
|
205
205
|
end: 2,
|
|
206
|
-
})
|
|
206
|
+
}),
|
|
207
207
|
);
|
|
208
208
|
|
|
209
209
|
// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
|
|
@@ -219,7 +219,7 @@ describe("[Selected Custom type module]", () => {
|
|
|
219
219
|
tabId: initialTab.key,
|
|
220
220
|
start: 2,
|
|
221
221
|
end: 0,
|
|
222
|
-
})
|
|
222
|
+
}),
|
|
223
223
|
);
|
|
224
224
|
|
|
225
225
|
// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
|
|
@@ -237,7 +237,7 @@ describe("[Selected Custom type module]", () => {
|
|
|
237
237
|
dummyCustomTypesState,
|
|
238
238
|
createSliceZoneCreator({
|
|
239
239
|
tabId: initialTab.key,
|
|
240
|
-
})
|
|
240
|
+
}),
|
|
241
241
|
);
|
|
242
242
|
|
|
243
243
|
// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
|
|
@@ -260,16 +260,16 @@ describe("[Selected Custom type module]", () => {
|
|
|
260
260
|
previousFieldId: field.key,
|
|
261
261
|
newFieldId: "newKey",
|
|
262
262
|
value: field.value,
|
|
263
|
-
})
|
|
263
|
+
}),
|
|
264
264
|
);
|
|
265
265
|
|
|
266
266
|
// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
|
|
267
267
|
expect(equal(newState.model.tabs[0].value, initialTab.value)).toEqual(
|
|
268
|
-
false
|
|
268
|
+
false,
|
|
269
269
|
);
|
|
270
270
|
// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
|
|
271
271
|
expect(equal(newState.model.tabs[0].value[0].value, field.value)).toEqual(
|
|
272
|
-
true
|
|
272
|
+
true,
|
|
273
273
|
);
|
|
274
274
|
});
|
|
275
275
|
it("should not update the field into a custom type given CUSTOM_TYPE/REPLACE_FIELD action if the field is the same", () => {
|
|
@@ -284,7 +284,7 @@ describe("[Selected Custom type module]", () => {
|
|
|
284
284
|
previousFieldId: field.key,
|
|
285
285
|
newFieldId: field.key,
|
|
286
286
|
value: field.value,
|
|
287
|
-
})
|
|
287
|
+
}),
|
|
288
288
|
);
|
|
289
289
|
|
|
290
290
|
// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
|
|
@@ -311,12 +311,12 @@ describe("[Selected Custom type module]", () => {
|
|
|
311
311
|
placeholder: newPlaceholder,
|
|
312
312
|
},
|
|
313
313
|
},
|
|
314
|
-
})
|
|
314
|
+
}),
|
|
315
315
|
);
|
|
316
316
|
|
|
317
317
|
// @ts-expect-error TS(2531) FIXME: Object is possibly 'null'.
|
|
318
318
|
expect(newState.model.tabs[0].value[0].value.config.placeholder).toEqual(
|
|
319
|
-
newPlaceholder
|
|
319
|
+
newPlaceholder,
|
|
320
320
|
);
|
|
321
321
|
});
|
|
322
322
|
});
|
|
@@ -63,9 +63,9 @@ describe("[Selected Custom type sagas]", () => {
|
|
|
63
63
|
}) => {
|
|
64
64
|
expect(action.payload.action.type).toBe("TOASTER/OPEN");
|
|
65
65
|
expect(action.payload.action.payload.type).toBe(
|
|
66
|
-
ToasterType.SUCCESS
|
|
66
|
+
ToasterType.SUCCESS,
|
|
67
67
|
);
|
|
68
|
-
}
|
|
68
|
+
},
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
saga.next().isDone();
|
|
@@ -81,7 +81,7 @@ describe("[Selected Custom type sagas]", () => {
|
|
|
81
81
|
openToasterCreator({
|
|
82
82
|
content: "Internal Error: Custom type not saved",
|
|
83
83
|
type: ToasterType.ERROR,
|
|
84
|
-
})
|
|
84
|
+
}),
|
|
85
85
|
);
|
|
86
86
|
saga.next().isDone();
|
|
87
87
|
});
|
|
@@ -20,17 +20,17 @@ describe("[Selected Slice module]", () => {
|
|
|
20
20
|
it("should return the initial state if no matching action", () => {
|
|
21
21
|
expect(
|
|
22
22
|
// @ts-expect-error the NO.MATCH is not a valid action type
|
|
23
|
-
selectedSliceReducer(dummySliceState, { type: "NO.MATCH" })
|
|
23
|
+
selectedSliceReducer(dummySliceState, { type: "NO.MATCH" }),
|
|
24
24
|
).toEqual(dummySliceState);
|
|
25
25
|
expect(
|
|
26
26
|
// @ts-expect-error the NO.MATCH is not a valid action type
|
|
27
|
-
selectedSliceReducer(null, { type: "NO.MATCH" })
|
|
27
|
+
selectedSliceReducer(null, { type: "NO.MATCH" }),
|
|
28
28
|
).toEqual(null);
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
it("should update the selected slice state given SELECTED_SLICE/INIT action", () => {
|
|
32
32
|
expect(
|
|
33
|
-
selectedSliceReducer(null, initSliceStoreCreator(dummySliceState))
|
|
33
|
+
selectedSliceReducer(null, initSliceStoreCreator(dummySliceState)),
|
|
34
34
|
).toEqual(dummySliceState);
|
|
35
35
|
});
|
|
36
36
|
it("should update the selected slice state given SLICE/ADD_WIDGET action", () => {
|
|
@@ -55,7 +55,7 @@ describe("[Selected Slice module]", () => {
|
|
|
55
55
|
widgetsArea: WidgetsArea.Primary,
|
|
56
56
|
key: newWidget.key,
|
|
57
57
|
value: newWidget.value,
|
|
58
|
-
})
|
|
58
|
+
}),
|
|
59
59
|
);
|
|
60
60
|
const primaryWidgets = newState?.model.variations[0].primary;
|
|
61
61
|
expect(primaryWidgets?.length).toEqual(primaryWidgetsInit.length + 1);
|
|
@@ -87,13 +87,13 @@ describe("[Selected Slice module]", () => {
|
|
|
87
87
|
previousKey: widgetToReplace.key,
|
|
88
88
|
newKey: updatedWidget.key,
|
|
89
89
|
value: updatedWidget.value,
|
|
90
|
-
})
|
|
90
|
+
}),
|
|
91
91
|
);
|
|
92
92
|
|
|
93
93
|
const primaryWidgets = newState?.model.variations[0].primary;
|
|
94
94
|
expect(primaryWidgets?.length).toEqual(primaryWidgetsInit.length);
|
|
95
95
|
const replacedWidget = primaryWidgets?.find(
|
|
96
|
-
(w) => w.key === updatedWidget.key
|
|
96
|
+
(w) => w.key === updatedWidget.key,
|
|
97
97
|
);
|
|
98
98
|
expect(replacedWidget).toBeTruthy();
|
|
99
99
|
expect(replacedWidget?.value).toBe(updatedWidget.value);
|
|
@@ -110,7 +110,7 @@ describe("[Selected Slice module]", () => {
|
|
|
110
110
|
variationId: dummyModelVariationID,
|
|
111
111
|
widgetsArea: WidgetsArea.Primary,
|
|
112
112
|
key: widgetToDelete.key,
|
|
113
|
-
})
|
|
113
|
+
}),
|
|
114
114
|
);
|
|
115
115
|
|
|
116
116
|
const primaryWidgets = newState?.model.variations[0].primary;
|
|
@@ -125,7 +125,7 @@ describe("[Selected Slice module]", () => {
|
|
|
125
125
|
key: "new-variation",
|
|
126
126
|
name: "New Variation",
|
|
127
127
|
copied: dummySliceState.model.variations[0],
|
|
128
|
-
})
|
|
128
|
+
}),
|
|
129
129
|
);
|
|
130
130
|
|
|
131
131
|
const variations = newState?.model.variations;
|
|
@@ -139,8 +139,8 @@ describe("[Selected Slice module]", () => {
|
|
|
139
139
|
const action = refreshStateCreator(
|
|
140
140
|
getRefreshStateCreatorPayloadData(
|
|
141
141
|
dummySliceState.from,
|
|
142
|
-
dummySliceState.model.id
|
|
143
|
-
)
|
|
142
|
+
dummySliceState.model.id,
|
|
143
|
+
),
|
|
144
144
|
);
|
|
145
145
|
|
|
146
146
|
const newState = selectedSliceReducer(dummySliceState, action);
|
|
@@ -157,8 +157,8 @@ describe("[Selected Slice module]", () => {
|
|
|
157
157
|
const action = refreshStateCreator(
|
|
158
158
|
getRefreshStateCreatorPayloadData(
|
|
159
159
|
"unknown-livrary",
|
|
160
|
-
dummySliceState.model.id
|
|
161
|
-
)
|
|
160
|
+
dummySliceState.model.id,
|
|
161
|
+
),
|
|
162
162
|
);
|
|
163
163
|
|
|
164
164
|
const newState = selectedSliceReducer(dummySliceState, action);
|
|
@@ -29,7 +29,7 @@ describe("[Selected Slice sagas]", () => {
|
|
|
29
29
|
updateSliceCreator.request({
|
|
30
30
|
component: dummySliceState,
|
|
31
31
|
setData: mockSetData,
|
|
32
|
-
})
|
|
32
|
+
}),
|
|
33
33
|
);
|
|
34
34
|
|
|
35
35
|
saga.next().call(updateSliceApiClient, dummySliceState);
|
|
@@ -42,7 +42,7 @@ describe("[Selected Slice sagas]", () => {
|
|
|
42
42
|
saga.next({ errors: [], mocks: [] }).put(
|
|
43
43
|
updateSliceCreator.success({
|
|
44
44
|
component: { ...dummySliceState, mocks: [] },
|
|
45
|
-
})
|
|
45
|
+
}),
|
|
46
46
|
);
|
|
47
47
|
|
|
48
48
|
saga.next().isDone();
|
|
@@ -52,10 +52,10 @@ describe("[Selected Slice sagas]", () => {
|
|
|
52
52
|
expect(mockSetDataCalls?.done).toBe(true);
|
|
53
53
|
expect(mockSetDataCalls?.loading).toBe(false);
|
|
54
54
|
expect(mockSetDataCalls?.message.props.message).toBe(
|
|
55
|
-
"Slice saved successfully at "
|
|
55
|
+
"Slice saved successfully at ",
|
|
56
56
|
);
|
|
57
57
|
expect(mockSetDataCalls?.message.props.path).toBe(
|
|
58
|
-
"slices/libName/DummySlice/model.json"
|
|
58
|
+
"slices/libName/DummySlice/model.json",
|
|
59
59
|
);
|
|
60
60
|
});
|
|
61
61
|
it("should open a error toaster on internal error", () => {
|
|
@@ -65,14 +65,14 @@ describe("[Selected Slice sagas]", () => {
|
|
|
65
65
|
updateSliceCreator.request({
|
|
66
66
|
component: dummySliceState,
|
|
67
67
|
setData: mockSetData,
|
|
68
|
-
})
|
|
68
|
+
}),
|
|
69
69
|
).next();
|
|
70
70
|
|
|
71
71
|
saga.throw(new Error()).put(
|
|
72
72
|
openToasterCreator({
|
|
73
73
|
content: "Internal Error: Models & mocks not generated",
|
|
74
74
|
type: ToasterType.ERROR,
|
|
75
|
-
})
|
|
75
|
+
}),
|
|
76
76
|
);
|
|
77
77
|
saga.next().isDone();
|
|
78
78
|
});
|