@pega/cosmos-react-test-utils 8.0.0-build.2.0 → 8.0.0-build.20.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 (39) hide show
  1. package/lib/index.d.ts +1 -0
  2. package/lib/index.d.ts.map +1 -1
  3. package/lib/index.js +1 -0
  4. package/lib/index.js.map +1 -1
  5. package/lib/matchers/index.d.ts +3 -0
  6. package/lib/matchers/index.d.ts.map +1 -0
  7. package/lib/matchers/index.js +7 -0
  8. package/lib/matchers/index.js.map +1 -0
  9. package/lib/matchers/to-contain-assertive-log.d.ts +29 -0
  10. package/lib/matchers/to-contain-assertive-log.d.ts.map +1 -0
  11. package/lib/matchers/to-contain-assertive-log.js +18 -0
  12. package/lib/matchers/to-contain-assertive-log.js.map +1 -0
  13. package/lib/mocks/createObjectURL.d.ts +1 -0
  14. package/lib/mocks/createObjectURL.d.ts.map +1 -0
  15. package/lib/mocks/createObjectURL.js +4 -0
  16. package/lib/mocks/createObjectURL.js.map +1 -0
  17. package/lib/mocks/getCurrentPositionMock.d.ts +2 -0
  18. package/lib/mocks/getCurrentPositionMock.d.ts.map +1 -0
  19. package/lib/mocks/getCurrentPositionMock.js +24 -0
  20. package/lib/mocks/getCurrentPositionMock.js.map +1 -0
  21. package/lib/mocks/index.d.ts +4 -0
  22. package/lib/mocks/index.d.ts.map +1 -1
  23. package/lib/mocks/index.js +4 -0
  24. package/lib/mocks/index.js.map +1 -1
  25. package/lib/mocks/mapsAPILoaderMock.d.ts +1 -0
  26. package/lib/mocks/mapsAPILoaderMock.d.ts.map +1 -0
  27. package/lib/mocks/mapsAPILoaderMock.js +10 -0
  28. package/lib/mocks/mapsAPILoaderMock.js.map +1 -0
  29. package/lib/mocks/randomUUID.d.ts +2 -0
  30. package/lib/mocks/randomUUID.d.ts.map +1 -0
  31. package/lib/mocks/randomUUID.js +3 -0
  32. package/lib/mocks/randomUUID.js.map +1 -0
  33. package/lib/mocks/useBreakpointMock.js +2 -3
  34. package/lib/mocks/useBreakpointMock.js.map +1 -1
  35. package/lib/utils/utils.d.ts +1 -0
  36. package/lib/utils/utils.d.ts.map +1 -1
  37. package/lib/utils/utils.js +4 -0
  38. package/lib/utils/utils.js.map +1 -1
  39. package/package.json +13 -9
package/lib/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ export * from './matchers';
1
2
  export * from './utils';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
package/lib/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  // This file is autogenerated. Any changes will be overwritten.
2
+ export * from './matchers';
2
3
  export * from './utils';
