@pega/cosmos-react-test-utils 9.0.0-build.9.9 → 9.0.1
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/lib/mocks/highlightMock.d.ts +11 -0
- package/lib/mocks/highlightMock.d.ts.map +1 -0
- package/lib/mocks/highlightMock.js +34 -0
- package/lib/mocks/highlightMock.js.map +1 -0
- package/lib/mocks/iconMock.d.ts +0 -1
- package/lib/mocks/iconMock.js +7 -12
- package/lib/mocks/iconMock.js.map +1 -1
- package/lib/mocks/index.d.ts +1 -0
- package/lib/mocks/index.d.ts.map +1 -1
- package/lib/mocks/index.js +1 -0
- package/lib/mocks/index.js.map +1 -1
- package/lib/utils/utils.d.ts +1 -1
- package/lib/utils/utils.d.ts.map +1 -1
- package/lib/utils/utils.js +3 -2
- package/lib/utils/utils.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface PegaHighlightMocks {
|
|
2
|
+
Highlight: jest.Mock;
|
|
3
|
+
cssHighlightsSet: jest.Mock;
|
|
4
|
+
add: jest.SpiedFunction<Set<AbstractRange>['add']>;
|
|
5
|
+
}
|
|
6
|
+
declare global {
|
|
7
|
+
var pegaHighlightMocks: PegaHighlightMocks | undefined;
|
|
8
|
+
}
|
|
9
|
+
declare const getHighlightMocks: () => PegaHighlightMocks;
|
|
10
|
+
export default getHighlightMocks;
|
|
11
|
+
//# sourceMappingURL=highlightMock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlightMock.d.ts","sourceRoot":"","sources":["../../src/mocks/highlightMock.ts"],"names":[],"mappings":"AAMA,UAAU,kBAAkB;IAC1B,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC;IACrB,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC;IAC5B,GAAG,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;CACpD;AAED,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,CAAC;CACxD;AA6BD,QAAA,MAAM,iBAAiB,0BAOtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// jsdom does not implement the CSS Custom Highlight API. This shim provides a
|
|
2
|
+
// `Highlight` constructor and `CSS.highlights` registry backed by jest spies so
|
|
3
|
+
// hooks/components that rely on `new Highlight()` work in tests AND tests can
|
|
4
|
+
// assert against the API. Spies are exposed via `getHighlightMocks()` from
|
|
5
|
+
// `@pega/cosmos-react-test-utils`.
|
|
6
|
+
if (typeof globalThis.Highlight !== 'function') {
|
|
7
|
+
const instance = new Set();
|
|
8
|
+
const add = jest.spyOn(instance, 'add');
|
|
9
|
+
const Highlight = jest.fn(() => instance);
|
|
10
|
+
Object.defineProperty(globalThis, 'Highlight', {
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: true,
|
|
13
|
+
value: Highlight
|
|
14
|
+
});
|
|
15
|
+
const cssHighlightsSet = jest.fn();
|
|
16
|
+
Object.defineProperty(CSS, 'highlights', {
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true,
|
|
19
|
+
value: { set: cssHighlightsSet }
|
|
20
|
+
});
|
|
21
|
+
globalThis.pegaHighlightMocks = {
|
|
22
|
+
Highlight,
|
|
23
|
+
cssHighlightsSet,
|
|
24
|
+
add
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const getHighlightMocks = () => {
|
|
28
|
+
if (!globalThis.pegaHighlightMocks) {
|
|
29
|
+
throw new Error('Highlight mocks not initialized. Ensure setupTests imports @pega/cosmos-react-test-utils/lib/mocks.');
|
|
30
|
+
}
|
|
31
|
+
return globalThis.pegaHighlightMocks;
|
|
32
|
+
};
|
|
33
|
+
export default getHighlightMocks;
|
|
34
|
+
//# sourceMappingURL=highlightMock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlightMock.js","sourceRoot":"","sources":["../../src/mocks/highlightMock.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,gFAAgF;AAChF,8EAA8E;AAC9E,2EAA2E;AAC3E,mCAAmC;AAanC,IAAI,OAAO,UAAU,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;IAC/C,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAiB,CAAC;IAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAExC,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;IAE1C,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,WAAW,EAAE;QAC7C,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,SAAS;KACjB,CAAC,CAAC;IAEH,MAAM,gBAAgB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAEnC,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,YAAY,EAAE;QACvC,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,EAAE,GAAG,EAAE,gBAAgB,EAAE;KACjC,CAAC,CAAC;IAEH,UAAU,CAAC,kBAAkB,GAAG;QAC9B,SAAS;QACT,gBAAgB;QAChB,GAAG;KACJ,CAAC;AACJ,CAAC;AAED,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC7B,IAAI,CAAC,UAAU,CAAC,kBAAkB,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CACb,qGAAqG,CACtG,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC,kBAAkB,CAAC;AACvC,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["// jsdom does not implement the CSS Custom Highlight API. This shim provides a\n// `Highlight` constructor and `CSS.highlights` registry backed by jest spies so\n// hooks/components that rely on `new Highlight()` work in tests AND tests can\n// assert against the API. Spies are exposed via `getHighlightMocks()` from\n// `@pega/cosmos-react-test-utils`.\n\ninterface PegaHighlightMocks {\n Highlight: jest.Mock;\n cssHighlightsSet: jest.Mock;\n add: jest.SpiedFunction<Set<AbstractRange>['add']>;\n}\n\ndeclare global {\n // eslint-disable-next-line no-var, vars-on-top\n var pegaHighlightMocks: PegaHighlightMocks | undefined;\n}\n\nif (typeof globalThis.Highlight !== 'function') {\n const instance = new Set<AbstractRange>();\n const add = jest.spyOn(instance, 'add');\n\n const Highlight = jest.fn(() => instance);\n\n Object.defineProperty(globalThis, 'Highlight', {\n configurable: true,\n writable: true,\n value: Highlight\n });\n\n const cssHighlightsSet = jest.fn();\n\n Object.defineProperty(CSS, 'highlights', {\n configurable: true,\n writable: true,\n value: { set: cssHighlightsSet }\n });\n\n globalThis.pegaHighlightMocks = {\n Highlight,\n cssHighlightsSet,\n add\n };\n}\n\nconst getHighlightMocks = () => {\n if (!globalThis.pegaHighlightMocks) {\n throw new Error(\n 'Highlight mocks not initialized. Ensure setupTests imports @pega/cosmos-react-test-utils/lib/mocks.'\n );\n }\n return globalThis.pegaHighlightMocks;\n};\n\nexport default getHighlightMocks;\n"]}
|
package/lib/mocks/iconMock.d.ts
CHANGED
package/lib/mocks/iconMock.js
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
jest.mock('@pega/cosmos-react-core/lib/components/Icon/Icon', () => {
|
|
2
|
-
// Should probably be using global require here in case
|
|
3
|
+
// Should probably be using global require here in case these icon names are themselves being mocked,
|
|
3
4
|
// but that requires including @types/node which throws off type checking for tests.
|
|
4
|
-
const {
|
|
5
|
+
const { default: iconNames } = jest.requireActual('@pega/cosmos-react-core/lib/components/Icon/iconNames');
|
|
6
|
+
const { default: streamlineIconNames } = jest.requireActual('@pega/cosmos-react-core/lib/components/Icon/streamlineIconNames');
|
|
5
7
|
const mod = jest.requireActual('@pega/cosmos-react-core/lib/components/Icon/Icon');
|
|
8
|
+
// Register all icons as empty to avoid dynamic imports in tests.
|
|
9
|
+
mod.registerIcon(...iconNames.map(name => ({ set: 'budicon', name, Component: () => null })), ...streamlineIconNames.map(name => ({ set: 'streamline', name, Component: () => null })));
|
|
6
10
|
return {
|
|
7
11
|
__esModule: true,
|
|
8
|
-
...mod
|
|
9
|
-
default: forwardRef(function IconMock({ name, ...restProps }, ref) {
|
|
10
|
-
return createElement(mod.StyledIcon, {
|
|
11
|
-
role: 'presentation',
|
|
12
|
-
...restProps,
|
|
13
|
-
'data-icon-name': name,
|
|
14
|
-
ref
|
|
15
|
-
});
|
|
16
|
-
})
|
|
12
|
+
...mod
|
|
17
13
|
};
|
|
18
14
|
});
|
|
19
|
-
export {};
|
|
20
15
|
//# sourceMappingURL=iconMock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iconMock.js","sourceRoot":"","sources":["../../src/mocks/iconMock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"iconMock.js","sourceRoot":"","sources":["../../src/mocks/iconMock.ts"],"names":[],"mappings":";AAAA,IAAI,CAAC,IAAI,CAAC,kDAAkD,EAAE,GAAG,EAAE;IACjE,qGAAqG;IACrG,oFAAoF;IACpF,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,aAAa,CAE/C,uDAAuD,CAAC,CAAC;IAC3D,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAAC,aAAa,CAEzD,iEAAiE,CAAC,CAAC;IAErE,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,CAC5B,kDAAkD,CACnD,CAAC;IAEF,iEAAiE;IACjE,GAAG,CAAC,YAAY,CACd,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,EAC3E,GAAG,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CACzF,CAAC;IAEF,OAAO;QACL,UAAU,EAAE,IAAI;QAChB,GAAG,GAAG;KACP,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["jest.mock('@pega/cosmos-react-core/lib/components/Icon/Icon', () => {\n // Should probably be using global require here in case these icon names are themselves being mocked,\n // but that requires including @types/node which throws off type checking for tests.\n const { default: iconNames } = jest.requireActual<\n typeof import('@pega/cosmos-react-core/lib/components/Icon/iconNames')\n >('@pega/cosmos-react-core/lib/components/Icon/iconNames');\n const { default: streamlineIconNames } = jest.requireActual<\n typeof import('@pega/cosmos-react-core/lib/components/Icon/streamlineIconNames')\n >('@pega/cosmos-react-core/lib/components/Icon/streamlineIconNames');\n\n const mod = jest.requireActual<typeof import('@pega/cosmos-react-core/lib/components/Icon/Icon')>(\n '@pega/cosmos-react-core/lib/components/Icon/Icon'\n );\n\n // Register all icons as empty to avoid dynamic imports in tests.\n mod.registerIcon(\n ...iconNames.map(name => ({ set: 'budicon', name, Component: () => null })),\n ...streamlineIconNames.map(name => ({ set: 'streamline', name, Component: () => null }))\n );\n\n return {\n __esModule: true,\n ...mod\n };\n});\n"]}
|
package/lib/mocks/index.d.ts
CHANGED
package/lib/mocks/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAC3B,OAAO,aAAa,CAAC;AACrB,OAAO,wBAAwB,CAAC;AAChC,OAAO,mBAAmB,CAAC;AAC3B,OAAO,eAAe,CAAC;AACvB,OAAO,iBAAiB,CAAC;AACzB,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;AAClC,OAAO,YAAY,CAAC;AACpB,OAAO,iBAAiB,CAAC;AACzB,OAAO,4BAA4B,CAAC;AACpC,OAAO,oBAAoB,CAAC;AAC5B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,eAAe,CAAC;AACvB,OAAO,cAAc,CAAC;AACtB,OAAO,cAAc,CAAC;AACtB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,cAAc,CAAC;AACtB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,yBAAyB,CAAC;AACjC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,eAAe,CAAC;AACvB,OAAO,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAC3B,OAAO,aAAa,CAAC;AACrB,OAAO,wBAAwB,CAAC;AAChC,OAAO,mBAAmB,CAAC;AAC3B,OAAO,eAAe,CAAC;AACvB,OAAO,iBAAiB,CAAC;AACzB,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;AAClC,OAAO,iBAAiB,CAAC;AACzB,OAAO,YAAY,CAAC;AACpB,OAAO,iBAAiB,CAAC;AACzB,OAAO,4BAA4B,CAAC;AACpC,OAAO,oBAAoB,CAAC;AAC5B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,eAAe,CAAC;AACvB,OAAO,cAAc,CAAC;AACtB,OAAO,cAAc,CAAC;AACtB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,cAAc,CAAC;AACtB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,yBAAyB,CAAC;AACjC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,eAAe,CAAC;AACvB,OAAO,qBAAqB,CAAC"}
|
package/lib/mocks/index.js
CHANGED
package/lib/mocks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAC3B,OAAO,aAAa,CAAC;AACrB,OAAO,wBAAwB,CAAC;AAChC,OAAO,mBAAmB,CAAC;AAC3B,OAAO,eAAe,CAAC;AACvB,OAAO,iBAAiB,CAAC;AACzB,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;AAClC,OAAO,YAAY,CAAC;AACpB,OAAO,iBAAiB,CAAC;AACzB,OAAO,4BAA4B,CAAC;AACpC,OAAO,oBAAoB,CAAC;AAC5B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,eAAe,CAAC;AACvB,OAAO,cAAc,CAAC;AACtB,OAAO,cAAc,CAAC;AACtB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,cAAc,CAAC;AACtB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,yBAAyB,CAAC;AACjC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,eAAe,CAAC;AACvB,OAAO,qBAAqB,CAAC","sourcesContent":["import './abortSignalMock';\nimport './animation';\nimport './broadcastChannelMock';\nimport './createObjectURL';\nimport './createRange';\nimport './createUIDMock';\nimport './elementFromPointMock';\nimport './getCurrentPositionMock';\nimport './iconMock';\nimport './innerTextMock';\nimport './intersectionObserverMock';\nimport './localStorageMock';\nimport './mapsAPILoaderMock';\nimport './matchMediaMock';\nimport './popoverMock';\nimport './qrcodeMock';\nimport './randomUUID';\nimport './scrollIntoView';\nimport './svgGetBBox';\nimport './svgGetScreenCTM';\nimport './svgGetSubStringLength';\nimport './resizeObserverMock';\nimport './urlCanParse';\nimport './useBreakpointMock';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAC3B,OAAO,aAAa,CAAC;AACrB,OAAO,wBAAwB,CAAC;AAChC,OAAO,mBAAmB,CAAC;AAC3B,OAAO,eAAe,CAAC;AACvB,OAAO,iBAAiB,CAAC;AACzB,OAAO,wBAAwB,CAAC;AAChC,OAAO,0BAA0B,CAAC;AAClC,OAAO,iBAAiB,CAAC;AACzB,OAAO,YAAY,CAAC;AACpB,OAAO,iBAAiB,CAAC;AACzB,OAAO,4BAA4B,CAAC;AACpC,OAAO,oBAAoB,CAAC;AAC5B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,eAAe,CAAC;AACvB,OAAO,cAAc,CAAC;AACtB,OAAO,cAAc,CAAC;AACtB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,cAAc,CAAC;AACtB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,yBAAyB,CAAC;AACjC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,eAAe,CAAC;AACvB,OAAO,qBAAqB,CAAC","sourcesContent":["import './abortSignalMock';\nimport './animation';\nimport './broadcastChannelMock';\nimport './createObjectURL';\nimport './createRange';\nimport './createUIDMock';\nimport './elementFromPointMock';\nimport './getCurrentPositionMock';\nimport './highlightMock';\nimport './iconMock';\nimport './innerTextMock';\nimport './intersectionObserverMock';\nimport './localStorageMock';\nimport './mapsAPILoaderMock';\nimport './matchMediaMock';\nimport './popoverMock';\nimport './qrcodeMock';\nimport './randomUUID';\nimport './scrollIntoView';\nimport './svgGetBBox';\nimport './svgGetScreenCTM';\nimport './svgGetSubStringLength';\nimport './resizeObserverMock';\nimport './urlCanParse';\nimport './useBreakpointMock';\n"]}
|
package/lib/utils/utils.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import type { ReactElement } from 'react';
|
|
|
2
2
|
import type { RenderOptions, RenderResult } from '@testing-library/react';
|
|
3
3
|
import type { queries, Queries } from '@testing-library/dom';
|
|
4
4
|
import type { ConfigurationProps, OmitStrict } from '@pega/cosmos-react-core';
|
|
5
|
+
export { default as getHighlightMocks } from '../mocks/highlightMock';
|
|
5
6
|
type ProvidersProps = OmitStrict<ConfigurationProps, 'children'>;
|
|
6
7
|
export declare function render(content: ReactElement, options?: OmitStrict<RenderOptions, 'wrapper' | 'queries'>, configurationProps?: ProvidersProps): RenderResult;
|
|
7
8
|
export declare function render<Q extends Queries = typeof queries, Container extends Element | DocumentFragment = HTMLElement, BaseElement extends Element | DocumentFragment = Container>(content: ReactElement, options: OmitStrict<RenderOptions<Q, Container, BaseElement>, 'wrapper'>, configurationProps?: ProvidersProps): RenderResult<Q, Container, BaseElement>;
|
|
8
9
|
export declare const resizeWindow: (x: number, y: number) => void;
|
|
9
10
|
export declare const dragElement: (originEl: HTMLElement, destinationEl: HTMLElement) => void;
|
|
10
11
|
export declare const userEventNoPointer: import("@testing-library/user-event").UserEvent;
|
|
11
|
-
export {};
|
|
12
12
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/utils/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAW7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE9E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,KAAK,cAAc,GAAG,UAAU,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;AAmBjE,wBAAgB,MAAM,CACpB,OAAO,EAAE,YAAY,EACrB,OAAO,CAAC,EAAE,UAAU,CAAC,aAAa,EAAE,SAAS,GAAG,SAAS,CAAC,EAC1D,kBAAkB,CAAC,EAAE,cAAc,GAClC,YAAY,CAAC;AAEhB,wBAAgB,MAAM,CACpB,CAAC,SAAS,OAAO,GAAG,OAAO,OAAO,EAClC,SAAS,SAAS,OAAO,GAAG,gBAAgB,GAAG,WAAW,EAC1D,WAAW,SAAS,OAAO,GAAG,gBAAgB,GAAG,SAAS,EAE1D,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,SAAS,CAAC,EACxE,kBAAkB,CAAC,EAAE,cAAc,GAClC,YAAY,CAAC,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AAmB3C,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,SAIhD,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,UAAU,WAAW,EAAE,eAAe,WAAW,SAK5E,CAAC;AAEF,eAAO,MAAM,kBAAkB,iDAE7B,CAAC"}
|
package/lib/utils/utils.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { fireEvent, render as rtlRender } from '@testing-library/react';
|
|
3
3
|
import userEvent, { PointerEventsCheckLevel } from '@testing-library/user-event';
|
|
4
|
-
import { Configuration, LiveLog, ModalManager, PopoverManager, Toaster } from '@pega/cosmos-react-core';
|
|
5
|
-
|
|
4
|
+
import { Configuration, LiveLog, ModalManager, PopoverManager, PreviewManager, Toaster } from '@pega/cosmos-react-core';
|
|
5
|
+
export { default as getHighlightMocks } from '../mocks/highlightMock';
|
|
6
|
+
const Providers = (configurationProps) => ({ children }) => (_jsx(Configuration, { ...configurationProps, children: _jsx(LiveLog, { children: _jsx(PopoverManager, { children: _jsx(PreviewManager, { children: _jsx(Toaster, { children: _jsx(ModalManager, { children: children }) }) }) }) }) }));
|
|
6
7
|
export function render(content, options = {}, configurationProps) {
|
|
7
8
|
return rtlRender(content, {
|
|
8
9
|
...options,
|
package/lib/utils/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxE,OAAO,SAAS,EAAE,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEjF,OAAO,EACL,aAAa,EACb,OAAO,EACP,YAAY,EACZ,cAAc,EACd,OAAO,EACR,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxE,OAAO,SAAS,EAAE,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEjF,OAAO,EACL,aAAa,EACb,OAAO,EACP,YAAY,EACZ,cAAc,EACd,cAAc,EACd,OAAO,EACR,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAItE,MAAM,SAAS,GACb,CAAC,kBAAmC,EAAE,EAAE,CACxC,CAAC,EAAE,QAAQ,EAA8B,EAAE,EAAE,CAAC,CAC5C,KAAC,aAAa,OAAK,kBAAkB,YACnC,KAAC,OAAO,cACN,KAAC,cAAc,cACb,KAAC,cAAc,cACb,KAAC,OAAO,cACN,KAAC,YAAY,cAAE,QAAQ,GAAgB,GAC/B,GACK,GACF,GACT,GACI,CACjB,CAAC;AAmBJ,MAAM,UAAU,MAAM,CAKpB,OAAqB,EACrB,UAEsE,EAAE,EACxE,kBAAmC;IAEnC,OAAO,SAAS,CAAC,OAAO,EAAE;QACxB,GAAG,OAAO;QACV,OAAO,EAAE,SAAS,CAAC,kBAAkB,CAAC;KACtB,CAA2D,CAAC;AAChF,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE;IACnD,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC;IACtB,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC;IACvB,MAAM,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAqB,EAAE,aAA0B,EAAE,EAAE;IAC/E,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC9B,SAAS,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IACnC,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IAClC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC,KAAK,CAAC;IAChD,kBAAkB,EAAE,uBAAuB,CAAC,KAAK;CAClD,CAAC,CAAC","sourcesContent":["import type { ReactElement } from 'react';\nimport { fireEvent, render as rtlRender } from '@testing-library/react';\nimport type { RenderOptions, RenderResult } from '@testing-library/react';\nimport type { queries, Queries } from '@testing-library/dom';\nimport userEvent, { PointerEventsCheckLevel } from '@testing-library/user-event';\n\nimport {\n Configuration,\n LiveLog,\n ModalManager,\n PopoverManager,\n PreviewManager,\n Toaster\n} from '@pega/cosmos-react-core';\nimport type { ConfigurationProps, OmitStrict } from '@pega/cosmos-react-core';\n\nexport { default as getHighlightMocks } from '../mocks/highlightMock';\n\ntype ProvidersProps = OmitStrict<ConfigurationProps, 'children'>;\n\nconst Providers =\n (configurationProps?: ProvidersProps) =>\n ({ children }: { children: ReactElement }) => (\n <Configuration {...configurationProps}>\n <LiveLog>\n <PopoverManager>\n <PreviewManager>\n <Toaster>\n <ModalManager>{children}</ModalManager>\n </Toaster>\n </PreviewManager>\n </PopoverManager>\n </LiveLog>\n </Configuration>\n );\n\n// Overloads adapted from types for RTL render.\nexport function render(\n content: ReactElement,\n options?: OmitStrict<RenderOptions, 'wrapper' | 'queries'>,\n configurationProps?: ProvidersProps\n): RenderResult;\n\nexport function render<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container\n>(\n content: ReactElement,\n options: OmitStrict<RenderOptions<Q, Container, BaseElement>, 'wrapper'>,\n configurationProps?: ProvidersProps\n): RenderResult<Q, Container, BaseElement>;\n\nexport function render<\n Q extends Queries = typeof queries,\n Container extends Element | DocumentFragment = HTMLElement,\n BaseElement extends Element | DocumentFragment = Container\n>(\n content: ReactElement,\n options:\n | OmitStrict<RenderOptions, 'wrapper' | 'queries'>\n | OmitStrict<RenderOptions<Q, Container, BaseElement>, 'wrapper'> = {},\n configurationProps?: ProvidersProps\n) {\n return rtlRender(content, {\n ...options,\n wrapper: Providers(configurationProps)\n } as RenderOptions) as RenderResult | RenderResult<Q, Container, BaseElement>;\n}\n\nexport const resizeWindow = (x: number, y: number) => {\n window.innerWidth = x;\n window.innerHeight = y;\n window.dispatchEvent(new Event('resize'));\n};\n\nexport const dragElement = (originEl: HTMLElement, destinationEl: HTMLElement) => {\n fireEvent.dragStart(originEl);\n fireEvent.dragEnter(destinationEl);\n fireEvent.dragOver(destinationEl);\n fireEvent.drop(destinationEl);\n};\n\nexport const userEventNoPointer = userEvent.setup({\n pointerEventsCheck: PointerEventsCheckLevel.Never\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-test-utils",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"author": "Pegasystems",
|
|
6
6
|
"sideEffects": [
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"build": "tsc -b tsconfig.build.json"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@pega/cosmos-react-core": "9.0.
|
|
20
|
+
"@pega/cosmos-react-core": "9.0.1",
|
|
21
21
|
"@testing-library/dom": "^10.3.0",
|
|
22
22
|
"@testing-library/react": "^16.0.0",
|
|
23
23
|
"@testing-library/user-event": "^14.6.1",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"@types/react": "^17.0.62 || ^18.3.3",
|
|
26
26
|
"@types/react-dom": "^17.0.20 || ^18.3.0",
|
|
27
27
|
"chalk": "^2.4.2",
|
|
28
|
-
"jest-styled-components": "^7.
|
|
28
|
+
"jest-styled-components": "^7.2.0",
|
|
29
29
|
"polished": "^4.1.0",
|
|
30
30
|
"react": "^17.0.0 || ^18.0.0",
|
|
31
31
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"typescript": "~5.
|
|
34
|
+
"typescript": "~5.9.3"
|
|
35
35
|
}
|
|
36
36
|
}
|