@pega/cosmos-react-test-utils 5.0.0-dev.14.0 → 5.0.0-dev.15.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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=createUIDMock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createUIDMock.d.ts","sourceRoot":"","sources":["../../src/mocks/createUIDMock.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import createUID from '@pega/cosmos-react-core/lib/utils/createUID';
2
+ jest.mock('@pega/cosmos-react-core/lib/utils/createUID', () => {
3
+ const mod = jest.requireActual('@pega/cosmos-react-core/lib/utils/createUID');
4
+ return {
5
+ __esModule: true,
6
+ ...mod,
7
+ default: jest.fn(mod.default)
8
+ };
9
+ });
10
+ beforeEach(() => {
11
+ // Mock the implementation before each test, so count is reset and tests are isolated.
12
+ // We want the UID to stay somewhat unique, so we can use things like getByLabelText in tests.
13
+ let count = 0;
14
+ createUID.mockImplementation(() => {
15
+ count += 1;
16
+ return `mock-cosmos-uid-${count}`;
17
+ });
18
+ });
19
+ //# sourceMappingURL=createUIDMock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createUIDMock.js","sourceRoot":"","sources":["../../src/mocks/createUIDMock.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,6CAA6C,CAAC;AAEpE,IAAI,CAAC,IAAI,CAAC,6CAA6C,EAAE,GAAG,EAAE;IAC5D,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,CAC5B,6CAA6C,CAC9C,CAAC;IAEF,OAAO;QACL,UAAU,EAAE,IAAI;QAChB,GAAG,GAAG;QACN,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC;KAC9B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,GAAG,EAAE;IACd,sFAAsF;IACtF,8FAA8F;IAC9F,IAAI,KAAK,GAAG,CAAC,CAAC;IACb,SAAuB,CAAC,kBAAkB,CAAC,GAAG,EAAE;QAC/C,KAAK,IAAI,CAAC,CAAC;QACX,OAAO,mBAAmB,KAAK,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import createUID from '@pega/cosmos-react-core/lib/utils/createUID';\n\njest.mock('@pega/cosmos-react-core/lib/utils/createUID', () => {\n const mod = jest.requireActual<typeof import('@pega/cosmos-react-core/lib/utils/createUID')>(\n '@pega/cosmos-react-core/lib/utils/createUID'\n );\n\n return {\n __esModule: true,\n ...mod,\n default: jest.fn(mod.default)\n };\n});\n\nbeforeEach(() => {\n // Mock the implementation before each test, so count is reset and tests are isolated.\n // We want the UID to stay somewhat unique, so we can use things like getByLabelText in tests.\n let count = 0;\n (createUID as jest.Mock).mockImplementation(() => {\n count += 1;\n return `mock-cosmos-uid-${count}`;\n });\n});\n"]}
@@ -1,10 +1,14 @@
1
1
  import './createRange';
2
+ import './createUIDMock';
2
3
  import './elementFromPointMock';
3
4
  import './iconMock';
4
5
  import './intersectionObserverMock';
5
6
  import './matchMediaMock';
6
7
  import './popoverMock';
7
8
  import './qrcodeMock';
9
+ import './svgGetBBox';
10
+ import './svgGetScreenCTM';
11
+ import './svgGetSubStringLength';
8
12
  import './resizeObserverMock';
9
13
  import './useBreakpointMock';
10
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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"}
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,cAAc,CAAC;AACtB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,yBAAyB,CAAC;AACjC,OAAO,sBAAsB,CAAC;AAC9B,OAAO,qBAAqB,CAAC"}
@@ -1,10 +1,14 @@
1
1
  import './createRange';
2
+ import './createUIDMock';
2
3
  import './elementFromPointMock';
3
4
  import './iconMock';
4
5
  import './intersectionObserverMock';
5
6
  import './matchMediaMock';
6
7
  import './popoverMock';
7
8
  import './qrcodeMock';
9
+ import './svgGetBBox';
10
+ import './svgGetScreenCTM';
11
+ import './svgGetSubStringLength';
8
12
  import './resizeObserverMock';
9
13
  import './useBreakpointMock';
10
14
  //# sourceMappingURL=index.js.map