3
4
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC","sourcesContent":["// This file is autogenerated. Any changes will be overwritten.\nexport * from './matchers';\nexport * from './utils';\n"]}
@@ -0,0 +1,3 @@
1
+ import toContainAssertiveLog from './to-contain-assertive-log';
2
+ export { toContainAssertiveLog };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/matchers/index.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAO/D,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import toContainAssertiveLog from './to-contain-assertive-log';
2
+ expect.extend({
3
+ toContainAssertiveLog
4
+ });
5
+ // eslint-disable-next-line import/prefer-default-export
6
+ export { toContainAssertiveLog };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/matchers/index.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAE/D,MAAM,CAAC,MAAM,CAAC;IACZ,qBAAqB;CACtB,CAAC,CAAC;AAEH,wDAAwD;AACxD,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import toContainAssertiveLog from './to-contain-assertive-log';\n\nexpect.extend({\n toContainAssertiveLog\n});\n\n// eslint-disable-next-line import/prefer-default-export\nexport { toContainAssertiveLog };\n"]}
@@ -0,0 +1,29 @@
1
+ declare global {
2
+ namespace jest {
3
+ interface Matchers<R> {
4
+ /**
5
+ * @description
6
+ * This allows you to check if given element of type 'log' does contain assertive text.
7
+ *
8
+ * @example
9
+ * <div
10
+ * role='log'
11
+ * >
12
+ * Invisible content
13
+ * </div>
14
+ *
15
+ * <div data-testid="visible">Visible Example</div>
16
+ *
17
+ * expect(getByRole('log')).toContainAssertiveLog('Value cannot be empty.')
18
+ * expect(getByRole('log')).not.toContainAssertiveLog('Value cannot be empty.')
19
+ */
20
+ toContainAssertiveLog: (expected: string) => R;
21
+ }
22
+ }
23
+ }
24
+ declare function toContainAssertiveLog(this: jest.MatcherContext, actual: HTMLElement[], expected: string): {
25
+ message: () => string;
26
+ pass: boolean;
27
+ };
28
+ export default toContainAssertiveLog;
29
+ //# sourceMappingURL=to-contain-assertive-log.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to-contain-assertive-log.d.ts","sourceRoot":"","sources":["../../src/matchers/to-contain-assertive-log.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,IAAI,CAAC;QACb,UAAU,QAAQ,CAAC,CAAC;YAClB;;;;;;;;;;;;;;;eAeG;YACH,qBAAqB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,CAAC,CAAC;SAChD;KACF;CACF;AAED,iBAAS,qBAAqB,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,MAAM;;;EAmBhG;AAED,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import chalk from 'chalk';
2
+ function toContainAssertiveLog(actual, expected) {
3
+ const logFound = actual.find(el => {
4
+ return el.getAttribute('aria-live') === 'assertive';
5
+ });
6
+ if (logFound && logFound.textContent && logFound.textContent.includes(expected)) {
7
+ return {
8
+ message: () => `Expected LiveLog to contain an assertive log that matches "${expected}"`,
9
+ pass: true
10
+ };
11
+ }
12
+ return {
13
+ message: () => `Expected substring: ${chalk.green(expected)}\nReceived string: ${chalk.red(logFound && logFound.textContent ? logFound.textContent : 'undefined')}`,
14
+ pass: false
15
+ };
16
+ }
17
+ export default toContainAssertiveLog;
18
+ //# sourceMappingURL=to-contain-assertive-log.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to-contain-assertive-log.js","sourceRoot":"","sources":["../../src/matchers/to-contain-assertive-log.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AA0B1B,SAAS,qBAAqB,CAA4B,MAAqB,EAAE,QAAgB;IAC/F,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;QAChC,OAAO,EAAE,CAAC,YAAY,CAAC,WAAW,CAAC,KAAK,WAAW,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,IAAI,QAAQ,IAAI,QAAQ,CAAC,WAAW,IAAI,QAAQ,CAAC,WAAW,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChF,OAAO;YACL,OAAO,EAAE,GAAG,EAAE,CAAC,8DAA8D,QAAQ,GAAG;YACxF,IAAI,EAAE,IAAI;SACX,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,GAAG,EAAE,CACZ,uBAAuB,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,sBAAsB,KAAK,CAAC,GAAG,CACzE,QAAQ,IAAI,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CACtE,EAAE;QACL,IAAI,EAAE,KAAK;KACZ,CAAC;AACJ,CAAC;AAED,eAAe,qBAAqB,CAAC","sourcesContent":["import chalk from 'chalk';\n\ndeclare global {\n namespace jest {\n interface Matchers<R> {\n /**\n * @description\n * This allows you to check if given element of type 'log' does contain assertive text.\n *\n * @example\n * <div\n * role='log'\n * >\n * Invisible content\n * </div>\n *\n * <div data-testid=\"visible\">Visible Example</div>\n *\n * expect(getByRole('log')).toContainAssertiveLog('Value cannot be empty.')\n * expect(getByRole('log')).not.toContainAssertiveLog('Value cannot be empty.')\n */\n toContainAssertiveLog: (expected: string) => R;\n }\n }\n}\n\nfunction toContainAssertiveLog(this: jest.MatcherContext, actual: HTMLElement[], expected: string) {\n const logFound = actual.find(el => {\n return el.getAttribute('aria-live') === 'assertive';\n });\n\n if (logFound && logFound.textContent && logFound.textContent.includes(expected)) {\n return {\n message: () => `Expected LiveLog to contain an assertive log that matches \"${expected}\"`,\n pass: true\n };\n }\n\n return {\n message: () =>\n `Expected substring: ${chalk.green(expected)}\\nReceived string: ${chalk.red(\n logFound && logFound.textContent ? logFound.textContent : 'undefined'\n )}`,\n pass: false\n };\n}\n\nexport default toContainAssertiveLog;\n"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=createObjectURL.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createObjectURL.d.ts","sourceRoot":"","sources":["../../src/mocks/createObjectURL.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ URL.createObjectURL = () => '';
3
+ URL.revokeObjectURL = () => { };
4
+ //# sourceMappingURL=createObjectURL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createObjectURL.js","sourceRoot":"","sources":["../../src/mocks/createObjectURL.ts"],"names":[],"mappings":";AAAA,GAAG,CAAC,eAAe,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC;AAC/B,GAAG,CAAC,eAAe,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC","sourcesContent":["URL.createObjectURL = () => '';\nURL.revokeObjectURL = () => {};\n"]}
@@ -0,0 +1,2 @@
1
+ declare const getCurrentPositionMock: Geolocation['getCurrentPosition'];
2
+ //# sourceMappingURL=getCurrentPositionMock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCurrentPositionMock.d.ts","sourceRoot":"","sources":["../../src/mocks/getCurrentPositionMock.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,sBAAsB,EAAE,WAAW,CAAC,oBAAoB,CAa7D,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ const getCurrentPositionMock = successCallback => {
3
+ successCallback({
4
+ coords: {
5
+ latitude: 0,
6
+ longitude: 0,
7
+ accuracy: 1,
8
+ heading: null,
9
+ altitude: null,
10
+ altitudeAccuracy: null,
11
+ speed: null
12
+ },
13
+ timestamp: Date.now()
14
+ });
15
+ };
16
+ Object.defineProperty(globalThis.navigator, 'geolocation', {
17
+ value: {
18
+ getCurrentPosition: getCurrentPositionMock,
19
+ watchPosition: () => { },
20
+ clearWatch: () => { }
21
+ },
22
+ configurable: true
23
+ });
24
+ //# sourceMappingURL=getCurrentPositionMock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCurrentPositionMock.js","sourceRoot":"","sources":["../../src/mocks/getCurrentPositionMock.ts"],"names":[],"mappings":";AAAA,MAAM,sBAAsB,GAAsC,eAAe,CAAC,EAAE;IAClF,eAAe,CAAC;QACd,MAAM,EAAE;YACN,QAAQ,EAAE,CAAC;YACX,SAAS,EAAE,CAAC;YACZ,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,gBAAgB,EAAE,IAAI;YACtB,KAAK,EAAE,IAAI;SACZ;QACD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACtB,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,SAAS,EAAE,aAAa,EAAE;IACzD,KAAK,EAAE;QACL,kBAAkB,EAAE,sBAAsB;QAC1C,aAAa,EAAE,GAAG,EAAE,GAAE,CAAC;QACvB,UAAU,EAAE,GAAG,EAAE,GAAE,CAAC;KACrB;IACD,YAAY,EAAE,IAAI;CACnB,CAAC,CAAC","sourcesContent":["const getCurrentPositionMock: Geolocation['getCurrentPosition'] = successCallback => {\n successCallback({\n coords: {\n latitude: 0,\n longitude: 0,\n accuracy: 1,\n heading: null,\n altitude: null,\n altitudeAccuracy: null,\n speed: null\n },\n timestamp: Date.now()\n });\n};\n\nObject.defineProperty(globalThis.navigator, 'geolocation', {\n value: {\n getCurrentPosition: getCurrentPositionMock,\n watchPosition: () => {},\n clearWatch: () => {}\n },\n configurable: true\n});\n"]}
@@ -1,11 +1,15 @@
1
+ import './createObjectURL';
1
2
  import './createRange';
