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
|
@@ -15,7 +15,7 @@ type MockCustomTypesAPIConfig = {
|
|
|
15
15
|
|
|
16
16
|
export const mockCustomTypesAPI = (
|
|
17
17
|
ctx: TestContext,
|
|
18
|
-
config?: MockCustomTypesAPIConfig
|
|
18
|
+
config?: MockCustomTypesAPIConfig,
|
|
19
19
|
): void => {
|
|
20
20
|
const endpoint = config?.endpoint ?? "https://customtypes.prismic.io";
|
|
21
21
|
|
|
@@ -23,8 +23,8 @@ export const mockCustomTypesAPI = (
|
|
|
23
23
|
ctx.msw.use(
|
|
24
24
|
rest.get(
|
|
25
25
|
new URL("./customtypes", endpoint).toString(),
|
|
26
|
-
config.onCustomTypeGetAll
|
|
27
|
-
)
|
|
26
|
+
config.onCustomTypeGetAll,
|
|
27
|
+
),
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -40,8 +40,8 @@ export const mockCustomTypesAPI = (
|
|
|
40
40
|
} else {
|
|
41
41
|
return res(ctx.status(404));
|
|
42
42
|
}
|
|
43
|
-
}
|
|
44
|
-
)
|
|
43
|
+
},
|
|
44
|
+
),
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -49,8 +49,8 @@ export const mockCustomTypesAPI = (
|
|
|
49
49
|
ctx.msw.use(
|
|
50
50
|
rest.post(
|
|
51
51
|
new URL("./customtypes/insert", endpoint).toString(),
|
|
52
|
-
config.onCustomTypeInsert
|
|
53
|
-
)
|
|
52
|
+
config.onCustomTypeInsert,
|
|
53
|
+
),
|
|
54
54
|
);
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -58,14 +58,14 @@ export const mockCustomTypesAPI = (
|
|
|
58
58
|
ctx.msw.use(
|
|
59
59
|
rest.post(
|
|
60
60
|
new URL("./customtypes/update", endpoint).toString(),
|
|
61
|
-
config.onCustomTypeUpdate
|
|
62
|
-
)
|
|
61
|
+
config.onCustomTypeUpdate,
|
|
62
|
+
),
|
|
63
63
|
);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
if (config?.onSliceGetAll) {
|
|
67
67
|
ctx.msw.use(
|
|
68
|
-
rest.get(new URL("./slices", endpoint).toString(), config.onSliceGetAll)
|
|
68
|
+
rest.get(new URL("./slices", endpoint).toString(), config.onSliceGetAll),
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -81,8 +81,8 @@ export const mockCustomTypesAPI = (
|
|
|
81
81
|
} else {
|
|
82
82
|
return res(ctx.status(404));
|
|
83
83
|
}
|
|
84
|
-
}
|
|
85
|
-
)
|
|
84
|
+
},
|
|
85
|
+
),
|
|
86
86
|
);
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -90,8 +90,8 @@ export const mockCustomTypesAPI = (
|
|
|
90
90
|
ctx.msw.use(
|
|
91
91
|
rest.post(
|
|
92
92
|
new URL("./slices/insert", endpoint).toString(),
|
|
93
|
-
config.onSliceInsert
|
|
94
|
-
)
|
|
93
|
+
config.onSliceInsert,
|
|
94
|
+
),
|
|
95
95
|
);
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -99,8 +99,8 @@ export const mockCustomTypesAPI = (
|
|
|
99
99
|
ctx.msw.use(
|
|
100
100
|
rest.post(
|
|
101
101
|
new URL("./slices/update", endpoint).toString(),
|
|
102
|
-
config.onSliceUpdate
|
|
103
|
-
)
|
|
102
|
+
config.onSliceUpdate,
|
|
103
|
+
),
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
};
|
|
@@ -18,7 +18,7 @@ type MockPrismicUserAPIReturnType = {
|
|
|
18
18
|
|
|
19
19
|
export const mockPrismicAuthAPI = (
|
|
20
20
|
ctx: TestContext,
|
|
21
|
-
config?: MockPrismicAuthAPIConfig
|
|
21
|
+
config?: MockPrismicAuthAPIConfig,
|
|
22
22
|
): MockPrismicUserAPIReturnType => {
|
|
23
23
|
const endpoint = config?.endpoint ?? "https://auth.prismic.io/";
|
|
24
24
|
|
|
@@ -49,8 +49,8 @@ export const mockPrismicAuthAPI = (
|
|
|
49
49
|
} else {
|
|
50
50
|
return res(ctx.status(401));
|
|
51
51
|
}
|
|
52
|
-
}
|
|
53
|
-
)
|
|
52
|
+
},
|
|
53
|
+
),
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
return {
|
|
@@ -37,7 +37,7 @@ type MockPrismicUserAPIReturnType = {
|
|
|
37
37
|
|
|
38
38
|
export const mockPrismicUserAPI = (
|
|
39
39
|
ctx: TestContext,
|
|
40
|
-
config?: MockPrismicUserAPIConfig
|
|
40
|
+
config?: MockPrismicUserAPIConfig,
|
|
41
41
|
): MockPrismicUserAPIReturnType => {
|
|
42
42
|
const endpoint = config?.endpoint ?? "https://user.internal-prismic.io/";
|
|
43
43
|
|
|
@@ -64,7 +64,7 @@ export const mockPrismicUserAPI = (
|
|
|
64
64
|
} else {
|
|
65
65
|
return res(ctx.status(401));
|
|
66
66
|
}
|
|
67
|
-
})
|
|
67
|
+
}),
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -87,8 +87,8 @@ export const mockPrismicUserAPI = (
|
|
|
87
87
|
} else {
|
|
88
88
|
return res(ctx.json({}), ctx.status(401));
|
|
89
89
|
}
|
|
90
|
-
}
|
|
91
|
-
)
|
|
90
|
+
},
|
|
91
|
+
),
|
|
92
92
|
);
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -6,15 +6,15 @@ type FormDataField =
|
|
|
6
6
|
| { data: string };
|
|
7
7
|
|
|
8
8
|
export const readMSWFormData = async (
|
|
9
|
-
req: RestRequest
|
|
9
|
+
req: RestRequest,
|
|
10
10
|
): Promise<Record<string, FormDataField>> => {
|
|
11
11
|
const boundary = parseMultipartFormData.getBoundary(
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
13
|
-
req.headers.get("Content-Type")
|
|
13
|
+
req.headers.get("Content-Type")!,
|
|
14
14
|
);
|
|
15
15
|
const parsedData = parseMultipartFormData.parse(
|
|
16
16
|
Buffer.from(await req.text()),
|
|
17
|
-
boundary
|
|
17
|
+
boundary,
|
|
18
18
|
);
|
|
19
19
|
|
|
20
20
|
const res: Record<string, FormDataField> = {};
|
|
@@ -42,7 +42,7 @@ describe("LoginModal", () => {
|
|
|
42
42
|
expect(result.getByText("Click here").closest("a")).toHaveAttribute(
|
|
43
43
|
"href",
|
|
44
44
|
// Since we're not using the `start-slicemachine` server proxy, port defaults to Next/React Testing Library's default port
|
|
45
|
-
"https://prismic.io/dashboard/cli/login?source=slice-machine&port=3000&path=/api/auth"
|
|
45
|
+
"https://prismic.io/dashboard/cli/login?source=slice-machine&port=3000&path=/api/auth",
|
|
46
46
|
);
|
|
47
47
|
});
|
|
48
48
|
|
|
@@ -61,7 +61,7 @@ describe("LoginModal", () => {
|
|
|
61
61
|
expect(result.getByText("Click here").closest("a")).toHaveAttribute(
|
|
62
62
|
"href",
|
|
63
63
|
// Since we're not using the `start-slicemachine` server proxy, port defaults to Next/React Testing Library's default port
|
|
64
|
-
"https://wroom.io/dashboard/cli/login?source=slice-machine&port=3000&path=/api/auth"
|
|
64
|
+
"https://wroom.io/dashboard/cli/login?source=slice-machine&port=3000&path=/api/auth",
|
|
65
65
|
);
|
|
66
66
|
});
|
|
67
67
|
});
|
|
@@ -42,11 +42,11 @@ describe("EditModal", () => {
|
|
|
42
42
|
data={data}
|
|
43
43
|
fields={fields}
|
|
44
44
|
zoneType="slice"
|
|
45
|
-
|
|
45
|
+
/>,
|
|
46
46
|
);
|
|
47
47
|
|
|
48
48
|
const removeButton = document.querySelector(
|
|
49
|
-
'input[name="config.options.2"]'
|
|
49
|
+
'input[name="config.options.2"]',
|
|
50
50
|
)?.nextSibling;
|
|
51
51
|
|
|
52
52
|
// @ts-expect-error TS(2345) FIXME: Argument of type 'ChildNode | null | undefined' is... Remove this comment to see the full error message
|
|
@@ -97,21 +97,21 @@ describe("EditModal", () => {
|
|
|
97
97
|
data={data}
|
|
98
98
|
fields={fields}
|
|
99
99
|
zoneType="slice"
|
|
100
|
-
|
|
100
|
+
/>,
|
|
101
101
|
);
|
|
102
102
|
|
|
103
103
|
const labelInput = document.querySelector('input[name="config.label"]');
|
|
104
104
|
const fakeLabel = "rich text";
|
|
105
105
|
await act(async () =>
|
|
106
106
|
// @ts-expect-error TS(2345) FIXME: Argument of type 'Element | null' is not assignabl... Remove this comment to see the full error message
|
|
107
|
-
fireEvent.change(labelInput, { target: { value: fakeLabel } })
|
|
107
|
+
fireEvent.change(labelInput, { target: { value: fakeLabel } }),
|
|
108
108
|
);
|
|
109
109
|
|
|
110
110
|
const idInput = document.querySelector('input[name="id"]');
|
|
111
111
|
const fakeId = "some_id";
|
|
112
112
|
await act(async () =>
|
|
113
113
|
// @ts-expect-error TS(2345) FIXME: Argument of type 'Element | null' is not assignabl... Remove this comment to see the full error message
|
|
114
|
-
fireEvent.change(idInput, { target: { value: fakeId } })
|
|
114
|
+
fireEvent.change(idInput, { target: { value: fakeId } }),
|
|
115
115
|
);
|
|
116
116
|
|
|
117
117
|
const saveButton = document.querySelector('button[type="submit"]');
|
|
@@ -17,7 +17,7 @@ describe("utils/findWidgetByConfigOrType", () => {
|
|
|
17
17
|
// @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message
|
|
18
18
|
Widgets,
|
|
19
19
|
dumbConfig,
|
|
20
|
-
"Image"
|
|
20
|
+
"Image",
|
|
21
21
|
);
|
|
22
22
|
expect(widgetFound).toEqual(Widgets.Image);
|
|
23
23
|
});
|
|
@@ -26,7 +26,7 @@ describe("utils/findWidgetByConfigOrType", () => {
|
|
|
26
26
|
// @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message
|
|
27
27
|
Widgets,
|
|
28
28
|
dumbConfig,
|
|
29
|
-
"Color"
|
|
29
|
+
"Color",
|
|
30
30
|
);
|
|
31
31
|
expect(widgetFound).toEqual(Widgets.Color);
|
|
32
32
|
});
|
|
@@ -35,7 +35,7 @@ describe("utils/findWidgetByConfigOrType", () => {
|
|
|
35
35
|
// @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message
|
|
36
36
|
Widgets,
|
|
37
37
|
dumbConfig,
|
|
38
|
-
"UID"
|
|
38
|
+
"UID",
|
|
39
39
|
);
|
|
40
40
|
expect(widgetFound).toEqual(Widgets.UID);
|
|
41
41
|
});
|
|
@@ -44,7 +44,7 @@ describe("utils/findWidgetByConfigOrType", () => {
|
|
|
44
44
|
// @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message
|
|
45
45
|
Widgets,
|
|
46
46
|
dumbConfig,
|
|
47
|
-
"Group"
|
|
47
|
+
"Group",
|
|
48
48
|
);
|
|
49
49
|
expect(widgetFound).toEqual(Widgets.Group);
|
|
50
50
|
});
|
|
@@ -53,7 +53,7 @@ describe("utils/findWidgetByConfigOrType", () => {
|
|
|
53
53
|
// @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message
|
|
54
54
|
Widgets,
|
|
55
55
|
dumbConfig,
|
|
56
|
-
"GeoPoint"
|
|
56
|
+
"GeoPoint",
|
|
57
57
|
);
|
|
58
58
|
expect(widgetFound).toEqual(Widgets.GeoPoint);
|
|
59
59
|
});
|
|
@@ -62,7 +62,7 @@ describe("utils/findWidgetByConfigOrType", () => {
|
|
|
62
62
|
// @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message
|
|
63
63
|
Widgets,
|
|
64
64
|
dumbConfig,
|
|
65
|
-
"Select"
|
|
65
|
+
"Select",
|
|
66
66
|
);
|
|
67
67
|
expect(widgetFound).toEqual(Widgets.Select);
|
|
68
68
|
});
|
|
@@ -71,7 +71,7 @@ describe("utils/findWidgetByConfigOrType", () => {
|
|
|
71
71
|
// @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message
|
|
72
72
|
Widgets,
|
|
73
73
|
dumbConfig,
|
|
74
|
-
"Boolean"
|
|
74
|
+
"Boolean",
|
|
75
75
|
);
|
|
76
76
|
expect(widgetFound).toEqual(Widgets.Boolean);
|
|
77
77
|
});
|
|
@@ -80,7 +80,7 @@ describe("utils/findWidgetByConfigOrType", () => {
|
|
|
80
80
|
// @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message
|
|
81
81
|
Widgets,
|
|
82
82
|
dumbConfig,
|
|
83
|
-
"Date"
|
|
83
|
+
"Date",
|
|
84
84
|
);
|
|
85
85
|
expect(widgetFound).toEqual(Widgets.Date);
|
|
86
86
|
});
|
|
@@ -89,7 +89,7 @@ describe("utils/findWidgetByConfigOrType", () => {
|
|
|
89
89
|
// @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message
|
|
90
90
|
Widgets,
|
|
91
91
|
dumbConfig,
|
|
92
|
-
"Timestamp"
|
|
92
|
+
"Timestamp",
|
|
93
93
|
);
|
|
94
94
|
expect(widgetFound).toEqual(Widgets.Timestamp);
|
|
95
95
|
});
|
|
@@ -98,7 +98,7 @@ describe("utils/findWidgetByConfigOrType", () => {
|
|
|
98
98
|
// @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message
|
|
99
99
|
Widgets,
|
|
100
100
|
dumbConfig,
|
|
101
|
-
"Number"
|
|
101
|
+
"Number",
|
|
102
102
|
);
|
|
103
103
|
expect(widgetFound).toEqual(Widgets.Number);
|
|
104
104
|
});
|
|
@@ -107,7 +107,7 @@ describe("utils/findWidgetByConfigOrType", () => {
|
|
|
107
107
|
// @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message
|
|
108
108
|
Widgets,
|
|
109
109
|
dumbConfig,
|
|
110
|
-
"Link"
|
|
110
|
+
"Link",
|
|
111
111
|
);
|
|
112
112
|
expect(widgetFound).toEqual(Widgets.Link);
|
|
113
113
|
});
|
|
@@ -121,7 +121,7 @@ describe("utils/findWidgetByConfigOrType", () => {
|
|
|
121
121
|
// @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message
|
|
122
122
|
Widgets,
|
|
123
123
|
contentRelationshipConfig,
|
|
124
|
-
"Link"
|
|
124
|
+
"Link",
|
|
125
125
|
);
|
|
126
126
|
expect(widgetFound).toEqual(Widgets.ContentRelationship);
|
|
127
127
|
});
|
|
@@ -135,7 +135,7 @@ describe("utils/findWidgetByConfigOrType", () => {
|
|
|
135
135
|
// @ts-expect-error TS(2345) FIXME: Argument of type 'typeof import("... Remove this comment to see the full error message
|
|
136
136
|
Widgets,
|
|
137
137
|
contentRelationshipConfig,
|
|
138
|
-
"Link"
|
|
138
|
+
"Link",
|
|
139
139
|
);
|
|
140
140
|
expect(widgetFound).toEqual(Widgets.LinkToMedia);
|
|
141
141
|
});
|
|
@@ -19,7 +19,7 @@ describe("Slice Zone", () => {
|
|
|
19
19
|
const result = SliceZone.removeSharedSlice(mockSliceZone, keyToRemove);
|
|
20
20
|
|
|
21
21
|
expect(result.value.map((slice) => slice.key).includes(keyToRemove)).toBe(
|
|
22
|
-
false
|
|
22
|
+
false,
|
|
23
23
|
);
|
|
24
24
|
expect(result.value.length).toEqual(2);
|
|
25
25
|
});
|
|
@@ -41,7 +41,7 @@ describe("Slice Zone", () => {
|
|
|
41
41
|
|
|
42
42
|
expect(result.value.map((slice) => slice.key)).toEqual(
|
|
43
43
|
// @ts-expect-error TS(7006) FIXME: Parameter 'slice' implicitly has an 'any' type.
|
|
44
|
-
mockSliceZone.value.map((slice) => slice.key).concat([newKey])
|
|
44
|
+
mockSliceZone.value.map((slice) => slice.key).concat([newKey]),
|
|
45
45
|
);
|
|
46
46
|
expect(result.value.length).toEqual(4);
|
|
47
47
|
});
|
|
@@ -17,7 +17,7 @@ describe("Model Status", () => {
|
|
|
17
17
|
test("computeModelStatus returns the status Modified", () => {
|
|
18
18
|
const result = computeModelStatus(
|
|
19
19
|
{ local: model, remote: { ...model, name: "modified" } },
|
|
20
|
-
true
|
|
20
|
+
true,
|
|
21
21
|
);
|
|
22
22
|
expect(result.status).toBe(ModelStatus.Modified);
|
|
23
23
|
});
|
|
@@ -20,10 +20,10 @@ describe("Widgets", () => {
|
|
|
20
20
|
type: field?.type,
|
|
21
21
|
config: field?.config,
|
|
22
22
|
},
|
|
23
|
-
{ stripUnknown: true }
|
|
24
|
-
)
|
|
23
|
+
{ stripUnknown: true },
|
|
24
|
+
),
|
|
25
25
|
).toBeTruthy();
|
|
26
|
-
}
|
|
26
|
+
},
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
test.each(widgetEntries)(
|
|
@@ -59,7 +59,7 @@ describe("Widgets", () => {
|
|
|
59
59
|
// compare the two fields to ensure that what slicemachine creates is what is written in the file system.
|
|
60
60
|
expect(field).toBeDefined();
|
|
61
61
|
expect(field).toEqual(fieldExpected);
|
|
62
|
-
}
|
|
62
|
+
},
|
|
63
63
|
);
|
|
64
64
|
|
|
65
65
|
// Issue: https://github.com/prismicio/slice-machine/issues/672
|
|
@@ -78,8 +78,8 @@ describe("Widgets", () => {
|
|
|
78
78
|
},
|
|
79
79
|
},
|
|
80
80
|
},
|
|
81
|
-
{ stripUnknown: true }
|
|
82
|
-
)
|
|
81
|
+
{ stripUnknown: true },
|
|
82
|
+
),
|
|
83
83
|
).toBeTruthy();
|
|
84
84
|
});
|
|
85
85
|
});
|
|
@@ -221,7 +221,7 @@ describe("Custom Type Builder", () => {
|
|
|
221
221
|
nodeVersion: process.versions.node,
|
|
222
222
|
},
|
|
223
223
|
}),
|
|
224
|
-
expect.any(Function)
|
|
224
|
+
expect.any(Function),
|
|
225
225
|
);
|
|
226
226
|
});
|
|
227
227
|
|
|
@@ -326,7 +326,7 @@ describe("Custom Type Builder", () => {
|
|
|
326
326
|
event: "SliceMachine Slicezone Updated",
|
|
327
327
|
properties: { customTypeId, nodeVersion: process.versions.node },
|
|
328
328
|
}),
|
|
329
|
-
expect.any(Function)
|
|
329
|
+
expect.any(Function),
|
|
330
330
|
);
|
|
331
331
|
});
|
|
332
332
|
|
|
@@ -353,7 +353,7 @@ describe("Custom Type Builder", () => {
|
|
|
353
353
|
createSliceMachineManagerMSWHandler({
|
|
354
354
|
url: "http://localhost:3000/_manager",
|
|
355
355
|
sliceMachineManager: manager,
|
|
356
|
-
})
|
|
356
|
+
}),
|
|
357
357
|
);
|
|
358
358
|
|
|
359
359
|
const customTypeId = "a-page";
|
|
@@ -448,7 +448,7 @@ describe("Custom Type Builder", () => {
|
|
|
448
448
|
nodeVersion: process.versions.node,
|
|
449
449
|
},
|
|
450
450
|
}),
|
|
451
|
-
expect.any(Function)
|
|
451
|
+
expect.any(Function),
|
|
452
452
|
);
|
|
453
453
|
|
|
454
454
|
const saveCustomType = screen.getByTestId("builder-save-button");
|
|
@@ -471,7 +471,7 @@ describe("Custom Type Builder", () => {
|
|
|
471
471
|
nodeVersion: process.versions.node,
|
|
472
472
|
},
|
|
473
473
|
}),
|
|
474
|
-
expect.any(Function)
|
|
474
|
+
expect.any(Function),
|
|
475
475
|
);
|
|
476
476
|
});
|
|
477
477
|
});
|
|
@@ -500,7 +500,7 @@ describe("Custom Type Builder", () => {
|
|
|
500
500
|
createSliceMachineManagerMSWHandler({
|
|
501
501
|
url: "http://localhost:3000/_manager",
|
|
502
502
|
sliceMachineManager: manager,
|
|
503
|
-
})
|
|
503
|
+
}),
|
|
504
504
|
);
|
|
505
505
|
|
|
506
506
|
const customTypeId = "a-page";
|
|
@@ -608,7 +608,7 @@ describe("Custom Type Builder", () => {
|
|
|
608
608
|
nodeVersion: process.versions.node,
|
|
609
609
|
},
|
|
610
610
|
}),
|
|
611
|
-
expect.any(Function)
|
|
611
|
+
expect.any(Function),
|
|
612
612
|
);
|
|
613
613
|
|
|
614
614
|
const saveCustomType = screen.getByTestId("builder-save-button");
|
|
@@ -18,7 +18,7 @@ import { createSliceMachineManagerMSWHandler } from "@slicemachine/manager/test"
|
|
|
18
18
|
vi.mock("next/router", () => require("next-router-mock"));
|
|
19
19
|
vi.mock("next/dist/client/router", () => require("next-router-mock"));
|
|
20
20
|
mockRouter.useParser(
|
|
21
|
-
createDynamicRouteParser(["/slices/[lib]/[sliceName]/[variation]/simulator"])
|
|
21
|
+
createDynamicRouteParser(["/slices/[lib]/[sliceName]/[variation]/simulator"]),
|
|
22
22
|
);
|
|
23
23
|
// mock simulator client, it would be nice not to have to do this :/
|
|
24
24
|
vi.mock("@prismicio/simulator", () => {
|
|
@@ -98,7 +98,7 @@ describe.skip("simulator", () => {
|
|
|
98
98
|
createSliceMachineManagerMSWHandler({
|
|
99
99
|
url: "http://localhost:3000/_manager",
|
|
100
100
|
sliceMachineManager: manager,
|
|
101
|
-
})
|
|
101
|
+
}),
|
|
102
102
|
);
|
|
103
103
|
|
|
104
104
|
vi.useFakeTimers();
|
|
@@ -282,7 +282,7 @@ describe.skip("simulator", () => {
|
|
|
282
282
|
});
|
|
283
283
|
|
|
284
284
|
await waitFor(() =>
|
|
285
|
-
expect(SegmentClient.prototype.track).toHaveBeenCalled()
|
|
285
|
+
expect(SegmentClient.prototype.track).toHaveBeenCalled(),
|
|
286
286
|
);
|
|
287
287
|
|
|
288
288
|
expect(SegmentClient.prototype.track).toHaveBeenCalledOnce();
|
|
@@ -293,7 +293,7 @@ describe.skip("simulator", () => {
|
|
|
293
293
|
version: state.environment.changelog.sliceMachine.currentVersion,
|
|
294
294
|
},
|
|
295
295
|
}),
|
|
296
|
-
expect.any(Function)
|
|
296
|
+
expect.any(Function),
|
|
297
297
|
);
|
|
298
298
|
|
|
299
299
|
const button = App.container.querySelector('[data-cy="save-mock"]');
|
|
@@ -328,7 +328,7 @@ describe.skip("simulator", () => {
|
|
|
328
328
|
libraryName: "slices",
|
|
329
329
|
mocks: expectedMock,
|
|
330
330
|
}),
|
|
331
|
-
expect.any(Function)
|
|
331
|
+
expect.any(Function),
|
|
332
332
|
);
|
|
333
333
|
});
|
|
334
334
|
});
|
|
@@ -57,7 +57,7 @@ describe("slices", () => {
|
|
|
57
57
|
createSliceMachineManagerMSWHandler({
|
|
58
58
|
url: "http://localhost:3000/_manager",
|
|
59
59
|
sliceMachineManager: manager,
|
|
60
|
-
})
|
|
60
|
+
}),
|
|
61
61
|
);
|
|
62
62
|
|
|
63
63
|
const environment = {
|
|
@@ -188,7 +188,7 @@ describe("slices", () => {
|
|
|
188
188
|
});
|
|
189
189
|
|
|
190
190
|
await waitFor(() =>
|
|
191
|
-
expect(SegmentClient.prototype.track).toHaveBeenCalled()
|
|
191
|
+
expect(SegmentClient.prototype.track).toHaveBeenCalled(),
|
|
192
192
|
);
|
|
193
193
|
|
|
194
194
|
expect(SegmentClient.prototype.track).toHaveBeenCalledOnce();
|
|
@@ -202,7 +202,7 @@ describe("slices", () => {
|
|
|
202
202
|
nodeVersion: process.versions.node,
|
|
203
203
|
},
|
|
204
204
|
}),
|
|
205
|
-
expect.any(Function)
|
|
205
|
+
expect.any(Function),
|
|
206
206
|
);
|
|
207
207
|
});
|
|
208
208
|
|
|
@@ -233,7 +233,7 @@ describe("slices", () => {
|
|
|
233
233
|
createSliceMachineManagerMSWHandler({
|
|
234
234
|
url: "http://localhost:3000/_manager",
|
|
235
235
|
sliceMachineManager: manager,
|
|
236
|
-
})
|
|
236
|
+
}),
|
|
237
237
|
);
|
|
238
238
|
|
|
239
239
|
const environment = {
|
|
@@ -12,9 +12,8 @@ import { ModelStatus } from "@lib/models/common/ModelStatus";
|
|
|
12
12
|
|
|
13
13
|
const mockSelector = vi.fn();
|
|
14
14
|
vi.mock("react-redux", async () => {
|
|
15
|
-
const actual: typeof import("react-redux") =
|
|
16
|
-
"react-redux"
|
|
17
|
-
);
|
|
15
|
+
const actual: typeof import("react-redux") =
|
|
16
|
+
await vi.importActual("react-redux");
|
|
18
17
|
|
|
19
18
|
return {
|
|
20
19
|
...actual,
|
|
@@ -41,7 +41,7 @@ export const generateSliceSM = (overrides: Partial<SliceSM>): SliceSM => {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
export const generateComponentUI = (
|
|
44
|
-
overrides?: Partial<ComponentUI
|
|
44
|
+
overrides?: Partial<ComponentUI>,
|
|
45
45
|
): ComponentUI => {
|
|
46
46
|
return {
|
|
47
47
|
...DEFAULT_COMPONENT_UI,
|
|
@@ -50,7 +50,7 @@ export const generateComponentUI = (
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
export const generateLibraryUI = (
|
|
53
|
-
overrides?: Partial<LibraryUI
|
|
53
|
+
overrides?: Partial<LibraryUI>,
|
|
54
54
|
): LibraryUI => {
|
|
55
55
|
return {
|
|
56
56
|
...DEFAULT_LIBRARY_UI,
|