@trackunit/react-core-contexts-test 0.1.238 → 0.1.239
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/index.cjs2.js +10 -6
- package/index.esm2.js +10 -6
- package/package.json +1 -1
- package/src/TrackunitProvidersMockBuilder.d.ts +2 -1
package/index.cjs2.js
CHANGED
|
@@ -284,7 +284,7 @@ const RootRouteDebugger = () => {
|
|
|
284
284
|
* @returns React.ReactElement
|
|
285
285
|
*/
|
|
286
286
|
const TestRenderChildren = ({ addTestRootContainer, children }) => {
|
|
287
|
-
return addTestRootContainer ? (jsxRuntime.jsx("div", { className: "inline-block h-[1000px] w-[1024px]", "data-testid": "testRoot", style: {
|
|
287
|
+
return addTestRootContainer ? (jsxRuntime.jsx("div", { className: "inline-block h-[1000px] w-[1024px] scale-[.99]", "data-testid": "testRoot", style: {
|
|
288
288
|
"--tw-scale-x": "0.99",
|
|
289
289
|
"--tw-scale-y": "0.99",
|
|
290
290
|
}, children: children })) : (jsxRuntime.jsx("div", { children: children }));
|
|
@@ -858,8 +858,12 @@ class TrackunitProvidersMockBuilder {
|
|
|
858
858
|
* @param testChildren - the child element being tested.
|
|
859
859
|
* @param addTestRootContainer - if you want to add a root container to the test.
|
|
860
860
|
*/
|
|
861
|
-
getMockedCompositionRoot(testChildren,
|
|
862
|
-
return (jsxRuntime.jsx(reactCoreHooks.CurrentUserProvider, { value: this.selectedCurrentUserContext, children: jsxRuntime.jsx(reactCoreHooks.AnalyticsContext.Provider, { value: this.selectedAnalyticsContext, children: jsxRuntime.jsx(reactCoreHooks.UserSubscriptionProvider, { value: this.selectedUserSubscriptionContext, children: jsxRuntime.jsx(reactCoreHooks.OemBrandingContextProvider, { value: this.selectedOemBrandingContext, children: jsxRuntime.jsx(reactCoreHooks.TokenProvider, { value: this.selectedTokenContext, children: jsxRuntime.jsx(reactCoreHooks.ToastProvider, { value: this.selectedToastContext, children: jsxRuntime.jsx(reactCoreHooks.ConfirmationDialogProvider, { value: this.selectedConfirmationDialogContext, children: jsxRuntime.jsx(reactCoreHooks.FilterBarProvider, { value: { filterBarValues: this.selectedFilterBarValues }, children: jsxRuntime.jsx(reactCoreHooks.AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsxRuntime.jsx(ApolloMockedProviderWithError, { addTypename: false, forceDebugging: forceDebugging, mocks: this.selectedApolloMocks, children: jsxRuntime.jsx(reactCoreHooks.NavigationContextProvider, { value: this.selectedNavigationContext, children: jsxRuntime.jsx(reactCoreHooks.CurrentUserPreferenceProvider, { value: this.selectedCurrentUserPreferenceContext, children: jsxRuntime.jsx(reactCoreHooks.EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsxRuntime.jsx(reactCoreHooks.ModalDialogContextProvider, { value: this.selectedModalDialogContext, children:
|
|
861
|
+
getMockedCompositionRoot(testChildren, forceDebugging = false) {
|
|
862
|
+
return (jsxRuntime.jsx(reactCoreHooks.CurrentUserProvider, { value: this.selectedCurrentUserContext, children: jsxRuntime.jsx(reactCoreHooks.AnalyticsContext.Provider, { value: this.selectedAnalyticsContext, children: jsxRuntime.jsx(reactCoreHooks.UserSubscriptionProvider, { value: this.selectedUserSubscriptionContext, children: jsxRuntime.jsx(reactCoreHooks.OemBrandingContextProvider, { value: this.selectedOemBrandingContext, children: jsxRuntime.jsx(reactCoreHooks.TokenProvider, { value: this.selectedTokenContext, children: jsxRuntime.jsx(reactCoreHooks.ToastProvider, { value: this.selectedToastContext, children: jsxRuntime.jsx(reactCoreHooks.ConfirmationDialogProvider, { value: this.selectedConfirmationDialogContext, children: jsxRuntime.jsx(reactCoreHooks.FilterBarProvider, { value: { filterBarValues: this.selectedFilterBarValues }, children: jsxRuntime.jsx(reactCoreHooks.AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsxRuntime.jsx(ApolloMockedProviderWithError, { addTypename: false, forceDebugging: forceDebugging, mocks: this.selectedApolloMocks, children: jsxRuntime.jsx(reactCoreHooks.NavigationContextProvider, { value: this.selectedNavigationContext, children: jsxRuntime.jsx(reactCoreHooks.CurrentUserPreferenceProvider, { value: this.selectedCurrentUserPreferenceContext, children: jsxRuntime.jsx(reactCoreHooks.EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsxRuntime.jsx(reactCoreHooks.ModalDialogContextProvider, { value: this.selectedModalDialogContext, children: testChildren }) }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
863
|
+
}
|
|
864
|
+
getMockedCompositionRootWithRouter(testChildren, addTestRootContainer = true, forceDebugging = false) {
|
|
865
|
+
const childrenWithRouter = (jsxRuntime.jsx(RouterContainer, { addTestRootContainer: addTestRootContainer, rootRoute: this.selectedRootRoute, selectedRouterProps: this.selectedRouterProps, children: testChildren }));
|
|
866
|
+
return this.getMockedCompositionRoot(childrenWithRouter, forceDebugging);
|
|
863
867
|
}
|
|
864
868
|
/**
|
|
865
869
|
* This will return the mocked composition root.
|
|
@@ -869,7 +873,7 @@ class TrackunitProvidersMockBuilder {
|
|
|
869
873
|
this.validateSuppliedMocks();
|
|
870
874
|
// This ensures correct act loading when using hooks and not loaded if this build is used for storybook
|
|
871
875
|
const hookRenderer = yield Promise.resolve().then(function () { return require('./HookRenderer.cjs.js'); });
|
|
872
|
-
return hookRenderer.reactHooksRenderHook(callback, children => this.
|
|
876
|
+
return hookRenderer.reactHooksRenderHook(callback, children => this.getMockedCompositionRootWithRouter(parentElement ? parentElement(children) : children));
|
|
873
877
|
});
|
|
874
878
|
}
|
|
875
879
|
/**
|
|
@@ -884,7 +888,7 @@ class TrackunitProvidersMockBuilder {
|
|
|
884
888
|
let mountedcomponent;
|
|
885
889
|
yield react$1.act(() => __awaiter(this, void 0, void 0, function* () {
|
|
886
890
|
mountedcomponent = react$1.render(child, {
|
|
887
|
-
wrapper: ({ children }) => this.
|
|
891
|
+
wrapper: ({ children }) => this.getMockedCompositionRootWithRouter(children),
|
|
888
892
|
});
|
|
889
893
|
yield flushPromises();
|
|
890
894
|
}));
|
|
@@ -901,7 +905,7 @@ class TrackunitProvidersMockBuilder {
|
|
|
901
905
|
* This will return the children in the correct mocked hierarchy of context providers.
|
|
902
906
|
*/
|
|
903
907
|
storybook(child) {
|
|
904
|
-
return this.getMockedCompositionRoot(child,
|
|
908
|
+
return this.getMockedCompositionRoot(child, true);
|
|
905
909
|
}
|
|
906
910
|
}
|
|
907
911
|
/**
|
package/index.esm2.js
CHANGED
|
@@ -277,7 +277,7 @@ const RootRouteDebugger = () => {
|
|
|
277
277
|
* @returns React.ReactElement
|
|
278
278
|
*/
|
|
279
279
|
const TestRenderChildren = ({ addTestRootContainer, children }) => {
|
|
280
|
-
return addTestRootContainer ? (jsx("div", { className: "inline-block h-[1000px] w-[1024px]", "data-testid": "testRoot", style: {
|
|
280
|
+
return addTestRootContainer ? (jsx("div", { className: "inline-block h-[1000px] w-[1024px] scale-[.99]", "data-testid": "testRoot", style: {
|
|
281
281
|
"--tw-scale-x": "0.99",
|
|
282
282
|
"--tw-scale-y": "0.99",
|
|
283
283
|
}, children: children })) : (jsx("div", { children: children }));
|
|
@@ -851,8 +851,12 @@ class TrackunitProvidersMockBuilder {
|
|
|
851
851
|
* @param testChildren - the child element being tested.
|
|
852
852
|
* @param addTestRootContainer - if you want to add a root container to the test.
|
|
853
853
|
*/
|
|
854
|
-
getMockedCompositionRoot(testChildren,
|
|
855
|
-
return (jsx(CurrentUserProvider, { value: this.selectedCurrentUserContext, children: jsx(AnalyticsContext.Provider, { value: this.selectedAnalyticsContext, children: jsx(UserSubscriptionProvider, { value: this.selectedUserSubscriptionContext, children: jsx(OemBrandingContextProvider, { value: this.selectedOemBrandingContext, children: jsx(TokenProvider, { value: this.selectedTokenContext, children: jsx(ToastProvider, { value: this.selectedToastContext, children: jsx(ConfirmationDialogProvider, { value: this.selectedConfirmationDialogContext, children: jsx(FilterBarProvider, { value: { filterBarValues: this.selectedFilterBarValues }, children: jsx(AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsx(ApolloMockedProviderWithError, { addTypename: false, forceDebugging: forceDebugging, mocks: this.selectedApolloMocks, children: jsx(NavigationContextProvider, { value: this.selectedNavigationContext, children: jsx(CurrentUserPreferenceProvider, { value: this.selectedCurrentUserPreferenceContext, children: jsx(EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsx(ModalDialogContextProvider, { value: this.selectedModalDialogContext, children:
|
|
854
|
+
getMockedCompositionRoot(testChildren, forceDebugging = false) {
|
|
855
|
+
return (jsx(CurrentUserProvider, { value: this.selectedCurrentUserContext, children: jsx(AnalyticsContext.Provider, { value: this.selectedAnalyticsContext, children: jsx(UserSubscriptionProvider, { value: this.selectedUserSubscriptionContext, children: jsx(OemBrandingContextProvider, { value: this.selectedOemBrandingContext, children: jsx(TokenProvider, { value: this.selectedTokenContext, children: jsx(ToastProvider, { value: this.selectedToastContext, children: jsx(ConfirmationDialogProvider, { value: this.selectedConfirmationDialogContext, children: jsx(FilterBarProvider, { value: { filterBarValues: this.selectedFilterBarValues }, children: jsx(AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsx(ApolloMockedProviderWithError, { addTypename: false, forceDebugging: forceDebugging, mocks: this.selectedApolloMocks, children: jsx(NavigationContextProvider, { value: this.selectedNavigationContext, children: jsx(CurrentUserPreferenceProvider, { value: this.selectedCurrentUserPreferenceContext, children: jsx(EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsx(ModalDialogContextProvider, { value: this.selectedModalDialogContext, children: testChildren }) }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
856
|
+
}
|
|
857
|
+
getMockedCompositionRootWithRouter(testChildren, addTestRootContainer = true, forceDebugging = false) {
|
|
858
|
+
const childrenWithRouter = (jsx(RouterContainer, { addTestRootContainer: addTestRootContainer, rootRoute: this.selectedRootRoute, selectedRouterProps: this.selectedRouterProps, children: testChildren }));
|
|
859
|
+
return this.getMockedCompositionRoot(childrenWithRouter, forceDebugging);
|
|
856
860
|
}
|
|
857
861
|
/**
|
|
858
862
|
* This will return the mocked composition root.
|
|
@@ -862,7 +866,7 @@ class TrackunitProvidersMockBuilder {
|
|
|
862
866
|
this.validateSuppliedMocks();
|
|
863
867
|
// This ensures correct act loading when using hooks and not loaded if this build is used for storybook
|
|
864
868
|
const hookRenderer = yield import('./HookRenderer.esm.js');
|
|
865
|
-
return hookRenderer.reactHooksRenderHook(callback, children => this.
|
|
869
|
+
return hookRenderer.reactHooksRenderHook(callback, children => this.getMockedCompositionRootWithRouter(parentElement ? parentElement(children) : children));
|
|
866
870
|
});
|
|
867
871
|
}
|
|
868
872
|
/**
|
|
@@ -877,7 +881,7 @@ class TrackunitProvidersMockBuilder {
|
|
|
877
881
|
let mountedcomponent;
|
|
878
882
|
yield act(() => __awaiter(this, void 0, void 0, function* () {
|
|
879
883
|
mountedcomponent = render(child, {
|
|
880
|
-
wrapper: ({ children }) => this.
|
|
884
|
+
wrapper: ({ children }) => this.getMockedCompositionRootWithRouter(children),
|
|
881
885
|
});
|
|
882
886
|
yield flushPromises();
|
|
883
887
|
}));
|
|
@@ -894,7 +898,7 @@ class TrackunitProvidersMockBuilder {
|
|
|
894
898
|
* This will return the children in the correct mocked hierarchy of context providers.
|
|
895
899
|
*/
|
|
896
900
|
storybook(child) {
|
|
897
|
-
return this.getMockedCompositionRoot(child,
|
|
901
|
+
return this.getMockedCompositionRoot(child, true);
|
|
898
902
|
}
|
|
899
903
|
}
|
|
900
904
|
/**
|
package/package.json
CHANGED
|
@@ -353,7 +353,8 @@ export declare class TrackunitProvidersMockBuilder<T extends AnyRoute> {
|
|
|
353
353
|
* @param testChildren - the child element being tested.
|
|
354
354
|
* @param addTestRootContainer - if you want to add a root container to the test.
|
|
355
355
|
*/
|
|
356
|
-
protected getMockedCompositionRoot(testChildren: React.ReactNode,
|
|
356
|
+
protected getMockedCompositionRoot(testChildren: React.ReactNode, forceDebugging?: boolean): JSX.Element;
|
|
357
|
+
protected getMockedCompositionRootWithRouter(testChildren: React.ReactNode, addTestRootContainer?: boolean, forceDebugging?: boolean): JSX.Element;
|
|
357
358
|
/**
|
|
358
359
|
* This will return the mocked composition root.
|
|
359
360
|
*/
|