2
3
  import './createUIDMock';
3
4
  import './elementFromPointMock';
5
+ import './getCurrentPositionMock';
4
6
  import './iconMock';
5
7
  import './intersectionObserverMock';
8
+ import './mapsAPILoaderMock';
6
9
  import './matchMediaMock';
7
10
  import './popoverMock';
8
11
  import './qrcodeMock';
12
+ import './randomUUID';
9
13
  import './scrollIntoView';
10
14
  import './svgGetBBox';
11
15
  import './svgGetScreenCTM';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,iBAAiB,CAAC;AACzB,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,kBAAkB,CAAC;AAC1B,OAAO,cAAc,CAAC;AACtB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,yBAAyB,CAAC;AACjC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA,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,4BAA4B,CAAC;AACpC,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,qBAAqB,CAAC"}
@@ -1,11 +1,15 @@
1
+ import './createObjectURL';
1
2
  import './createRange';
2
3
  import './createUIDMock';
3
4
  import './elementFromPointMock';
5
+ import './getCurrentPositionMock';
4
6
  import './iconMock';
5
7
  import './intersectionObserverMock';
8
+ import './mapsAPILoaderMock';
6
9
  import './matchMediaMock';
7
10
  import './popoverMock';
8
11
  import './qrcodeMock';
12
+ import './randomUUID';
9
13
  import './scrollIntoView';
