@pega/cosmos-react-test-utils 5.0.0-dev.8.3 → 5.0.0-dev.9.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.
@@ -1,11 +1,10 @@
1
1
  import type { ReactElement } from 'react';
2
- import type { RenderOptions as RTLRenderOptions } from '@testing-library/react';
2
+ import type { RenderOptions, RenderResult } from '@testing-library/react';
3
+ import type { queries, Queries } from '@testing-library/dom';
3
4
  import type { ConfigurationProps, OmitStrict } from '@pega/cosmos-react-core';
4
- interface RenderOptions {
5
- rtlRenderOptions?: RTLRenderOptions;
6
- configurationProps?: OmitStrict<ConfigurationProps, 'children'>;
7
- }
8
- export declare const render: (content: ReactElement, options?: RenderOptions) => import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
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
@@ -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,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAGhF,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE9E,UAAU,aAAa;IACrB,gBAAgB,C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,MAAM,SAIhD,CAAC"}
@@ -1,13 +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
- const Providers = (configurationProps) => ({ children }) => (_jsx(Configuration, { ...configurationProps, children: _jsx(PopoverManager, { children: _jsx(Toaster, { dismissAfter: 5000, children: _jsx(ModalManager, { children: children }) }) }) }));
5
- export const render = (content, options = {}) => {
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
6
  return rtlRender(content, {
7
- wrapper: Providers(options.configurationProps),
8
- ...options.rtlRenderOptions
7
+ ...options,
8
+ wrapper: Providers(configurationProps)
9
9
  });
10
- };
10
+ }
11
11
  export const resizeWindow = (x, y) => {
12
12
  window.innerWidth = x;
13
13
  window.innerHeight = y;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAG7D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAQ/F,MAAM,SAAS,GACb,CAAC,kBAA+D,EAAE,EAAE,CACpE,CAAC,EAAE,QAAQ,EAA8B,EAAE,EAAE,CAC3C,CACE,KAAC,aAAa,OAAK,kBAAkB,YACnC,KAAC,cAAc,cACb,KAAC,OAAO,IAAC,YAAY,EAAE,IAAI,YACzB,KAAC,YAAY,cAAE,QAAQ,GAAgB,GAC/B,GACK,GACH,CACjB,CAAC;AAEN,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAqB,EAAE,UAAyB,EAAE,EAAE,EAAE;IAC3E,OAAO,SAAS,CAAC,OAAO,EAAE;QACxB,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,kBAAkB,CAAC;QAC9C,GAAG,OAAO,CAAC,gBAAgB;KAC5B,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,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 as RTLRenderOptions } from '@testing-library/react';\n\nimport { Configuration, ModalManager, PopoverManager, Toaster } from '@pega/cosmos-react-core';\nimport type { ConfigurationProps, OmitStrict } from '@pega/cosmos-react-core';\n\ninterface RenderOptions {\n rtlRenderOptions?: RTLRenderOptions;\n configurationProps?: OmitStrict<ConfigurationProps, 'children'>;\n}\n\nconst Providers =\n (configurationProps?: OmitStrict<ConfigurationProps, 'children'>) =>\n ({ children }: { children: ReactElement }) =>\n (\n <Configuration {...configurationProps}>\n <PopoverManager>\n <Toaster dismissAfter={5000}>\n <ModalManager>{children}</ModalManager>\n </Toaster>\n </PopoverManager>\n </Configuration>\n );\n\nexport const render = (content: ReactElement, options: RenderOptions = {}) => {\n return rtlRender(content, {\n wrapper: Providers(options.configurationProps),\n ...options.rtlRenderOptions\n });\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"]}
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.8.3",
3
+ "version": "5.0.0-dev.9.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",
@@ -22,7 +22,8 @@
22
22
  "build": "tsc -b"
23
23
  },
24
24
  "dependencies": {
25
- "@pega/cosmos-react-core": "5.0.0-dev.8.3",
25
+ "@pega/cosmos-react-core": "5.0.0-dev.9.0",
26
+ "@testing-library/dom": "^8.13.0",
26
27
  "@testing-library/react": "^12.1.3",
27
28
  "@types/jest": "^29.5.1",
28
29
  "@types/react": "^17.0.62",