@trackunit/react-core-contexts-test 0.1.166 → 0.1.169

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
@@ -114,6 +114,10 @@ const mockAssetSortingContext = {
114
114
  },
115
115
  };
116
116
 
117
+ const mockConfirmationDialogContext = {
118
+ confirm: doNothing,
119
+ };
120
+
117
121
  /**
118
122
  * Mocks the current user context
119
123
  *
@@ -283,6 +287,7 @@ class TrackunitProvidersMockBuilder {
283
287
  this.selectedApolloMocks = [];
284
288
  this.selectedRouterProps = {};
285
289
  this.selectedToastContext = mockToastContext;
290
+ this.selectedConfirmationDialogContext = mockConfirmationDialogContext;
286
291
  this.selectedAssetSortingContext = mockAssetSortingContext;
287
292
  this.selectedCurrentUserContext = mockCurrentUserContext;
288
293
  this.selectedCurrentUserPreferenceContext = mockCurrentUserPreferenceContext;
@@ -560,6 +565,13 @@ class TrackunitProvidersMockBuilder {
560
565
  this.selectedToastContext = Object.assign(Object.assign({}, mockToastContext), toastContext);
561
566
  return this;
562
567
  }
568
+ /**
569
+ * confirmationDialog
570
+ */
571
+ confirmationDialog(confirmationDialog) {
572
+ this.selectedConfirmationDialogContext = Object.assign(Object.assign({}, mockConfirmationDialogContext), confirmationDialog);
573
+ return this;
574
+ }
563
575
  /**
564
576
  * Use this token.
565
577
  *
@@ -654,10 +666,10 @@ class TrackunitProvidersMockBuilder {
654
666
  * @param addTestRootContainer - if you want to add a root container to the test.
655
667
  */
656
668
  getMockedCompositionRoot(testChildren, addTestRootContainer = true, forceDebugging = false) {
657
- return (jsxRuntime.jsx(reactCoreHooks.EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsxRuntime.jsx(reactRouterDom.MemoryRouter, Object.assign({}, this.selectedRouterProps, { children: 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.FilterBarProvider, { value: { filterBarValues: this.selectedFilterBarValues }, children: jsxRuntime.jsx(reactCoreHooks.AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsxRuntime.jsx(ApolloMockedProviderWithError, { mocks: this.selectedApolloMocks, addTypename: false, forceDebugging: forceDebugging, children: jsxRuntime.jsx(reactCoreHooks.NavigationContextProvider, { value: this.selectedNavigationContext, children: jsxRuntime.jsx(reactCoreHooks.CurrentUserPreferenceProvider, { value: this.selectedCurrentUserPreferenceContext, children: addTestRootContainer ? (jsxRuntime.jsx("div", { style: {
658
- "--tw-scale-x": "0.99",
659
- "--tw-scale-y": "0.99",
660
- }, className: "inline-block h-[1000px] w-[1024px]", "data-testid": "testRoot", children: testChildren })) : (jsxRuntime.jsx("div", { children: testChildren })) }) }) }) }) }) }) }) }) }) }) }) })) }));
669
+ return (jsxRuntime.jsx(reactCoreHooks.EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsxRuntime.jsx(reactRouterDom.MemoryRouter, Object.assign({}, this.selectedRouterProps, { children: 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, { mocks: this.selectedApolloMocks, addTypename: false, forceDebugging: forceDebugging, children: jsxRuntime.jsx(reactCoreHooks.NavigationContextProvider, { value: this.selectedNavigationContext, children: jsxRuntime.jsx(reactCoreHooks.CurrentUserPreferenceProvider, { value: this.selectedCurrentUserPreferenceContext, children: addTestRootContainer ? (jsxRuntime.jsx("div", { style: {
670
+ "--tw-scale-x": "0.99",
671
+ "--tw-scale-y": "0.99",
672
+ }, className: "inline-block h-[1000px] w-[1024px]", "data-testid": "testRoot", children: testChildren })) : (jsxRuntime.jsx("div", { children: testChildren })) }) }) }) }) }) }) }) }) }) }) }) }) })) }));
661
673
  }
662
674
  /**
663
675
  * This will return the mocked composition root.
package/index.esm2.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { act, render } from '@testing-library/react';
3
- import { EnvironmentContextProvider, CurrentUserProvider, AnalyticsContext, UserSubscriptionProvider, OemBrandingContextProvider, TokenProvider, ToastProvider, FilterBarProvider, AssetSortingProvider, NavigationContextProvider, CurrentUserPreferenceProvider } from '@trackunit/react-core-hooks';
3
+ import { EnvironmentContextProvider, CurrentUserProvider, AnalyticsContext, UserSubscriptionProvider, OemBrandingContextProvider, TokenProvider, ToastProvider, ConfirmationDialogProvider, FilterBarProvider, AssetSortingProvider, NavigationContextProvider, CurrentUserPreferenceProvider } from '@trackunit/react-core-hooks';
4
4
  import omit from 'lodash/omit';
5
5
  import { MemoryRouter } from 'react-router-dom';
6
6
  import { ApolloLink } from '@apollo/client';
@@ -107,6 +107,10 @@ const mockAssetSortingContext = {
107
107
  },
108
108
  };
109
109
 
110
+ const mockConfirmationDialogContext = {
111
+ confirm: doNothing,
112
+ };
113
+
110
114
  /**
111
115
  * Mocks the current user context
112
116
  *
@@ -276,6 +280,7 @@ class TrackunitProvidersMockBuilder {
276
280
  this.selectedApolloMocks = [];
277
281
  this.selectedRouterProps = {};
278
282
  this.selectedToastContext = mockToastContext;
283
+ this.selectedConfirmationDialogContext = mockConfirmationDialogContext;
279
284
  this.selectedAssetSortingContext = mockAssetSortingContext;
280
285
  this.selectedCurrentUserContext = mockCurrentUserContext;
281
286
  this.selectedCurrentUserPreferenceContext = mockCurrentUserPreferenceContext;
@@ -553,6 +558,13 @@ class TrackunitProvidersMockBuilder {
553
558
  this.selectedToastContext = Object.assign(Object.assign({}, mockToastContext), toastContext);
554
559
  return this;
555
560
  }
561
+ /**
562
+ * confirmationDialog
563
+ */
564
+ confirmationDialog(confirmationDialog) {
565
+ this.selectedConfirmationDialogContext = Object.assign(Object.assign({}, mockConfirmationDialogContext), confirmationDialog);
566
+ return this;
567
+ }
556
568
  /**
557
569
  * Use this token.
558
570
  *
@@ -647,10 +659,10 @@ class TrackunitProvidersMockBuilder {
647
659
  * @param addTestRootContainer - if you want to add a root container to the test.
648
660
  */
