@pega/cosmos-react-test-utils 9.0.0-build.29.2 → 9.0.0-build.29.21

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,2 +1 @@
1
- export {};
2
1
  //# sourceMappingURL=iconMock.d.ts.map
@@ -1,20 +1,15 @@
1
+ "use strict";
1
2
  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
+ // Should probably be using global require here in case these icon names are themselves being mocked,
3
4
  // but that requires including @types/node which throws off type checking for tests.
4
- const { createElement, forwardRef } = jest.requireActual('react');
5
+ const { default: iconNames } = jest.requireActual('@pega/cosmos-react-core/lib/components/Icon/iconNames');
6
+ const { default: streamlineIconNames } = jest.requireActual('@pega/cosmos-react-core/lib/components/Icon/streamlineIconNames');
5
7
  const mod = jest.requireActual('@pega/cosmos-react-core/lib/components/Icon/Icon');
8
+ // Register all icons as empty to avoid dynamic imports in tests.
9
+ mod.registerIcon(...iconNames.map(name => ({ set: 'budicon', name, Component: () => null })), ...streamlineIconNames.map(name => ({ set: 'streamline', name, Component: () => null })));
6
10
  return {
7
11
  __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
- })
12
+ ...mod
17
13
  };
18
14
  });
19
- export {};
20
15
  //# sourceMappingURL=iconMock.js.map
@@ -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,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"]}
1
+ {"version":3,"file":"iconMock.js","sourceRoot":"","sources":["../../src/mocks/iconMock.ts"],"names":[],"mappings":";AAAA,IAAI,CAAC,IAAI,CAAC,kDAAkD,EAAE,GAAG,EAAE;IACjE,qGAAqG;IACrG,oFAAoF;IACpF,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,aAAa,CAE/C,uDAAuD,CAAC,CAAC;IAC3D,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,GAAG,IAAI,CAAC,aAAa,CAEzD,iEAAiE,CAAC,CAAC;IAErE,MAAM,GAAG,GAAG,IAAI,CAAC,aAAa,CAC5B,kDAAkD,CACnD,CAAC;IAEF,iEAAiE;IACjE,GAAG,CAAC,YAAY,CACd,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,EAC3E,GAAG,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CACzF,CAAC;IAEF,OAAO;QACL,UAAU,EAAE,IAAI;QAChB,GAAG,GAAG;KACP,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["jest.mock('@pega/cosmos-react-core/lib/components/Icon/Icon', () => {\n // Should probably be using global require here in case these icon names are themselves being mocked,\n // but that requires including @types/node which throws off type checking for tests.\n const { default: iconNames } = jest.requireActual<\n typeof import('@pega/cosmos-react-core/lib/components/Icon/iconNames')\n >('@pega/cosmos-react-core/lib/components/Icon/iconNames');\n const { default: streamlineIconNames } = jest.requireActual<\n typeof import('@pega/cosmos-react-core/lib/components/Icon/streamlineIconNames')\n >('@pega/cosmos-react-core/lib/components/Icon/streamlineIconNames');\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 // Register all icons as empty to avoid dynamic imports in tests.\n mod.registerIcon(\n ...iconNames.map(name => ({ set: 'budicon', name, Component: () => null })),\n ...streamlineIconNames.map(name => ({ set: 'streamline', name, Component: () => null }))\n );\n\n return {\n __esModule: true,\n ...mod\n };\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-test-utils",
3
- "version": "9.0.0-build.29.2",
3
+ "version": "9.0.0-build.29.21",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "author": "Pegasystems",
6
6
  "sideEffects": [
@@ -17,7 +17,7 @@
17
17
  "build": "tsc -b tsconfig.build.json"
18
18
  },
19
19
  "dependencies": {
20
- "@pega/cosmos-react-core": "9.0.0-build.29.2",
20
+ "@pega/cosmos-react-core": "9.0.0-build.29.21",
21
21
  "@testing-library/dom": "^10.3.0",
22
22
  "@testing-library/react": "^16.0.0",
23
23
  "@testing-library/user-event": "^14.6.1",