@dynatrace/strato-components-testing 1.5.1 → 1.6.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,18 +1,18 @@
1
+ import { Fragment, jsx } from "react/jsx-runtime";
1
2
  import {
2
3
  render as rtlRender
3
4
  } from "@testing-library/react";
4
- import React from "react";
5
5
  import { IntlProvider } from "react-intl";
6
6
  const AllProviders = ({
7
7
  children,
8
8
  locale = "en",
9
9
  timeZone = "UTC"
10
10
  }) => {
11
- return /* @__PURE__ */ React.createElement(IntlProvider, { locale, timeZone }, children);
11
+ return /* @__PURE__ */ jsx(IntlProvider, { locale, timeZone, children });
12
12
  };
13
13
  const DefaultWrapper = (props) => (
14
14
  // eslint-disable-next-line react/jsx-no-useless-fragment
15
- /* @__PURE__ */ React.createElement(React.Fragment, null, props.children)
15
+ /* @__PURE__ */ jsx(Fragment, { children: props.children })
16
16
  );
17
17
  const customRender = (ui, {
18
18
  locale = "en",
@@ -20,7 +20,7 @@ const customRender = (ui, {
20
20
  wrapper: CustomWrapper = DefaultWrapper,
21
21
  ...renderOptions
22
22
  } = {}) => rtlRender(ui, {
23
- wrapper: ({ children }) => /* @__PURE__ */ React.createElement(AllProviders, { locale, timeZone }, /* @__PURE__ */ React.createElement(CustomWrapper, null, children)),
23
+ wrapper: ({ children }) => /* @__PURE__ */ jsx(AllProviders, { locale, timeZone, children: /* @__PURE__ */ jsx(CustomWrapper, { children }) }),
24
24
  ...renderOptions
25
25
  });
26
26
  export {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/jest/custom-render.tsx"],
4
4
  "sourcesContent": ["/* eslint-disable no-restricted-imports */\nimport {\n render as rtlRender,\n RenderOptions,\n RenderResult,\n} from '@testing-library/react';\nimport React, { PropsWithChildren } from 'react';\nimport { IntlProvider } from 'react-intl';\n\ninterface AllProvidersProps {\n locale?: string;\n timeZone?: string;\n}\n\n/** The wrapper component to always have the providers in place */\nconst AllProviders = ({\n children,\n locale = 'en',\n timeZone = 'UTC',\n}: PropsWithChildren<AllProvidersProps>) => {\n return (\n <IntlProvider locale={locale} timeZone={timeZone}>\n {children}\n </IntlProvider>\n );\n};\n\n/**\n * @public\n */\nexport type RenderWithIntlOptions = {\n locale?: string;\n timeZone?: string;\n} & Omit<RenderOptions, 'queries'>;\n\nconst DefaultWrapper = (props: PropsWithChildren<unknown>) => (\n // eslint-disable-next-line react/jsx-no-useless-fragment\n <>{props.children}</>\n);\n\n/**\n * Wrapper to render components with all required providers\n * @public\n */\nexport const customRender = (\n ui: React.ReactElement,\n {\n locale = 'en',\n timeZone = 'UTC',\n wrapper: CustomWrapper = DefaultWrapper,\n ...renderOptions\n }: RenderWithIntlOptions = {},\n): RenderResult =>\n rtlRender(ui, {\n wrapper: ({ children }) => (\n <AllProviders locale={locale} timeZone={timeZone}>\n <CustomWrapper>{children}</CustomWrapper>\n </AllProviders>\n ),\n ...renderOptions,\n });\n"],
5
- "mappings": "AACA;AAAA,EACE,UAAU;AAAA,OAGL;AACP,OAAO,WAAkC;AACzC,SAAS,oBAAoB;AAQ7B,MAAM,eAAe,CAAC;AAAA,EACpB;AAAA,EACA,SAAS;AAAA,EACT,WAAW;AACb,MAA4C;AAC1C,SACE,oCAAC,gBAAa,QAAgB,YAC3B,QACH;AAEJ;AAUA,MAAM,iBAAiB,CAAC;AAAA;AAAA,EAEtB,0DAAG,MAAM,QAAS;AAAA;AAOb,MAAM,eAAe,CAC1B,IACA;AAAA,EACE,SAAS;AAAA,EACT,WAAW;AAAA,EACX,SAAS,gBAAgB;AAAA,EACzB,GAAG;AACL,IAA2B,CAAC,MAE5B,UAAU,IAAI;AAAA,EACZ,SAAS,CAAC,EAAE,SAAS,MACnB,oCAAC,gBAAa,QAAgB,YAC5B,oCAAC,qBAAe,QAAS,CAC3B;AAAA,EAEF,GAAG;AACL,CAAC;",
5
+ "mappings": "AAqBI,SAgBF,UAhBE;AApBJ;AAAA,EACE,UAAU;AAAA,OAGL;AAEP,SAAS,oBAAoB;AAQ7B,MAAM,eAAe,CAAC;AAAA,EACpB;AAAA,EACA,SAAS;AAAA,EACT,WAAW;AACb,MAA4C;AAC1C,SACE,oBAAC,gBAAa,QAAgB,UAC3B,UACH;AAEJ;AAUA,MAAM,iBAAiB,CAAC;AAAA;AAAA,EAEtB,gCAAG,gBAAM,UAAS;AAAA;AAOb,MAAM,eAAe,CAC1B,IACA;AAAA,EACE,SAAS;AAAA,EACT,WAAW;AAAA,EACX,SAAS,gBAAgB;AAAA,EACzB,GAAG;AACL,IAA2B,CAAC,MAE5B,UAAU,IAAI;AAAA,EACZ,SAAS,CAAC,EAAE,SAAS,MACnB,oBAAC,gBAAa,QAAgB,UAC5B,8BAAC,iBAAe,UAAS,GAC3B;AAAA,EAEF,GAAG;AACL,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all)
@@ -16,33 +14,25 @@ var __copyProps = (to, from, except, desc) => {
16
14
  }
17
15
  return to;
18
16
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
18
  var custom_render_exports = {};
29
19
  __export(custom_render_exports, {
30
20
  customRender: () => customRender
31
21
  });
32
22
  module.exports = __toCommonJS(custom_render_exports);
23
+ var import_jsx_runtime = require("react/jsx-runtime");
33
24
  var import_react = require("@testing-library/react");
34
- var import_react2 = __toESM(require("react"));
35
25
  var import_react_intl = require("react-intl");
36
26
  const AllProviders = ({
37
27
  children,
38
28
  locale = "en",
39
29
  timeZone = "UTC"
40
30
  }) => {
41
- return /* @__PURE__ */ import_react2.default.createElement(import_react_intl.IntlProvider, { locale, timeZone }, children);
31
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_intl.IntlProvider, { locale, timeZone, children });
42
32
  };
43
33
  const DefaultWrapper = (props) => (
44
34
  // eslint-disable-next-line react/jsx-no-useless-fragment
45
- /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, props.children)
35
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children })
46
36
  );
47
37
  const customRender = (ui, {
48
38
  locale = "en",
@@ -50,6 +40,6 @@ const customRender = (ui, {
50
40
  wrapper: CustomWrapper = DefaultWrapper,
51
41
  ...renderOptions
52
42
  } = {}) => (0, import_react.render)(ui, {
53
- wrapper: ({ children }) => /* @__PURE__ */ import_react2.default.createElement(AllProviders, { locale, timeZone }, /* @__PURE__ */ import_react2.default.createElement(CustomWrapper, null, children)),
43
+ wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AllProviders, { locale, timeZone, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CustomWrapper, { children }) }),
54
44
  ...renderOptions
55
45
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynatrace/strato-components-testing",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "types": "./index.d.ts",