@trackunit/react-core-contexts-test 1.12.65 → 1.13.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/index.cjs2.js
CHANGED
|
@@ -13461,6 +13461,11 @@ const mockErrorHandlerContext = {
|
|
|
13461
13461
|
setTag: sharedUtils.doNothing,
|
|
13462
13462
|
};
|
|
13463
13463
|
|
|
13464
|
+
const mockGeolocationContext = {
|
|
13465
|
+
position: null,
|
|
13466
|
+
getPosition: () => Promise.resolve(null),
|
|
13467
|
+
};
|
|
13468
|
+
|
|
13464
13469
|
const mockModalDialogContext = {
|
|
13465
13470
|
openModal: doNothing,
|
|
13466
13471
|
closeModal: doNothing,
|
|
@@ -13774,6 +13779,7 @@ class TrackunitProvidersMockBuilder {
|
|
|
13774
13779
|
this.selectedOemBrandingContext = mockOemBrandingContext;
|
|
13775
13780
|
this.selectedUserSubscriptionContext = mockUserSubscriptionContext;
|
|
13776
13781
|
this.selectedFilterBarValues = mockFilterBarContext;
|
|
13782
|
+
this.selectedGeolocationContext = mockGeolocationContext;
|
|
13777
13783
|
this.selectedExportDataContext = mockExportDataContextState;
|
|
13778
13784
|
}
|
|
13779
13785
|
/**
|
|
@@ -13951,6 +13957,16 @@ class TrackunitProvidersMockBuilder {
|
|
|
13951
13957
|
this.selectedFilterBarValues = { ...this.selectedFilterBarValues, ...filterBarValues };
|
|
13952
13958
|
return this;
|
|
13953
13959
|
}
|
|
13960
|
+
/**
|
|
13961
|
+
* Use this to pass in a different geolocation context.
|
|
13962
|
+
* Defaults to mockGeolocationContext.
|
|
13963
|
+
*
|
|
13964
|
+
* This context is used by the useGeolocation hook from lib "@trackunit/react-core-hooks"
|
|
13965
|
+
*/
|
|
13966
|
+
geolocation(geolocationContext) {
|
|
13967
|
+
this.selectedGeolocationContext = { ...mockGeolocationContext, ...geolocationContext };
|
|
13968
|
+
return this;
|
|
13969
|
+
}
|
|
13954
13970
|
/**
|
|
13955
13971
|
* Use this to pass in a differerent current user subscription.
|
|
13956
13972
|
* Defaults to mockUserSubscriptionContext.
|
|
@@ -14279,7 +14295,7 @@ class TrackunitProvidersMockBuilder {
|
|
|
14279
14295
|
* @param testChildren - the child element being tested.
|
|
14280
14296
|
*/
|
|
14281
14297
|
getMockedCompositionRoot(testChildren) {
|
|
14282
|
-
return (jsxRuntime.jsx(reactCoreContextsApi.ErrorHandlingContextProvider, { value: this.selectedErrorHandler, children: jsxRuntime.jsx(reactCoreContextsApi.CurrentUserProvider, { value: this.selectedCurrentUserContext, children: jsxRuntime.jsx(reactCoreContextsApi.AnalyticsContext.Provider, { value: this.selectedAnalyticsContext, children: jsxRuntime.jsx(reactCoreContextsApi.UserSubscriptionProvider, { value: this.selectedUserSubscriptionContext, children: jsxRuntime.jsx(reactCoreContextsApi.OemBrandingContextProvider, { value: this.selectedOemBrandingContext, children: jsxRuntime.jsx(reactCoreContextsApi.TokenProvider, { value: this.selectedTokenContext, children: jsxRuntime.jsx(reactCoreContextsApi.ToastProvider, { value: this.selectedToastContext, children: jsxRuntime.jsx(reactCoreContextsApi.ConfirmationDialogProvider, { value: this.selectedConfirmationDialogContext, children: jsxRuntime.jsx(reactCoreContextsApi.FilterBarProvider, { value: this.selectedFilterBarValues, children: jsxRuntime.jsx(reactCoreContextsApi.ExportDataContext.Provider, { value: this.selectedExportDataContext, children: jsxRuntime.jsx(reactCoreContextsApi.AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsxRuntime.jsx(ApolloMockedProviderWithError, { addTypename: false, mocks: this.selectedApolloMocks, children: jsxRuntime.jsx(reactCoreContextsApi.NavigationContextProvider, { value: this.selectedNavigationContext, children: jsxRuntime.jsx(reactCoreContextsApi.CurrentUserPreferenceProvider, { value: this.selectedCurrentUserPreferenceContext, children: jsxRuntime.jsx(reactCoreContextsApi.EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsxRuntime.jsx(reactCoreContextsApi.ModalDialogContextProvider, { value: this.selectedModalDialogContext, children: jsxRuntime.jsx(reactCoreContextsApi.TimeRangeProvider, { value: this.selectedTimeRangeContext, children: jsxRuntime.jsx(reactCoreContextsApi.WidgetConfigProvider, { value: this.selectedWidgetConfigContext, children: testChildren }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
14298
|
+
return (jsxRuntime.jsx(reactCoreContextsApi.ErrorHandlingContextProvider, { value: this.selectedErrorHandler, children: jsxRuntime.jsx(reactCoreContextsApi.CurrentUserProvider, { value: this.selectedCurrentUserContext, children: jsxRuntime.jsx(reactCoreContextsApi.AnalyticsContext.Provider, { value: this.selectedAnalyticsContext, children: jsxRuntime.jsx(reactCoreContextsApi.UserSubscriptionProvider, { value: this.selectedUserSubscriptionContext, children: jsxRuntime.jsx(reactCoreContextsApi.OemBrandingContextProvider, { value: this.selectedOemBrandingContext, children: jsxRuntime.jsx(reactCoreContextsApi.TokenProvider, { value: this.selectedTokenContext, children: jsxRuntime.jsx(reactCoreContextsApi.ToastProvider, { value: this.selectedToastContext, children: jsxRuntime.jsx(reactCoreContextsApi.ConfirmationDialogProvider, { value: this.selectedConfirmationDialogContext, children: jsxRuntime.jsx(reactCoreContextsApi.FilterBarProvider, { value: this.selectedFilterBarValues, children: jsxRuntime.jsx(reactCoreContextsApi.ExportDataContext.Provider, { value: this.selectedExportDataContext, children: jsxRuntime.jsx(reactCoreContextsApi.AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsxRuntime.jsx(ApolloMockedProviderWithError, { addTypename: false, mocks: this.selectedApolloMocks, children: jsxRuntime.jsx(reactCoreContextsApi.NavigationContextProvider, { value: this.selectedNavigationContext, children: jsxRuntime.jsx(reactCoreContextsApi.CurrentUserPreferenceProvider, { value: this.selectedCurrentUserPreferenceContext, children: jsxRuntime.jsx(reactCoreContextsApi.EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsxRuntime.jsx(reactCoreContextsApi.ModalDialogContextProvider, { value: this.selectedModalDialogContext, children: jsxRuntime.jsx(reactCoreContextsApi.TimeRangeProvider, { value: this.selectedTimeRangeContext, children: jsxRuntime.jsx(reactCoreContextsApi.WidgetConfigProvider, { value: this.selectedWidgetConfigContext, children: jsxRuntime.jsx(reactCoreContextsApi.GeolocationProvider, { value: this.selectedGeolocationContext, children: testChildren }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
14283
14299
|
}
|
|
14284
14300
|
getMockedCompositionRootWithRouter(testChildren) {
|
|
14285
14301
|
const childrenWithRouter = (jsxRuntime.jsx(RouterContainer, { addTestRootContainer: true, rootRoute: this.selectedRootRoute, selectedRouterProps: this.selectedRouterProps, children: testChildren }));
|
package/index.esm2.js
CHANGED
|
@@ -5,7 +5,7 @@ import React__default, { createContext, useContext, Children, createElement, isV
|
|
|
5
5
|
import * as DeprecatedReactTestUtils from 'react-dom/test-utils';
|
|
6
6
|
import ReactDOM from 'react-dom';
|
|
7
7
|
import * as ReactDOMClient from 'react-dom/client';
|
|
8
|
-
import { ErrorHandlingContextProvider, CurrentUserProvider, AnalyticsContext, UserSubscriptionProvider, OemBrandingContextProvider, TokenProvider, ToastProvider, ConfirmationDialogProvider, FilterBarProvider, ExportDataContext, AssetSortingProvider, NavigationContextProvider, CurrentUserPreferenceProvider, EnvironmentContextProvider, ModalDialogContextProvider, TimeRangeProvider, WidgetConfigProvider } from '@trackunit/react-core-contexts-api';
|
|
8
|
+
import { ErrorHandlingContextProvider, CurrentUserProvider, AnalyticsContext, UserSubscriptionProvider, OemBrandingContextProvider, TokenProvider, ToastProvider, ConfirmationDialogProvider, FilterBarProvider, ExportDataContext, AssetSortingProvider, NavigationContextProvider, CurrentUserPreferenceProvider, EnvironmentContextProvider, ModalDialogContextProvider, TimeRangeProvider, WidgetConfigProvider, GeolocationProvider } from '@trackunit/react-core-contexts-api';
|
|
9
9
|
import { omit } from 'es-toolkit';
|
|
10
10
|
import { ApolloLink } from '@apollo/client';
|
|
11
11
|
import { loadDevMessages, loadErrorMessages } from '@apollo/client/dev';
|
|
@@ -13439,6 +13439,11 @@ const mockErrorHandlerContext = {
|
|
|
13439
13439
|
setTag: doNothing$1,
|
|
13440
13440
|
};
|
|
13441
13441
|
|
|
13442
|
+
const mockGeolocationContext = {
|
|
13443
|
+
position: null,
|
|
13444
|
+
getPosition: () => Promise.resolve(null),
|
|
13445
|
+
};
|
|
13446
|
+
|
|
13442
13447
|
const mockModalDialogContext = {
|
|
13443
13448
|
openModal: doNothing,
|
|
13444
13449
|
closeModal: doNothing,
|
|
@@ -13752,6 +13757,7 @@ class TrackunitProvidersMockBuilder {
|
|
|
13752
13757
|
this.selectedOemBrandingContext = mockOemBrandingContext;
|
|
13753
13758
|
this.selectedUserSubscriptionContext = mockUserSubscriptionContext;
|
|
13754
13759
|
this.selectedFilterBarValues = mockFilterBarContext;
|
|
13760
|
+
this.selectedGeolocationContext = mockGeolocationContext;
|
|
13755
13761
|
this.selectedExportDataContext = mockExportDataContextState;
|
|
13756
13762
|
}
|
|
13757
13763
|
/**
|
|
@@ -13929,6 +13935,16 @@ class TrackunitProvidersMockBuilder {
|
|
|
13929
13935
|
this.selectedFilterBarValues = { ...this.selectedFilterBarValues, ...filterBarValues };
|
|
13930
13936
|
return this;
|
|
13931
13937
|
}
|
|
13938
|
+
/**
|
|
13939
|
+
* Use this to pass in a different geolocation context.
|
|
13940
|
+
* Defaults to mockGeolocationContext.
|
|
13941
|
+
*
|
|
13942
|
+
* This context is used by the useGeolocation hook from lib "@trackunit/react-core-hooks"
|
|
13943
|
+
*/
|
|
13944
|
+
geolocation(geolocationContext) {
|
|
13945
|
+
this.selectedGeolocationContext = { ...mockGeolocationContext, ...geolocationContext };
|
|
13946
|
+
return this;
|
|
13947
|
+
}
|
|
13932
13948
|
/**
|
|
13933
13949
|
* Use this to pass in a differerent current user subscription.
|
|
13934
13950
|
* Defaults to mockUserSubscriptionContext.
|
|
@@ -14257,7 +14273,7 @@ class TrackunitProvidersMockBuilder {
|
|
|
14257
14273
|
* @param testChildren - the child element being tested.
|
|
14258
14274
|
*/
|
|
14259
14275
|
getMockedCompositionRoot(testChildren) {
|
|
14260
|
-
return (jsx(ErrorHandlingContextProvider, { value: this.selectedErrorHandler, children: 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: this.selectedFilterBarValues, children: jsx(ExportDataContext.Provider, { value: this.selectedExportDataContext, children: jsx(AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsx(ApolloMockedProviderWithError, { addTypename: false, 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: jsx(TimeRangeProvider, { value: this.selectedTimeRangeContext, children: jsx(WidgetConfigProvider, { value: this.selectedWidgetConfigContext, children: testChildren }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
14276
|
+
return (jsx(ErrorHandlingContextProvider, { value: this.selectedErrorHandler, children: 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: this.selectedFilterBarValues, children: jsx(ExportDataContext.Provider, { value: this.selectedExportDataContext, children: jsx(AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsx(ApolloMockedProviderWithError, { addTypename: false, 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: jsx(TimeRangeProvider, { value: this.selectedTimeRangeContext, children: jsx(WidgetConfigProvider, { value: this.selectedWidgetConfigContext, children: jsx(GeolocationProvider, { value: this.selectedGeolocationContext, children: testChildren }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
14261
14277
|
}
|
|
14262
14278
|
getMockedCompositionRootWithRouter(testChildren) {
|
|
14263
14279
|
const childrenWithRouter = (jsx(RouterContainer, { addTestRootContainer: true, rootRoute: this.selectedRootRoute, selectedRouterProps: this.selectedRouterProps, children: testChildren }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-core-contexts-test",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"@trackunit/shared-utils": "1.13.75",
|
|
14
14
|
"graphql": "^16.10.0",
|
|
15
15
|
"@tanstack/router-core": "1.114.29",
|
|
16
|
-
"@trackunit/iris-app-runtime-core-api": "1.
|
|
17
|
-
"@trackunit/react-core-contexts-api": "1.
|
|
16
|
+
"@trackunit/iris-app-runtime-core-api": "1.13.0",
|
|
17
|
+
"@trackunit/react-core-contexts-api": "1.14.0",
|
|
18
18
|
"es-toolkit": "^1.39.10"
|
|
19
19
|
},
|
|
20
20
|
"module": "./index.esm.js",
|
|
@@ -2,7 +2,7 @@ import { MockedResponse } from "@apollo/client/testing";
|
|
|
2
2
|
import { AnyRoute, RegisteredRouter } from "@tanstack/react-router";
|
|
3
3
|
import { RenderResult } from "@testing-library/react";
|
|
4
4
|
import { AnalyticsRuntimeApiSync, AssetSortingState, ConfirmationDialogRuntimeApi, CurrentUserPreferenceState, CurrentUserState, EnvironmentState, ErrorHandlingContextValue, FilterBarContext, ModalDialogRuntimeApi, NavigationRuntimeApi, OemBrandingRuntimeApi, TimeRangeContext, TokenContext, UserSubscription, WidgetConfigContext } from "@trackunit/iris-app-runtime-core-api";
|
|
5
|
-
import { ExportDataContextState, ToastContextValue } from "@trackunit/react-core-contexts-api";
|
|
5
|
+
import { ExportDataContextState, GeolocationContextValue, ToastContextValue } from "@trackunit/react-core-contexts-api";
|
|
6
6
|
import { ReactElement, ReactNode } from "react";
|
|
7
7
|
import { MemoryRouterProps } from "./utils/routingUtils";
|
|
8
8
|
/**
|
|
@@ -34,6 +34,7 @@ export declare class TrackunitProvidersMockBuilder<TRouterTree extends AnyRoute>
|
|
|
34
34
|
protected selectedOemBrandingContext: OemBrandingRuntimeApi;
|
|
35
35
|
protected selectedUserSubscriptionContext: UserSubscription;
|
|
36
36
|
protected selectedFilterBarValues: FilterBarContext;
|
|
37
|
+
protected selectedGeolocationContext: GeolocationContextValue;
|
|
37
38
|
protected selectedExportDataContext: ExportDataContextState;
|
|
38
39
|
/**
|
|
39
40
|
* Use this Analytics Context.
|
|
@@ -182,6 +183,13 @@ export declare class TrackunitProvidersMockBuilder<TRouterTree extends AnyRoute>
|
|
|
182
183
|
* @returns { TrackunitProvidersMockBuilder } - The builder.
|
|
183
184
|
*/
|
|
184
185
|
filterBarValues(filterBarValues: Partial<FilterBarContext>): this;
|
|
186
|
+
/**
|
|
187
|
+
* Use this to pass in a different geolocation context.
|
|
188
|
+
* Defaults to mockGeolocationContext.
|
|
189
|
+
*
|
|
190
|
+
* This context is used by the useGeolocation hook from lib "@trackunit/react-core-hooks"
|
|
191
|
+
*/
|
|
192
|
+
geolocation(geolocationContext: Partial<GeolocationContextValue>): this;
|
|
185
193
|
/**
|
|
186
194
|
* Use this to pass in a differerent current user subscription.
|
|
187
195
|
* Defaults to mockUserSubscriptionContext.
|