649
661
  getMockedCompositionRoot(testChildren, addTestRootContainer = true, forceDebugging = false) {
650
- return (jsx(EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsx(MemoryRouter, Object.assign({}, this.selectedRouterProps, { 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(FilterBarProvider, { value: { filterBarValues: this.selectedFilterBarValues }, children: jsx(AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsx(ApolloMockedProviderWithError, { mocks: this.selectedApolloMocks, addTypename: false, forceDebugging: forceDebugging, children: jsx(NavigationContextProvider, { value: this.selectedNavigationContext, children: jsx(CurrentUserPreferenceProvider, { value: this.selectedCurrentUserPreferenceContext, children: addTestRootContainer ? (jsx("div", { style: {
651
- "--tw-scale-x": "0.99",
652
- "--tw-scale-y": "0.99",
653
- }, className: "inline-block h-[1000px] w-[1024px]", "data-testid": "testRoot", children: testChildren })) : (jsx("div", { children: testChildren })) }) }) }) }) }) }) }) }) }) }) }) })) }));
662
+ return (jsx(EnvironmentContextProvider, { value: this.selectedEnvironmentContext, children: jsx(MemoryRouter, Object.assign({}, this.selectedRouterProps, { 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: { filterBarValues: this.selectedFilterBarValues }, children: jsx(AssetSortingProvider, { value: this.selectedAssetSortingContext, children: jsx(ApolloMockedProviderWithError, { mocks: this.selectedApolloMocks, addTypename: false, forceDebugging: forceDebugging, children: jsx(NavigationContextProvider, { value: this.selectedNavigationContext, children: jsx(CurrentUserPreferenceProvider, { value: this.selectedCurrentUserPreferenceContext, children: addTestRootContainer ? (jsx("div", { style: {
663
+ "--tw-scale-x": "0.99",
664
+ "--tw-scale-y": "0.99",
665
+ }, className: "inline-block h-[1000px] w-[1024px]", "data-testid": "testRoot", children: testChildren })) : (jsx("div", { children: testChildren })) }) }) }) }) }) }) }) }) }) }) }) }) })) }));
654
666
  }
655
667
  /**
656
668
  * This will return the mocked composition root.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-core-contexts-test",
3
- "version": "0.1.166",
3
+ "version": "0.1.169",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -1,6 +1,6 @@
1
1
  import { MockedResponse } from "@apollo/client/testing";
2
2
  import { RenderResult } from "@testing-library/react";
3
- import { FilterBarValues, IAnalyticsContext, IAssetSortingContext, ICurrentUserContext, IEnvironmentContext, INavigationContext, IOemBrandingContext, IToastContext, ITokenContext, IUserPreferencesContext, IUserSubscriptionContext } from "@trackunit/react-core-contexts-api";
3
+ import { ConfirmationDialogContextValue, FilterBarValues, IAnalyticsContext, IAssetSortingContext, ICurrentUserContext, IEnvironmentContext, INavigationContext, IOemBrandingContext, IToastContext, ITokenContext, IUserPreferencesContext, IUserSubscriptionContext } from "@trackunit/react-core-contexts-api";
4
4
  import * as React from "react";
5
5
  import { MemoryRouterProps } from "react-router-dom";
6
6
  /**
@@ -19,6 +19,7 @@ export declare class TrackunitProvidersMockBuilder {
19
19
  protected selectedApolloMocks: MockedResponse[];
20
20
  protected selectedRouterProps: MemoryRouterProps;
21
21
  protected selectedToastContext: IToastContext;
22
+ protected selectedConfirmationDialogContext: ConfirmationDialogContextValue;
22
23
  protected selectedAssetSortingContext: IAssetSortingContext;
23
24
  protected selectedCurrentUserContext: ICurrentUserContext;
24
25
  protected selectedCurrentUserPreferenceContext: IUserPreferencesContext;
@@ -258,6 +259,10 @@ export declare class TrackunitProvidersMockBuilder {
258
259
  * @param toastContext - Override the default toast context.
259
260
  */
260
261
  toast(toastContext: Partial<IToastContext>): this;
262
+ /**
263
+ * confirmationDialog
264
+ */
265
+ confirmationDialog(confirmationDialog: Partial<ConfirmationDialogContextValue>): this;
261
266
  /**
262
267
  * Use this token.
263
268
  *
@@ -0,0 +1,2 @@
1
+ import { ConfirmationDialogContextValue } from "@trackunit/react-core-contexts-api";
2
+ export declare const mockConfirmationDialogContext: ConfirmationDialogContextValue;