@@ -1 +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"]}
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,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 './svgGetBBox';\nimport './svgGetScreenCTM';\nimport './svgGetSubStringLength';\nimport './resizeObserverMock';\nimport './useBreakpointMock';\n"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=svgGetBBox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svgGetBBox.d.ts","sourceRoot":"","sources":["../../src/mocks/svgGetBBox.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ // JSDom mock for `getBBox` method on SVG graphic nodes
3
+ // https://developer.mozilla.org/en-US/docs/Web/API/SVGGraphicsElement/getBBox
4
+ // Need to attach to SVGElement.protype because JSDOM does not implement SVGGraphicsElement.
5
+ window.SVGElement.prototype.getBBox = () => ({
6
+ x: 0,
7
+ y: 0,
8
+ width: 10,
9
+ height: 10,
10
+ top: 0,
11
+ bottom: 10,
12
+ left: 0,
13
+ right: 10,
14
+ toJSON() {
15
+ return this;
16
+ }
17
+ });
18
+ //# sourceMappingURL=svgGetBBox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svgGetBBox.js","sourceRoot":"","sources":["../../src/mocks/svgGetBBox.ts"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,8EAA8E;AAE9E,4FAA4F;AAC3F,MAAM,CAAC,UAAU,CAAC,SAAgC,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC,CAAC;IACnE,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,EAAE;IACT,MAAM;QACJ,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC,CAAC","sourcesContent":["// JSDom mock for `getBBox` method on SVG graphic nodes\n// https://developer.mozilla.org/en-US/docs/Web/API/SVGGraphicsElement/getBBox\n\n// Need to attach to SVGElement.protype because JSDOM does not implement SVGGraphicsElement.\n(window.SVGElement.prototype as SVGGraphicsElement).getBBox = () => ({\n x: 0,\n y: 0,\n width: 10,\n height: 10,\n top: 0,\n bottom: 10,\n left: 0,\n right: 10,\n toJSON() {\n return this;\n }\n});\n"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=svgGetScreenCTM.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svgGetScreenCTM.d.ts","sourceRoot":"","sources":["../../src/mocks/svgGetScreenCTM.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ // JSDom Polyfill for `getScreenCTM` method on SVG graphic nodes
3
+ // https://developer.mozilla.org/en-US/docs/Web/API/SVGGraphicsElement
4
+ // Similar issue: https://github.com/apexcharts/react-apexcharts/issues/52#issuecomment-844757362
5
+ // Need to attach to SVGElement.protype because JSDOM does not implement SVGGraphicsElement.
6
+ window.SVGElement.prototype.getScreenCTM = () => ({
7
+ a: 0,
8
+ b: 0,
9
+ c: 0,
10
+ d: 0,
11
+ e: 0,
12
+ f: 0
13
+ });
14
+ //# sourceMappingURL=svgGetScreenCTM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svgGetScreenCTM.js","sourceRoot":"","sources":["../../src/mocks/svgGetScreenCTM.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sEAAsE;AACtE,iGAAiG;AAEjG,4FAA4F;AAC3F,MAAM,CAAC,UAAU,CAAC,SAAgC,CAAC,YAAY,GAAG,GAAG,EAAE,CACtE,CAAC;IACC,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;CACS,CAAA,CAAC","sourcesContent":["// JSDom Polyfill for `getScreenCTM` method on SVG graphic nodes\n// https://developer.mozilla.org/en-US/docs/Web/API/SVGGraphicsElement\n// Similar issue: https://github.com/apexcharts/react-apexcharts/issues/52#issuecomment-844757362\n\n// Need to attach to SVGElement.protype because JSDOM does not implement SVGGraphicsElement.\n(window.SVGElement.prototype as SVGGraphicsElement).getScreenCTM = () =>\n ({\n a: 0,\n b: 0,\n c: 0,\n d: 0,\n e: 0,\n f: 0\n } as DOMMatrix);\n"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=svgGetSubStringLength.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svgGetSubStringLength.d.ts","sourceRoot":"","sources":["../../src/mocks/svgGetSubStringLength.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ // JSDom Polyfill for `getSubStringLength` method on SVG text nodes
3
+ // https://developer.mozilla.org/en-US/docs/Web/API/SVGTextContentElement
4
+ // https://webplatform.github.io/docs/svg/methods/getSubStringLength/
5
+ // Need to attach to SVGElement.protype because JSDOM does not implement SVGTextContentElement.
6
+ window.SVGElement.prototype.getSubStringLength =
7
+ // Mock: Assumes each character takes 10px width on an average and returns the substring width
8
+ (charnum, nchars) => nchars * 10;
9
+ //# sourceMappingURL=svgGetSubStringLength.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"svgGetSubStringLength.js","sourceRoot":"","sources":["../../src/mocks/svgGetSubStringLength.ts"],"names":[],"mappings":";AAAA,mEAAmE;AACnE,yEAAyE;AACzE,qEAAqE;AAErE,+FAA+F;AAC9F,MAAM,CAAC,UAAU,CAAC,SAAmC,CAAC,kBAAkB;IACvE,8FAA8F;IAC9F,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC","sourcesContent":["// JSDom Polyfill for `getSubStringLength` method on SVG text nodes\n// https://developer.mozilla.org/en-US/docs/Web/API/SVGTextContentElement\n// https://webplatform.github.io/docs/svg/methods/getSubStringLength/\n\n// Need to attach to SVGElement.protype because JSDOM does not implement SVGTextContentElement.\n(window.SVGElement.prototype as SVGTextContentElement).getSubStringLength =\n // Mock: Assumes each character takes 10px width on an average and returns the substring width\n (charnum, nchars) => nchars * 10;\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.14.0",
3
+ "version": "5.0.0-dev.15.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/pegasystems/cosmos-react.git",
@@ -21,7 +21,7 @@
21
21
  "build": "tsc -b tsconfig.build.json"
22
22
  },
23
23
  "dependencies": {
24
- "@pega/cosmos-react-core": "5.0.0-dev.14.0",
24
+ "@pega/cosmos-react-core": "5.0.0-dev.15.1",
25
25
  "@testing-library/dom": "^8.13.0",
26
26
  "@testing-library/react": "^12.1.3",
27
27
  "@types/jest": "^29.5.1",