10
14
  import './svgGetBBox';
11
15
  import './svgGetScreenCTM';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,iBAAiB,CAAC;AACzB,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,kBAAkB,CAAC;AAC1B,OAAO,cAAc,CAAC;AACtB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,yBAAyB,CAAC;AACjC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,qBAAqB,CAAC","sourcesContent":["import './createRange';\nimport './createUIDMock';\nimport './elementFromPointMock';\nimport './iconMock';\nimport './intersectionObserverMock';\nimport './matchMediaMock';\nimport './popoverMock';\nimport './qrcodeMock';\nimport './scrollIntoView';\nimport './svgGetBBox';\nimport './svgGetScreenCTM';\nimport './svgGetSubStringLength';\nimport './resizeObserverMock';\nimport './useBreakpointMock';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mocks/index.ts"],"names":[],"mappings":"AAAA,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,4BAA4B,CAAC;AACpC,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,qBAAqB,CAAC","sourcesContent":["import './createObjectURL';\nimport './createRange';\nimport './createUIDMock';\nimport './elementFromPointMock';\nimport './getCurrentPositionMock';\nimport './iconMock';\nimport './intersectionObserverMock';\nimport './mapsAPILoaderMock';\nimport './matchMediaMock';\nimport './popoverMock';\nimport './qrcodeMock';\nimport './randomUUID';\nimport './scrollIntoView';\nimport './svgGetBBox';\nimport './svgGetScreenCTM';\nimport './svgGetSubStringLength';\nimport './resizeObserverMock';\nimport './useBreakpointMock';\n"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=mapsAPILoaderMock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapsAPILoaderMock.d.ts","sourceRoot":"","sources":["../../src/mocks/mapsAPILoaderMock.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ jest.mock('@googlemaps/js-api-loader', () => ({
3
+ Loader: class LoaderMock {
4
+ // eslint-disable-next-line class-methods-use-this
5
+ async load() {
6
+ return Promise.resolve();
7
+ }
8
+ }
9
+ }));
10
+ //# sourceMappingURL=mapsAPILoaderMock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapsAPILoaderMock.js","sourceRoot":"","sources":["../../src/mocks/mapsAPILoaderMock.ts"],"names":[],"mappings":";AAAA,IAAI,CAAC,IAAI,CAAC,2BAA2B,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5C,MAAM,EAAE,MAAM,UAAU;QACtB,kDAAkD;QAClD,KAAK,CAAC,IAAI;YACR,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;KACF;CACF,CAAC,CAAC,CAAC","sourcesContent":["jest.mock('@googlemaps/js-api-loader', () => ({\n Loader: class LoaderMock {\n // eslint-disable-next-line class-methods-use-this\n async load() {\n return Promise.resolve();\n }\n }\n}));\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=randomUUID.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomUUID.d.ts","sourceRoot":"","sources":["../../src/mocks/randomUUID.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ window.crypto.randomUUID = () => randomUUID();
3
+ //# sourceMappingURL=randomUUID.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"randomUUID.js","sourceRoot":"","sources":["../../src/mocks/randomUUID.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,MAAM,CAAC,UAAU,GAAG,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC","sourcesContent":["import { randomUUID } from 'node:crypto';\n\nwindow.crypto.randomUUID = () => randomUUID();\n"]}
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
- jest.mock('@pega/cosmos-react-core/lib/hooks', () => {
2
+ jest.mock('@pega/cosmos-react-core/lib/hooks/useBreakpoint', () => {
3
3
  const { themeDefinition } = jest.requireActual('@pega/cosmos-react-core/lib/theme');
4
4
  return {
5
5
  __esModule: true,
6
- ...jest.requireActual('@pega/cosmos-react-core/lib/hooks'),
7
- useBreakpoint: (bp) => {
6
+ default: (bp) => {
8
7
  return (window.innerWidth / 16 >= Number.parseFloat(themeDefinition.base.breakpoints[bp].$value));
9
8
  }
10
9
  };
@@ -1 +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"]}
1
+ {"version":3,"file":"useBreakpointMock.js","sourceRoot":"","sources":["../../src/mocks/useBreakpointMock.ts"],"names":[],"mappings":";AAAA,IAAI,CAAC,IAAI,CAAC,iDAAiD,EAAE,GAAG,EAAE;IAChE,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,aAAa,CAE5C,mCAAmC,CAAC,CAAC;IAEvC,OAAO;QACL,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,CAAC,EAAiD,EAAE,EAAE;YAC7D,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/useBreakpoint', () => {\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 default: (bp: keyof typeof themeDefinition.base.breakpoints) => {\n return (\n window.innerWidth / 16 >= Number.parseFloat(themeDefinition.base.breakpoints[bp].$value)\n );\n }\n };\n});\n"]}
@@ -7,5 +7,6 @@ export declare function render(content: ReactElement, options?: OmitStrict<Rende
7
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>;
8
8
  export declare const resizeWindow: (x: number, y: number) => void;
9
9
  export declare const dragElement: (originEl: HTMLElement, destinationEl: HTMLElement) => void;
10
+ export declare const userEventNoPointer: import("@testing-library/user-event").UserEvent;
10
11
  export {};
11
12
  //# 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,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;AAiBjE,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;AAEF,eAAO,MAAM,WAAW,aAAc,WAAW,iBAAiB,WAAW,SAK5E,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;AAU7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE9E,KAAK,cAAc,GAAG,UAAU,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;AAiBjE,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;AAEF,eAAO,MAAM,WAAW,aAAc,WAAW,iBAAiB,WAAW,SAK5E,CAAC;AAEF,eAAO,MAAM,kBAAkB,iDAE7B,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { fireEvent, render as rtlRender } from '@testing-library/react';
3
+ import userEvent, { PointerEventsCheckLevel } from '@testing-library/user-event';
3
4
  import { Configuration, LiveLog, ModalManager, PopoverManager, Toaster } from '@pega/cosmos-react-core';
4
5
  const Providers = (configurationProps) => ({ children }) => (_jsx(Configuration, { ...configurationProps, children: _jsx(LiveLog, { children: _jsx(PopoverManager, { children: _jsx(Toaster, { dismissAfter: 5000, children: _jsx(ModalManager, { children: children }) }) }) }) }));
5
6
  export function render(content, options = {}, configurationProps) {
@@ -19,4 +20,7 @@ export const dragElement = (originEl, destinationEl) => {
19
20
  fireEvent.dragOver(destinationEl);
20
21
  fireEvent.drop(destinationEl);
21
22
  };
23
+ export const userEventNoPointer = userEvent.setup({
24
+ pointerEventsCheck: PointerEventsCheckLevel.Never
25
+ });
22
26
  //# sourceMappingURL=utils.js.map
@@ -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;AAIxE,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,CAAC,CAC5C,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;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","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';\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 <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\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"]}
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;AAKjC,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,OAAO,IAAC,YAAY,EAAE,IAAI,YACzB,KAAC,YAAY,cAAE,QAAQ,GAAgB,GAC/B,GACK,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 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 <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\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": "8.0.0-build.2.0",
3
+ "version": "8.0.0-build.20.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/pegasystems/cosmos-react.git",
@@ -22,16 +22,20 @@
22
22
  "build": "tsc -b tsconfig.build.json"
23
23
  },
24
24
  "dependencies": {
25
- "@pega/cosmos-react-core": "8.0.0-build.2.0",
26
- "@testing-library/dom": "^8.13.0",
27
- "@testing-library/react": "^12.1.3",
25
+ "@pega/cosmos-react-core": "8.0.0-build.20.0",
26
+ "@testing-library/dom": "^10.3.0",
27
+ "@testing-library/react": "^16.0.0",
28
+ "@testing-library/user-event": "^14.5.1",
28
29
  "@types/jest": "^29.5.1",
29
- "@types/react": "^17.0.62",
30
- "@types/react-dom": "^17.0.20",
31
- "react": "^17.0.0",
32
- "react-dom": "^17.0.0"
30
+ "@types/react": "^17.0.62 || ^18.3.3",
31
+ "@types/react-dom": "^17.0.20 || ^18.3.0",
32
+ "chalk": "^2.4.2",
33
+ "jest-styled-components": "^7.1.1",
34
+ "polished": "^4.1.0",
35
+ "react": "^17.0.0 || ^18.0.0",
36
+ "react-dom": "^17.0.0 || ^18.0.0"
33
37
  },
34
38
  "devDependencies": {
35
- "typescript": "~5.2.2"
39
+ "typescript": "~5.5.4"
36
40
  }
37
41
  }