@pega/cosmos-react-test-utils 5.0.0-dev.4.9 → 5.0.0-dev.5.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.
Files changed (57) hide show
  1. package/lib/index.d.ts +2 -0
  2. package/lib/index.d.ts.map +1 -0
  3. package/lib/index.js +3 -0
  4. package/lib/index.js.map +1 -0
  5. package/lib/mocks/createRange.d.ts +1 -0
  6. package/lib/mocks/createRange.d.ts.map +1 -0
  7. package/lib/mocks/createRange.js +14 -0
  8. package/lib/mocks/createRange.js.map +1 -0
  9. package/lib/mocks/elementFromPointMock.d.ts +1 -0
  10. package/lib/mocks/elementFromPointMock.d.ts.map +1 -0
  11. package/lib/mocks/elementFromPointMock.js +3 -0
  12. package/lib/mocks/elementFromPointMock.js.map +1 -0
  13. package/lib/mocks/iconMock.d.ts +2 -0
  14. package/lib/mocks/iconMock.d.ts.map +1 -0
  15. package/lib/mocks/iconMock.js +20 -0
  16. package/lib/mocks/iconMock.js.map +1 -0
  17. package/lib/mocks/index.d.ts +10 -0
  18. package/lib/mocks/index.d.ts.map +1 -0
  19. package/lib/mocks/index.js +10 -0
  20. package/lib/mocks/index.js.map +1 -0
  21. package/lib/mocks/intersectionObserverMock.d.ts +1 -0
  22. package/lib/mocks/intersectionObserverMock.d.ts.map +1 -0
  23. package/lib/mocks/intersectionObserverMock.js +11 -0
  24. package/lib/mocks/intersectionObserverMock.js.map +1 -0
  25. package/lib/mocks/matchMediaMock.d.ts +1 -0
  26. package/lib/mocks/matchMediaMock.d.ts.map +1 -0
  27. package/lib/mocks/matchMediaMock.js +12 -0
  28. package/lib/mocks/matchMediaMock.js.map +1 -0
  29. package/lib/mocks/mutationObserverMock.d.ts +1 -0
  30. package/lib/mocks/mutationObserverMock.d.ts.map +1 -0
  31. package/lib/mocks/mutationObserverMock.js +9 -0
  32. package/lib/mocks/mutationObserverMock.js.map +1 -0
  33. package/lib/mocks/popoverMock.d.ts +2 -0
  34. package/lib/mocks/popoverMock.d.ts.map +1 -0
  35. package/lib/mocks/popoverMock.js +15 -0
  36. package/lib/mocks/popoverMock.js.map +1 -0
  37. package/lib/mocks/qrcodeMock.d.ts +1 -0
  38. package/lib/mocks/qrcodeMock.d.ts.map +1 -0
  39. package/lib/mocks/qrcodeMock.js +5 -0
  40. package/lib/mocks/qrcodeMock.js.map +1 -0
  41. package/lib/mocks/resizeObserverMock.d.ts +1 -0
  42. package/lib/mocks/resizeObserverMock.d.ts.map +1 -0
  43. package/lib/mocks/resizeObserverMock.js +7 -0
  44. package/lib/mocks/resizeObserverMock.js.map +1 -0
  45. package/lib/mocks/useBreakpointMock.d.ts +1 -0
  46. package/lib/mocks/useBreakpointMock.d.ts.map +1 -0
  47. package/lib/mocks/useBreakpointMock.js +12 -0
  48. package/lib/mocks/useBreakpointMock.js.map +1 -0
  49. package/lib/utils/index.d.ts +2 -0
  50. package/lib/utils/index.d.ts.map +1 -0
  51. package/lib/utils/index.js +2 -0
  52. package/lib/utils/index.js.map +1 -0
  53. package/lib/utils/utils.d.ts +11 -0
  54. package/lib/utils/utils.d.ts.map +1 -0
  55. package/lib/utils/utils.js +12 -0
  56. package/lib/utils/utils.js.map +1 -0
  57. package/package.json +2 -2
