@pega/cosmos-react-test-utils 5.0.0-dev.1.0 → 5.0.0-dev.10.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/lib/mocks/iconMock.js.map +1 -1
- package/lib/utils/utils.d.ts +7 -8
- package/lib/utils/utils.d.ts.map +1 -1
- package/lib/utils/utils.js +8 -4
- package/lib/utils/utils.js.map +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iconMock.js","sourceRoot":"","sources":["../../src/mocks/iconMock.ts"],"names":[],"mappings":"AAIA,IAAI,CAAC,IAAI,CAAC,kDAAkD,EAAE,GAAG,EAAE;IACjE,gHAAgH;IAChH,oFAAoF;IACpF,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,aAAa,CAAyB,OAAO,CAAC,CAAC;IAE1F,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,CAC5B,kDAAkD,CACnD,CAAC;IAEF,OAAO;QACL,UAAU,EAAE,IAAI;QAChB,GAAG,GAAG;QACN,OAAO,EAAE,UAAU,CAAC,SAAS,QAAQ,CACnC,EAAE,IAAI,EAAE,GAAG,SAAS,EAA8B,EAClD,
|
|
1
|
+
{"version":3,"file":"iconMock.js","sourceRoot":"","sources":["../../src/mocks/iconMock.ts"],"names":[],"mappings":"AAIA,IAAI,CAAC,IAAI,CAAC,kDAAkD,EAAE,GAAG,EAAE;IACjE,gHAAgH;IAChH,oFAAoF;IACpF,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,aAAa,CAAyB,OAAO,CAAC,CAAC;IAE1F,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,CAC5B,kDAAkD,CACnD,CAAC;IAEF,OAAO;QACL,UAAU,EAAE,IAAI;QAChB,GAAG,GAAG;QACN,OAAO,EAAE,UAAU,CAAC,SAAS,QAAQ,CACnC,EAAE,IAAI,EAAE,GAAG,SAAS,EAA8B,EAClD,GAAuB;YAEvB,OAAO,aAAa,CAAC,GAAG,CAAC,UAAU,EAAE;gBACnC,IAAI,EAAE,cAAc;gBACpB,GAAG,SAAS;gBACZ,gBAAgB,EAAE,IAAI;gBACtB,GAAG;aACgD,CAAC,CAAC;QACzD,CAAC,CAAC;KACH,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import type { PropsWithoutRef, Ref } from 'react';\n\nimport type { IconProps } from '@pega/cosmos-react-core';\n\njest.mock('@pega/cosmos-react-core/lib/components/Icon/Icon', () => {\n // Should probably be using global require here in case createElement or forwardRef are themselves being mocked,\n // but that requires including @types/node which throws off type checking for tests.\n const { createElement, forwardRef } = jest.requireActual<typeof import('react')>('react');\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 return {\n __esModule: true,\n ...mod,\n default: forwardRef(function IconMock(\n { name, ...restProps }: PropsWithoutRef<IconProps>,\n ref: Ref<SVGSVGElement>\n ) {\n return createElement(mod.StyledIcon, {\n role: 'presentation',\n ...restProps,\n 'data-icon-name': name,\n ref\n } as unknown as IconProps & { background: undefined });\n })\n };\n});\n"]}
|
package/lib/utils/utils.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare const render: (content: ReactElement, options?: RenderOptions) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { RenderOptions, RenderResult } from '@testing-library/react';
|
|
3
|
+
import type { queries, Queries } from '@testing-library/dom';
|
|
4
|
+
import type { ConfigurationProps, OmitStrict } from '@pega/cosmos-react-core';
|
|
5
|
+
type ProvidersProps = OmitStrict<ConfigurationProps, 'children'>;
|
|
6
|
+
export declare function render(content: ReactElement, options?: OmitStrict<RenderOptions, 'wrapper' | 'queries'>, configurationProps?: ProvidersProps): RenderResult;
|
|
7
|
+
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>;
|
|
9
8
|
export declare const resizeWindow: (x: number, y: number) => void;
|
|
10
9
|
export {};
|
|
11
10
|
//# 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,EAAE,YAAY,EAAE,MAAM,OAAO,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;AAS7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE9E,KAAK,cAAc,GAAG,UAAU,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;AAkBjE,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,MAAO,MAAM,KAAK,MAAM,SAIhD,CAAC"}
|
package/lib/utils/utils.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { render as rtlRender } from '@testing-library/react';
|
|
3
|
-
import { Configuration, ModalManager, PopoverManager, Toaster } from '@pega/cosmos-react-core';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { Configuration, LiveLog, ModalManager, PopoverManager, Toaster } from '@pega/cosmos-react-core';
|
|
4
|
+
const Providers = (configurationProps) => ({ children }) => (_jsx(Configuration, { ...configurationProps, children: _jsx(LiveLog, { children: _jsx(PopoverManager, { children: _jsx(Toaster, { dismissAfter: 5000, children: _jsx(ModalManager, { children: children }) }) }) }) }));
|
|
5
|
+
export function render(content, options = {}, configurationProps) {
|
|
6
|
+
return rtlRender(content, {
|
|
7
|
+
...options,
|
|
8
|
+
wrapper: Providers(configurationProps)
|
|
9
|
+
});
|
|
10
|
+
}
|
|
7
11
|
export const resizeWindow = (x, y) => {
|
|
8
12
|
window.innerWidth = x;
|
|
9
13
|
window.innerHeight = y;
|
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,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAI7D,OAAO,EACL,aAAa,EACb,OAAO,EACP,YAAY,EACZ,cAAc,EACd,OAAO,EACR,MAAM,yBAAyB,CAAC;AAKjC,MAAM,SAAS,GACb,CAAC,kBAAmC,EAAE,EAAE,CACxC,CAAC,EAAE,QAAQ,EAA8B,EAAE,EAAE,CAC3C,CACE,KAAC,aAAa,OAAK,kBAAkB,YACnC,KAAC,OAAO,cACN,KAAC,cAAc,cACb,KAAC,OAAO,IAAC,YAAY,EAAE,IAAI,YACzB,KAAC,YAAY,cAAE,QAAQ,GAAgB,GAC/B,GACK,GACT,GACI,CACjB,CAAC;AAmBN,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","sourcesContent":["import type { ReactElement } from 'react';\nimport { render as rtlRender } from '@testing-library/react';\nimport type { RenderOptions, RenderResult } from '@testing-library/react';\nimport type { queries, Queries } from '@testing-library/dom';\n\nimport {\n Configuration,\n LiveLog,\n ModalManager,\n PopoverManager,\n Toaster\n} from '@pega/cosmos-react-core';\nimport type { ConfigurationProps, OmitStrict } from '@pega/cosmos-react-core';\n\ntype ProvidersProps = OmitStrict<ConfigurationProps, 'children'>;\n\nconst Providers =\n (configurationProps?: ProvidersProps) =>\n ({ children }: { children: ReactElement }) =>\n (\n <Configuration {...configurationProps}>\n <LiveLog>\n <PopoverManager>\n <Toaster dismissAfter={5000}>\n <ModalManager>{children}</ModalManager>\n </Toaster>\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"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-test-utils",
|
|
3
|
-
"version": "5.0.0-dev.
|
|
3
|
+
"version": "5.0.0-dev.10.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
|
-
"url": "https://github.com/pegasystems/cosmos-react.git",
|
|
6
|
+
"url": "git+https://github.com/pegasystems/cosmos-react.git",
|
|
7
7
|
"directory": "packages/cosmos-test-utils"
|
|
8
8
|
},
|
|
9
9
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -15,22 +15,22 @@
|
|
|
15
15
|
"main": "lib/index.js",
|
|
16
16
|
"types": "lib/index.d.ts",
|
|
17
17
|
"files": [
|
|
18
|
-
"LICENSE",
|
|
19
18
|
"lib"
|
|
20
19
|
],
|
|
21
20
|
"scripts": {
|
|
22
|
-
"build": "tsc -b"
|
|
21
|
+
"build": "tsc -b tsconfig.build.json"
|
|
23
22
|
},
|
|
24
23
|
"dependencies": {
|
|
25
|
-
"@pega/cosmos-react-core": "5.0.0-dev.
|
|
24
|
+
"@pega/cosmos-react-core": "5.0.0-dev.10.0",
|
|
25
|
+
"@testing-library/dom": "^8.13.0",
|
|
26
26
|
"@testing-library/react": "^12.1.3",
|
|
27
27
|
"@types/jest": "^29.5.1",
|
|
28
|
-
"@types/react": "^
|
|
29
|
-
"@types/react-dom": "^
|
|
30
|
-
"react": "^
|
|
31
|
-
"react-dom": "^
|
|
28
|
+
"@types/react": "^17.0.62",
|
|
29
|
+
"@types/react-dom": "^17.0.20",
|
|
30
|
+
"react": "^17.0.0",
|
|
31
|
+
"react-dom": "^17.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"typescript": "~5.
|
|
34
|
+
"typescript": "~5.2.2"
|
|
35
35
|
}
|
|
36
36
|
}
|