package/lib/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './utils';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,3 @@
1
+ // This file is autogenerated. Any changes will be overwritten.
2
+ export * from './utils';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,cAAc,SAAS,CAAC","sourcesContent":["// This file is autogenerated. Any changes will be overwritten.\nexport * from './utils';\n"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=createRange.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRange.d.ts","sourceRoot":"","sources":["../../src/mocks/createRange.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ document.createRange = () => {
3
+ const range = new Range();
4
+ range.getBoundingClientRect = jest.fn();
5
+ range.getClientRects = () => {
6
+ return {
7
+ item: () => null,
8
+ length: 0,
9
+ [Symbol.iterator]: jest.fn()
10
+ };
11
+ };
12
+ return range;
13
+ };
14
+ //# sourceMappingURL=createRange.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRange.js","sourceRoot":"","sources":["../../src/mocks/createRange.ts"],"names":[],"mappings":";AAAA,QAAQ,CAAC,WAAW,GAAG,GAAG,EAAE;IAC1B,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;IAE1B,KAAK,CAAC,qBAAqB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAExC,KAAK,CAAC,cAAc,GAAG,GAAG,EAAE;QAC1B,OAAO;YACL,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI;YAChB,MAAM,EAAE,CAAC;YACT,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE;SAC7B,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["document.createRange = () => {\n const range = new Range();\n\n range.getBoundingClientRect = jest.fn();\n\n range.getClientRects = () => {\n return {\n item: () => null,\n length: 0,\n [Symbol.iterator]: jest.fn()\n };\n };\n\n return range;\n};\n"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=elementFromPointMock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elementFromPointMock.d.ts","sourceRoot":"","sources":["../../src/mocks/elementFromPointMock.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ document.elementFromPoint = jest.fn(() => null);
3
+ //# sourceMappingURL=elementFromPointMock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elementFromPointMock.js","sourceRoot":"","sources":["../../src/mocks/elementFromPointMock.ts"],"names":[],"mappings":";AAAA,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC","sourcesContent":["document.elementFromPoint = jest.fn(() => null);\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=iconMock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iconMock.d.ts","sourceRoot":"","sources":["../../src/mocks/iconMock.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ jest.mock('@pega/cosmos-react-core/lib/components/Icon/Icon', () => {
2
+ // Should probably be using global require here in case createElement or forwardRef are themselves being mocked,
3
+ // but that requires including @types/node which throws off type checking for tests.
4
+ const { createElement, forwardRef } = jest.requireActual('react');
5
+ const mod = jest.requireActual('@pega/cosmos-react-core/lib/components/Icon/Icon');
6
+ return {
7
+ __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
+ })
17
+ };
18
+ });
19
+ export {};
20
+ //# sourceMappingURL=iconMock.js.map
@@ -0,0 +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,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"]}
@@ -0,0 +1,10 @@
1
+ import './createRange';
2
+ import './elementFromPointMock';
3
+ import './iconMock';
4
+ import './intersectionObserverMock';
5
+ import './matchMediaMock';
6
+ import './popoverMock';
7
+ import './qrcodeMock';
8
+ import './resizeObserverMock';
9
+ import './useBreakpointMock';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,wBAAwB,CAAC;AAChC,OAAO,YAAY,CAAC;AACpB,OAAO,4BAA4B,CAAC;AACpC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,eAAe,CAAC;AACvB,OAAO,cAAc,CAAC;AACtB,OAAO,sBAAsB,CAAC;AAC9B,OAAO,qBAAqB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import './createRange';
2
+ import './elementFromPointMock';
3
+ import './iconMock';
4
+ import './intersectionObserverMock';
5
+ import './matchMediaMock';
6
+ import './popoverMock';
7
+ import './qrcodeMock';
8
+ import './resizeObserverMock';
9
+ import './useBreakpointMock';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,wBAAwB,CAAC;AAChC,OAAO,YAAY,CAAC;AACpB,OAAO,4BAA4B,CAAC;AACpC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,eAAe,CAAC;AACvB,OAAO,cAAc,CAAC;AACtB,OAAO,sBAAsB,CAAC;AAC9B,OAAO,qBAAqB,CAAC","sourcesContent":["import './createRange';\nimport './elementFromPointMock';\nimport './iconMock';\nimport './intersectionObserverMock';\nimport './matchMediaMock';\nimport './popoverMock';\nimport './qrcodeMock';\nimport './resizeObserverMock';\nimport './useBreakpointMock';\n"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=intersectionObserverMock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intersectionObserverMock.d.ts","sourceRoot":"","sources":["../../src/mocks/intersectionObserverMock.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ window.IntersectionObserver = jest.fn(() => ({
3
+ root: null,
4
+ rootMargin: '0',
5
+ thresholds: [],
6
+ takeRecords: () => [],
7
+ observe: () => { },
8
+ unobserve: () => { },
9
+ disconnect: () => { }
10
+ }));
11
+ //# sourceMappingURL=intersectionObserverMock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intersectionObserverMock.js","sourceRoot":"","sources":["../../src/mocks/intersectionObserverMock.ts"],"names":[],"mappings":";AAAA,MAAM,CAAC,oBAAoB,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;IAC3C,IAAI,EAAE,IAAI;IACV,UAAU,EAAE,GAAG;IACf,UAAU,EAAE,EAAE;IACd,WAAW,EAAE,GAAG,EAAE,CAAC,EAAE;IACrB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;IACjB,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;IACnB,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;CACrB,CAAC,CAAC,CAAC","sourcesContent":["window.IntersectionObserver = jest.fn(() => ({\n root: null,\n rootMargin: '0',\n thresholds: [],\n takeRecords: () => [],\n observe: () => {},\n unobserve: () => {},\n disconnect: () => {}\n}));\n"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=matchMediaMock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matchMediaMock.d.ts","sourceRoot":"","sources":["../../src/mocks/matchMediaMock.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ window.matchMedia = jest.fn((query) => ({
3
+ matches: false,
4
+ media: query,
5
+ onchange: null,
6
+ addListener: () => { },
7
+ removeListener: () => { },
8
+ addEventListener: () => { },
9
+ removeEventListener: () => { },
10
+ dispatchEvent: () => false
11
+ }));
12
+ //# sourceMappingURL=matchMediaMock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"matchMediaMock.js","sourceRoot":"","sources":["../../src/mocks/matchMediaMock.ts"],"names":[],"mappings":";AAAA,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC;IAC9C,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,KAAK;IACZ,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;IACrB,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;IACxB,gBAAgB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC1B,mBAAmB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC7B,aAAa,EAAE,GAAG,EAAE,CAAC,KAAK;CAC3B,CAAC,CAAC,CAAC","sourcesContent":["window.matchMedia = jest.fn((query: string) => ({\n matches: false,\n media: query,\n onchange: null,\n addListener: () => {},\n removeListener: () => {},\n addEventListener: () => {},\n removeEventListener: () => {},\n dispatchEvent: () => false\n}));\n"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=mutationObserverMock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutationObserverMock.d.ts","sourceRoot":"","sources":["../../src/mocks/mutationObserverMock.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ window.MutationObserver = jest.fn(() => {
3
+ return {
4
+ observe: jest.fn(),
5
+ disconnect: jest.fn(),
6
+ takeRecords: jest.fn()
7
+ };
8
+ });
9
+ //# sourceMappingURL=mutationObserverMock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutationObserverMock.js","sourceRoot":"","sources":["../../src/mocks/mutationObserverMock.ts"],"names":[],"mappings":";AAAA,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE;IACrC,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;QAClB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;QACrB,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;KACvB,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["window.MutationObserver = jest.fn(() => {\n return {\n observe: jest.fn(),\n disconnect: jest.fn(),\n takeRecords: jest.fn()\n };\n});\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=popoverMock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popoverMock.d.ts","sourceRoot":"","sources":["../../src/mocks/popoverMock.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ jest.mock('@pega/cosmos-react-core/lib/components/Popover/Popover', () => {
2
+ // Should probably be using global require here in case createElement or forwardRef are themselves being mocked,
3
+ // but that requires including @types/node which throws off type checking for tests.
4
+ const { createElement, forwardRef } = jest.requireActual('react');
5
+ const { default: Popover, ...mod } = jest.requireActual('@pega/cosmos-react-core/lib/components/Popover/Popover');
6
+ return {
7
+ __esModule: true,
8
+ ...mod,
9
+ default: forwardRef(function PopoverMock(props, ref) {
10
+ return createElement(Popover, { ...props, hideOnTargetHidden: false, ref });
11
+ })
12
+ };
13
+ });
14
+ export {};
15
+ //# sourceMappingURL=popoverMock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popoverMock.js","sourceRoot":"","sources":["../../src/mocks/popoverMock.ts"],"names":[],"mappings":"AAIA,IAAI,CAAC,IAAI,CAAC,wDAAwD,EAAE,GAAG,EAAE;IACvE,gHAAgH;IAChH,oFAAoF;IACpF,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,aAAa,CAAyB,OAAO,CAAC,CAAC;IAE1F,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC,aAAa,CAErD,wDAAwD,CAAC,CAAC;IAE5D,OAAO;QACL,UAAU,EAAE,IAAI;QAChB,GAAG,GAAG;QACN,OAAO,EAAE,UAAU,CAAC,SAAS,WAAW,CACtC,KAAoC,EACpC,GAAwB;YAExB,OAAO,aAAa,CAAC,OAAO,EAAE,EAAE,GAAG,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9E,CAAC,CAAC;KACH,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import type { PropsWithoutRef } from 'react';\n\nimport type { PopoverProps } from '@pega/cosmos-react-core';\n\njest.mock('@pega/cosmos-react-core/lib/components/Popover/Popover', () => {\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 { default: Popover, ...mod } = jest.requireActual<\n typeof import('@pega/cosmos-react-core/lib/components/Popover/Popover')\n >('@pega/cosmos-react-core/lib/components/Popover/Popover');\n\n return {\n __esModule: true,\n ...mod,\n default: forwardRef(function PopoverMock(\n props: PropsWithoutRef<PopoverProps>,\n ref: PopoverProps['ref']\n ) {\n return createElement(Popover, { ...props, hideOnTargetHidden: false, ref });\n })\n };\n});\n"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=qrcodeMock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qrcodeMock.d.ts","sourceRoot":"","sources":["../../src/mocks/qrcodeMock.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ jest.mock('qrcode', () => ({
3
+ toDataURL: () => Promise.resolve('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHQAAAB0CAYAAABUmhYnAAAAAklEQVR4AewaftIAAAK8SURBVO3BQWrgUAwFwX7C979yzyy1+mBsh0SoKv7HGqNYoxRrlGKNUqxRijVKsUYp1ijFGqVYoxRrlGKNUqxRijVKsUYp1igXDyXhJ6l0SehUTpJwotIl4SepPFGsUYo1SrFGuXiZypuScKLSJaFT6VSeUHlTEt5UrFGKNUqxRrn4WBLuUPlSEjqVJ5Jwh8qXijVKsUYp1igXf1wSOpUTlcmKNUqxRinWKBfDJaFT6ZLQqfxlxRqlWKMUa5SLj6n8JknoVJ5Q+U2KNUqxRinWKBcvS8JvptIloVM5ScJvVqxRijVKsUa5eEjlN0lCp9Il4Q6Vv6RYoxRrlGKNcvFQEjqVO5LQqXRJuEOlS8KJSpeEN6mcJKFTeaJYoxRrlGKNcvGxJNyRhE7lJAknKl0SuiR0Km9KQqfypWKNUqxRijXKxcuS0Kl0SehUTpJwovKEykkS3pSETuVNxRqlWKMUa5SLl6mcqHRJ6FQ6lS4JXRLuUDlJwolKl4QTlS4JXyrWKMUapVijxP/4UBK+pNIl4USlS8ITKnck4UTliWKNUqxRijXKxcdUvpSETuVLKl0SOpUuCZ1Kl4Q3FWuUYo1SrFEuHkrCT1I5SUKn8oTKHUnoVLokdCpvKtYoxRqlWKNcvEzlTUk4UemScJKEE5WTJJyo3JGETuWJYo1SrFGKNcrFx5Jwh8odSThJwonKSRJOVE6S0Kl0SXhTsUYp1ijFGuXij1PpktCpdEnoktCpdConSehUTpLwpWKNUqxRijXKxTAqd6icJKFTeULlS8UapVijFGuUi4+p/KQkdCqdykkS7lA5UflJxRqlWKMUa5SLlyXhJyWhU+mS0Kl0SbgjCScqdyShU3miWKMUa5RijRL/Y41RrFGKNUqxRinWKMUapVijFGuUYo1SrFGKNUqxRinWKMUapVijFGuUf87PEfneycvhAAAAAElFTkSuQmCC')
4
+ }));
5
+ //# sourceMappingURL=qrcodeMock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qrcodeMock.js","sourceRoot":"","sources":["../../src/mocks/qrcodeMock.ts"],"names":[],"mappings":";AAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;IACzB,SAAS,EAAE,GAAG,EAAE,CACd,OAAO,CAAC,OAAO,CACb,4hCAA4hC,CAC7hC;CACJ,CAAC,CAAC,CAAC","sourcesContent":["jest.mock('qrcode', () => ({\n toDataURL: () =>\n Promise.resolve(\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHQAAAB0CAYAAABUmhYnAAAAAklEQVR4AewaftIAAAK8SURBVO3BQWrgUAwFwX7C979yzyy1+mBsh0SoKv7HGqNYoxRrlGKNUqxRijVKsUYp1ijFGqVYoxRrlGKNUqxRijVKsUYp1igXDyXhJ6l0SehUTpJwotIl4SepPFGsUYo1SrFGuXiZypuScKLSJaFT6VSeUHlTEt5UrFGKNUqxRrn4WBLuUPlSEjqVJ5Jwh8qXijVKsUYp1igXf1wSOpUTlcmKNUqxRinWKBfDJaFT6ZLQqfxlxRqlWKMUa5SLj6n8JknoVJ5Q+U2KNUqxRinWKBcvS8JvptIloVM5ScJvVqxRijVKsUa5eEjlN0lCp9Il4Q6Vv6RYoxRrlGKNcvFQEjqVO5LQqXRJuEOlS8KJSpeEN6mcJKFTeaJYoxRrlGKNcvGxJNyRhE7lJAknKl0SuiR0Km9KQqfypWKNUqxRijXKxcuS0Kl0SehUTpJwovKEykkS3pSETuVNxRqlWKMUa5SLl6mcqHRJ6FQ6lS4JXRLuUDlJwolKl4QTlS4JXyrWKMUapVijxP/4UBK+pNIl4USlS8ITKnck4UTliWKNUqxRijXKxcdUvpSETuVLKl0SOpUuCZ1Kl4Q3FWuUYo1SrFEuHkrCT1I5SUKn8oTKHUnoVLokdCpvKtYoxRqlWKNcvEzlTUk4UemScJKEE5WTJJyo3JGETuWJYo1SrFGKNcrFx5Jwh8odSThJwonKSRJOVE6S0Kl0SXhTsUYp1ijFGuXij1PpktCpdEnoktCpdConSehUTpLwpWKNUqxRijXKxTAqd6icJKFTeULlS8UapVijFGuUi4+p/KQkdCqdykkS7lA5UflJxRqlWKMUa5SLlyXhJyWhU+mS0Kl0SbgjCScqdyShU3miWKMUa5RijRL/Y41RrFGKNUqxRinWKMUapVijFGuUYo1SrFGKNUqxRinWKMUapVijFGuUf87PEfneycvhAAAAAElFTkSuQmCC'\n )\n}));\n"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=resizeObserverMock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resizeObserverMock.d.ts","sourceRoot":"","sources":["../../src/mocks/resizeObserverMock.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ window.ResizeObserver = jest.fn(() => ({
3
+ observe: () => { },
4
+ unobserve: () => { },
5
+ disconnect: () => { }
6
+ }));
7
+ //# sourceMappingURL=resizeObserverMock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resizeObserverMock.js","sourceRoot":"","sources":["../../src/mocks/resizeObserverMock.ts"],"names":[],"mappings":";AAAA,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;IACrC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;IACjB,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;IACnB,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;CACrB,CAAC,CAAC,CAAC","sourcesContent":["window.ResizeObserver = jest.fn(() => ({\n observe: () => {},\n unobserve: () => {},\n disconnect: () => {}\n}));\n"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=useBreakpointMock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBreakpointMock.d.ts","sourceRoot":"","sources":["../../src/mocks/useBreakpointMock.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ jest.mock('@pega/cosmos-react-core/lib/hooks', () => {
3
+ const { themeDefinition } = jest.requireActual('@pega/cosmos-react-core/lib/theme');
4
+ return {
5
+ __esModule: true,
6
+ ...jest.requireActual('@pega/cosmos-react-core/lib/hooks'),
7
+ useBreakpoint: (bp) => {
8
+ return (window.innerWidth / 16 >= Number.parseFloat(themeDefinition.base.breakpoints[bp].$value));
9
+ }
10
+ };
11
+ });
12
+ //# sourceMappingURL=useBreakpointMock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBreakpointMock.js","sourceRoot":"","sources":["../../src/mocks/useBreakpointMock.ts"],"names":[],"mappings":";AAAA,IAAI,CAAC,IAAI,CAAC,mCAAmC,EAAE,GAAG,EAAE;IAClD,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,aAAa,CAE5C,mCAAmC,CAAC,CAAC;IAEvC,OAAO;QACL,UAAU,EAAE,IAAI;QAChB,GAAG,IAAI,CAAC,aAAa,CACnB,mCAAmC,CACpC;QAED,aAAa,EAAE,CAAC,EAAiD,EAAE,EAAE;YACnE,OAAO,CACL,MAAM,CAAC,UAAU,GAAG,EAAE,IAAI,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CACzF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["jest.mock('@pega/cosmos-react-core/lib/hooks', () => {\n const { themeDefinition } = jest.requireActual<\n typeof import('@pega/cosmos-react-core/lib/theme')\n >('@pega/cosmos-react-core/lib/theme');\n\n return {\n __esModule: true,\n ...jest.requireActual<typeof import('@pega/cosmos-react-core/lib/hooks')>(\n '@pega/cosmos-react-core/lib/hooks'\n ),\n\n useBreakpoint: (bp: keyof typeof themeDefinition.base.breakpoints) => {\n return (\n window.innerWidth / 16 >= Number.parseFloat(themeDefinition.base.breakpoints[bp].$value)\n );\n }\n };\n});\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './utils';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './utils';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC","sourcesContent":["export * from './utils';\n"]}
@@ -0,0 +1,11 @@
1
+ import { ReactElement } from 'react';
2
+ import { type RenderOptions as RTLRenderOptions } from '@testing-library/react';
3
+ import { 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>;
9
+ export declare const resizeWindow: (x: number, y: number) => void;
10
+ export {};
11
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAEL,KAAK,aAAa,IAAI,gBAAgB,EACvC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAEL,kBAAkB,EAElB,UAAU,EAGX,MAAM,yBAAyB,CAAC;AAEjC,UAAU,aAAa;IACrB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,kBAAkB,CAAC,EAAE,UAAU,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;CACjE;AAED,eAAO,MAAM,MAAM,YAAa,YAAY,YAAW,aAAa,iIAWnE,CAAC;AAEF,eAAO,MAAM,YAAY,MAAO,MAAM,KAAK,MAAM,SAIhD,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { render as rtlRender } from '@testing-library/react';
3
+ import { Configuration, ModalManager, PopoverManager, Toaster } from '@pega/cosmos-react-core';
4
+ export const render = (content, options = {}) => {
5
+ return rtlRender(_jsx(Configuration, { ...options.configurationProps, children: _jsx(PopoverManager, { children: _jsx(Toaster, { dismissAfter: 5000, children: _jsx(ModalManager, { children: content }) }) }) }), options.rtlRenderOptions);
6
+ };
7
+ export const resizeWindow = (x, y) => {
8
+ window.innerWidth = x;
9
+ window.innerHeight = y;
10
+ window.dispatchEvent(new Event('resize'));
11
+ };
12
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,MAAM,IAAI,SAAS,EAEpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,aAAa,EAEb,YAAY,EAEZ,cAAc,EACd,OAAO,EACR,MAAM,yBAAyB,CAAC;AAOjC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,OAAqB,EAAE,UAAyB,EAAE,EAAE,EAAE;IAC3E,OAAO,SAAS,CACd,KAAC,aAAa,OAAK,OAAO,CAAC,kBAAkB,YAC3C,KAAC,cAAc,cACb,KAAC,OAAO,IAAC,YAAY,EAAE,IAAI,YACzB,KAAC,YAAY,cAAE,OAAO,GAAgB,GAC9B,GACK,GACH,EAChB,OAAO,CAAC,gBAAgB,CACzB,CAAC;AACJ,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 { ReactElement } from 'react';\nimport {\n render as rtlRender,\n type RenderOptions as RTLRenderOptions\n} from '@testing-library/react';\n\nimport {\n Configuration,\n ConfigurationProps,\n ModalManager,\n OmitStrict,\n PopoverManager,\n Toaster\n} from '@pega/cosmos-react-core';\n\ninterface RenderOptions {\n rtlRenderOptions?: RTLRenderOptions;\n configurationProps?: OmitStrict<ConfigurationProps, 'children'>;\n}\n\nexport const render = (content: ReactElement, options: RenderOptions = {}) => {\n return rtlRender(\n <Configuration {...options.configurationProps}>\n <PopoverManager>\n <Toaster dismissAfter={5000}>\n <ModalManager>{content}</ModalManager>\n </Toaster>\n </PopoverManager>\n </Configuration>,\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-test-utils",
3
- "version": "5.0.0-dev.4.9",
3
+ "version": "5.0.0-dev.5.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/pegasystems/cosmos-react.git",
@@ -22,7 +22,7 @@
22
22
  "build": "tsc -b"
23
23
  },
24
24
  "dependencies": {
25
- "@pega/cosmos-react-core": "5.0.0-dev.4.9",
25
+ "@pega/cosmos-react-core": "5.0.0-dev.5.0",
26
26
  "@testing-library/react": "^12.1.3",
27
27
  "@types/jest": "^29.5.1",
28
28
  "@types/react": "^17.0.62",