@atomic-testing/react-legacy 0.78.0 → 0.80.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.
@@ -6,12 +6,16 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
8
  var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
15
19
  }
16
20
  return to;
17
21
  };
@@ -21,10 +25,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
25
  }) : target, mod));
22
26
 
23
27
  //#endregion
24
- const react_dom = __toESM(require("react-dom"));
25
- const react_dom_test_utils = __toESM(require("react-dom/test-utils"));
26
- const __atomic_testing_core = __toESM(require("@atomic-testing/core"));
27
- const __atomic_testing_react_core = __toESM(require("@atomic-testing/react-core"));
28
+ let react_dom = require("react-dom");
29
+ react_dom = __toESM(react_dom);
30
+ let react_dom_test_utils = require("react-dom/test-utils");
31
+ let _atomic_testing_core = require("@atomic-testing/core");
32
+ let _atomic_testing_react_core = require("@atomic-testing/react-core");
28
33
 
29
34
  //#region src/createTestEngine.ts
30
35
  let _rootId = 0;
@@ -54,8 +59,7 @@ function createTestEngine(node, partDefinitions, option) {
54
59
  rootEl.removeChild(container);
55
60
  return Promise.resolve();
56
61
  };
57
- const engine = new __atomic_testing_core.TestEngine((0, __atomic_testing_core.byAttribute)(rootElementAttributeName, rootId), new __atomic_testing_react_core.ReactInteractor(), { parts: partDefinitions }, cleanup);
58
- return engine;
62
+ return new _atomic_testing_core.TestEngine((0, _atomic_testing_core.byAttribute)(rootElementAttributeName, rootId), new _atomic_testing_react_core.ReactInteractor(), { parts: partDefinitions }, cleanup);
59
63
  }
60
64
  /**
61
65
  * Create test engine for React 17 or before, for React 18 or later, use @atomic-testing/react-18 or @atomic-testing/react-19
@@ -73,11 +77,10 @@ function createRenderedTestEngine(rootElement, partDefinitions, _option) {
73
77
  rootElement.removeAttribute(rootElementAttributeName);
74
78
  return Promise.resolve();
75
79
  };
76
- const engine = new __atomic_testing_core.TestEngine((0, __atomic_testing_core.byAttribute)(rootElementAttributeName, rootId), new __atomic_testing_react_core.ReactInteractor(), { parts: partDefinitions }, cleanup);
77
- return engine;
80
+ return new _atomic_testing_core.TestEngine((0, _atomic_testing_core.byAttribute)(rootElementAttributeName, rootId), new _atomic_testing_react_core.ReactInteractor(), { parts: partDefinitions }, cleanup);
78
81
  }
79
82
 
80
83
  //#endregion
81
84
  exports.createRenderedTestEngine = createRenderedTestEngine;
82
85
  exports.createTestEngine = createTestEngine;
83
- //# sourceMappingURL=index.js.map
86
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["TestEngine","ReactInteractor"],"sources":["../src/createTestEngine.ts"],"sourcesContent":["import { ReactElement } from 'react';\nimport ReactDOM from 'react-dom';\nimport { act } from 'react-dom/test-utils';\n\nimport { byAttribute, ScenePart, TestEngine } from '@atomic-testing/core';\nimport { ReactInteractor } from '@atomic-testing/react-core';\n\nimport { IReactTestEngineOption } from './types';\n\nlet _rootId = 0;\nfunction getNextRootElementId() {\n return `${_rootId++}`;\n}\n\nconst rootElementAttributeName = 'data-atomic-testing-react-legacy';\n\n/**\n * Create test engine for React 17 or before, for React 18 or later, use @atomic-testing/react-18 or @atomic-testing/react-19\n * This function takes a react node and render it into a container element. For rendered\n * components, use createRenderedLegacyTestEngine\n * @param node The React node to render\n * @param partDefinitions The scene part definitions\n * @param option\n * @returns The test engine\n */\nexport function createTestEngine<T extends ScenePart>(\n node: ReactElement,\n partDefinitions: T,\n option?: Readonly<Partial<IReactTestEngineOption>>\n): TestEngine<T> {\n const rootEl = option?.rootElement ?? document.body;\n const container = rootEl.appendChild(document.createElement('div'));\n const rootId = getNextRootElementId();\n container.setAttribute(rootElementAttributeName, rootId);\n\n act(() => {\n ReactDOM.render(node, container);\n });\n const cleanup = () => {\n ReactDOM.unmountComponentAtNode(container);\n rootEl.removeChild(container);\n return Promise.resolve();\n };\n\n const engine = new TestEngine(\n byAttribute(rootElementAttributeName, rootId),\n new ReactInteractor(),\n {\n parts: partDefinitions,\n },\n cleanup\n );\n\n return engine;\n}\n\n/**\n * Create test engine for React 17 or before, for React 18 or later, use @atomic-testing/react-18 or @atomic-testing/react-19\n * This function takes an html element purportedly rendered by React and create a test engine for it, it\n * can be useful in environment such as Storybook where Storybook renders the component and the test\n * @param rootElement The React node to render\n * @param partDefinitions The scene part definitions\n * @param option\n * @returns The test engine\n */\nexport function createRenderedTestEngine<T extends ScenePart>(\n rootElement: HTMLElement,\n partDefinitions: T,\n _option?: Readonly<Partial<IReactTestEngineOption>>\n): TestEngine<T> {\n const rootId = getNextRootElementId();\n rootElement.setAttribute(rootElementAttributeName, rootId);\n\n const cleanup = () => {\n rootElement.removeAttribute(rootElementAttributeName);\n return Promise.resolve();\n };\n\n const engine = new TestEngine(\n byAttribute(rootElementAttributeName, rootId),\n new ReactInteractor(),\n {\n parts: partDefinitions,\n },\n cleanup\n );\n\n return engine;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAI,UAAU;AACd,SAAS,uBAAuB;AAC9B,QAAO,GAAG;;AAGZ,MAAM,2BAA2B;;;;;;;;;;AAWjC,SAAgB,iBACd,MACA,iBACA,QACe;CACf,MAAM,SAAS,QAAQ,eAAe,SAAS;CAC/C,MAAM,YAAY,OAAO,YAAY,SAAS,cAAc,MAAM,CAAC;CACnE,MAAM,SAAS,sBAAsB;AACrC,WAAU,aAAa,0BAA0B,OAAO;AAExD,qCAAU;AACR,oBAAS,OAAO,MAAM,UAAU;GAChC;CACF,MAAM,gBAAgB;AACpB,oBAAS,uBAAuB,UAAU;AAC1C,SAAO,YAAY,UAAU;AAC7B,SAAO,QAAQ,SAAS;;AAY1B,QATe,IAAIA,sEACL,0BAA0B,OAAO,EAC7C,IAAIC,4CAAiB,EACrB,EACE,OAAO,iBACR,EACD,QACD;;;;;;;;;;;AAcH,SAAgB,yBACd,aACA,iBACA,SACe;CACf,MAAM,SAAS,sBAAsB;AACrC,aAAY,aAAa,0BAA0B,OAAO;CAE1D,MAAM,gBAAgB;AACpB,cAAY,gBAAgB,yBAAyB;AACrD,SAAO,QAAQ,SAAS;;AAY1B,QATe,IAAID,sEACL,0BAA0B,OAAO,EAC7C,IAAIC,4CAAiB,EACrB,EACE,OAAO,iBACR,EACD,QACD"}
@@ -28,5 +28,5 @@ declare function createTestEngine<T extends ScenePart>(node: ReactElement, partD
28
28
  */
29
29
  declare function createRenderedTestEngine<T extends ScenePart>(rootElement: HTMLElement, partDefinitions: T, _option?: Readonly<Partial<IReactTestEngineOption>>): TestEngine<T>;
30
30
  //#endregion
31
- export { IReactTestEngineOption, createRenderedTestEngine, createTestEngine };
32
- //# sourceMappingURL=index.d.ts.map
31
+ export { type IReactTestEngineOption, createRenderedTestEngine, createTestEngine };
32
+ //# sourceMappingURL=index.d.cts.map
package/dist/index.d.mts CHANGED
@@ -28,5 +28,5 @@ declare function createTestEngine<T extends ScenePart>(node: ReactElement, partD
28
28
  */
29
29
  declare function createRenderedTestEngine<T extends ScenePart>(rootElement: HTMLElement, partDefinitions: T, _option?: Readonly<Partial<IReactTestEngineOption>>): TestEngine<T>;
30
30
  //#endregion
31
- export { IReactTestEngineOption, createRenderedTestEngine, createTestEngine };
31
+ export { type IReactTestEngineOption, createRenderedTestEngine, createTestEngine };
32
32
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -31,8 +31,7 @@ function createTestEngine(node, partDefinitions, option) {
31
31
  rootEl.removeChild(container);
32
32
  return Promise.resolve();
33
33
  };
34
- const engine = new TestEngine(byAttribute(rootElementAttributeName, rootId), new ReactInteractor(), { parts: partDefinitions }, cleanup);
35
- return engine;
34
+ return new TestEngine(byAttribute(rootElementAttributeName, rootId), new ReactInteractor(), { parts: partDefinitions }, cleanup);
36
35
  }
37
36
  /**
38
37
  * Create test engine for React 17 or before, for React 18 or later, use @atomic-testing/react-18 or @atomic-testing/react-19
@@ -50,8 +49,7 @@ function createRenderedTestEngine(rootElement, partDefinitions, _option) {
50
49
  rootElement.removeAttribute(rootElementAttributeName);
51
50
  return Promise.resolve();
52
51
  };
53
- const engine = new TestEngine(byAttribute(rootElementAttributeName, rootId), new ReactInteractor(), { parts: partDefinitions }, cleanup);
54
- return engine;
52
+ return new TestEngine(byAttribute(rootElementAttributeName, rootId), new ReactInteractor(), { parts: partDefinitions }, cleanup);
55
53
  }
56
54
 
57
55
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["node: ReactElement","partDefinitions: T","option?: Readonly<Partial<IReactTestEngineOption>>","rootElement: HTMLElement","_option?: Readonly<Partial<IReactTestEngineOption>>"],"sources":["../src/createTestEngine.ts"],"sourcesContent":["import { ReactElement } from 'react';\nimport ReactDOM from 'react-dom';\nimport { act } from 'react-dom/test-utils';\n\nimport { byAttribute, ScenePart, TestEngine } from '@atomic-testing/core';\nimport { ReactInteractor } from '@atomic-testing/react-core';\n\nimport { IReactTestEngineOption } from './types';\n\nlet _rootId = 0;\nfunction getNextRootElementId() {\n return `${_rootId++}`;\n}\n\nconst rootElementAttributeName = 'data-atomic-testing-react-legacy';\n\n/**\n * Create test engine for React 17 or before, for React 18 or later, use @atomic-testing/react-18 or @atomic-testing/react-19\n * This function takes a react node and render it into a container element. For rendered\n * components, use createRenderedLegacyTestEngine\n * @param node The React node to render\n * @param partDefinitions The scene part definitions\n * @param option\n * @returns The test engine\n */\nexport function createTestEngine<T extends ScenePart>(\n node: ReactElement,\n partDefinitions: T,\n option?: Readonly<Partial<IReactTestEngineOption>>\n): TestEngine<T> {\n const rootEl = option?.rootElement ?? document.body;\n const container = rootEl.appendChild(document.createElement('div'));\n const rootId = getNextRootElementId();\n container.setAttribute(rootElementAttributeName, rootId);\n\n act(() => {\n ReactDOM.render(node, container);\n });\n const cleanup = () => {\n ReactDOM.unmountComponentAtNode(container);\n rootEl.removeChild(container);\n return Promise.resolve();\n };\n\n const engine = new TestEngine(\n byAttribute(rootElementAttributeName, rootId),\n new ReactInteractor(),\n {\n parts: partDefinitions,\n },\n cleanup\n );\n\n return engine;\n}\n\n/**\n * Create test engine for React 17 or before, for React 18 or later, use @atomic-testing/react-18 or @atomic-testing/react-19\n * This function takes an html element purportedly rendered by React and create a test engine for it, it\n * can be useful in environment such as Storybook where Storybook renders the component and the test\n * @param rootElement The React node to render\n * @param partDefinitions The scene part definitions\n * @param option\n * @returns The test engine\n */\nexport function createRenderedTestEngine<T extends ScenePart>(\n rootElement: HTMLElement,\n partDefinitions: T,\n _option?: Readonly<Partial<IReactTestEngineOption>>\n): TestEngine<T> {\n const rootId = getNextRootElementId();\n rootElement.setAttribute(rootElementAttributeName, rootId);\n\n const cleanup = () => {\n rootElement.removeAttribute(rootElementAttributeName);\n return Promise.resolve();\n };\n\n const engine = new TestEngine(\n byAttribute(rootElementAttributeName, rootId),\n new ReactInteractor(),\n {\n parts: partDefinitions,\n },\n cleanup\n );\n\n return engine;\n}\n"],"mappings":";;;;;;AASA,IAAI,UAAU;AACd,SAAS,uBAAuB;AAC9B,WAAU;AACX;AAED,MAAM,2BAA2B;;;;;;;;;;AAWjC,SAAgB,iBACdA,MACAC,iBACAC,QACe;CACf,MAAM,SAAS,QAAQ,eAAe,SAAS;CAC/C,MAAM,YAAY,OAAO,YAAY,SAAS,cAAc,MAAM,CAAC;CACnE,MAAM,SAAS,sBAAsB;AACrC,WAAU,aAAa,0BAA0B,OAAO;AAExD,KAAI,MAAM;AACR,WAAS,OAAO,MAAM,UAAU;CACjC,EAAC;CACF,MAAM,UAAU,MAAM;AACpB,WAAS,uBAAuB,UAAU;AAC1C,SAAO,YAAY,UAAU;AAC7B,SAAO,QAAQ,SAAS;CACzB;CAED,MAAM,SAAS,IAAI,WACjB,YAAY,0BAA0B,OAAO,EAC7C,IAAI,mBACJ,EACE,OAAO,gBACR,GACD;AAGF,QAAO;AACR;;;;;;;;;;AAWD,SAAgB,yBACdC,aACAF,iBACAG,SACe;CACf,MAAM,SAAS,sBAAsB;AACrC,aAAY,aAAa,0BAA0B,OAAO;CAE1D,MAAM,UAAU,MAAM;AACpB,cAAY,gBAAgB,yBAAyB;AACrD,SAAO,QAAQ,SAAS;CACzB;CAED,MAAM,SAAS,IAAI,WACjB,YAAY,0BAA0B,OAAO,EAC7C,IAAI,mBACJ,EACE,OAAO,gBACR,GACD;AAGF,QAAO;AACR"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/createTestEngine.ts"],"sourcesContent":["import { ReactElement } from 'react';\nimport ReactDOM from 'react-dom';\nimport { act } from 'react-dom/test-utils';\n\nimport { byAttribute, ScenePart, TestEngine } from '@atomic-testing/core';\nimport { ReactInteractor } from '@atomic-testing/react-core';\n\nimport { IReactTestEngineOption } from './types';\n\nlet _rootId = 0;\nfunction getNextRootElementId() {\n return `${_rootId++}`;\n}\n\nconst rootElementAttributeName = 'data-atomic-testing-react-legacy';\n\n/**\n * Create test engine for React 17 or before, for React 18 or later, use @atomic-testing/react-18 or @atomic-testing/react-19\n * This function takes a react node and render it into a container element. For rendered\n * components, use createRenderedLegacyTestEngine\n * @param node The React node to render\n * @param partDefinitions The scene part definitions\n * @param option\n * @returns The test engine\n */\nexport function createTestEngine<T extends ScenePart>(\n node: ReactElement,\n partDefinitions: T,\n option?: Readonly<Partial<IReactTestEngineOption>>\n): TestEngine<T> {\n const rootEl = option?.rootElement ?? document.body;\n const container = rootEl.appendChild(document.createElement('div'));\n const rootId = getNextRootElementId();\n container.setAttribute(rootElementAttributeName, rootId);\n\n act(() => {\n ReactDOM.render(node, container);\n });\n const cleanup = () => {\n ReactDOM.unmountComponentAtNode(container);\n rootEl.removeChild(container);\n return Promise.resolve();\n };\n\n const engine = new TestEngine(\n byAttribute(rootElementAttributeName, rootId),\n new ReactInteractor(),\n {\n parts: partDefinitions,\n },\n cleanup\n );\n\n return engine;\n}\n\n/**\n * Create test engine for React 17 or before, for React 18 or later, use @atomic-testing/react-18 or @atomic-testing/react-19\n * This function takes an html element purportedly rendered by React and create a test engine for it, it\n * can be useful in environment such as Storybook where Storybook renders the component and the test\n * @param rootElement The React node to render\n * @param partDefinitions The scene part definitions\n * @param option\n * @returns The test engine\n */\nexport function createRenderedTestEngine<T extends ScenePart>(\n rootElement: HTMLElement,\n partDefinitions: T,\n _option?: Readonly<Partial<IReactTestEngineOption>>\n): TestEngine<T> {\n const rootId = getNextRootElementId();\n rootElement.setAttribute(rootElementAttributeName, rootId);\n\n const cleanup = () => {\n rootElement.removeAttribute(rootElementAttributeName);\n return Promise.resolve();\n };\n\n const engine = new TestEngine(\n byAttribute(rootElementAttributeName, rootId),\n new ReactInteractor(),\n {\n parts: partDefinitions,\n },\n cleanup\n );\n\n return engine;\n}\n"],"mappings":";;;;;;AASA,IAAI,UAAU;AACd,SAAS,uBAAuB;AAC9B,QAAO,GAAG;;AAGZ,MAAM,2BAA2B;;;;;;;;;;AAWjC,SAAgB,iBACd,MACA,iBACA,QACe;CACf,MAAM,SAAS,QAAQ,eAAe,SAAS;CAC/C,MAAM,YAAY,OAAO,YAAY,SAAS,cAAc,MAAM,CAAC;CACnE,MAAM,SAAS,sBAAsB;AACrC,WAAU,aAAa,0BAA0B,OAAO;AAExD,WAAU;AACR,WAAS,OAAO,MAAM,UAAU;GAChC;CACF,MAAM,gBAAgB;AACpB,WAAS,uBAAuB,UAAU;AAC1C,SAAO,YAAY,UAAU;AAC7B,SAAO,QAAQ,SAAS;;AAY1B,QATe,IAAI,WACjB,YAAY,0BAA0B,OAAO,EAC7C,IAAI,iBAAiB,EACrB,EACE,OAAO,iBACR,EACD,QACD;;;;;;;;;;;AAcH,SAAgB,yBACd,aACA,iBACA,SACe;CACf,MAAM,SAAS,sBAAsB;AACrC,aAAY,aAAa,0BAA0B,OAAO;CAE1D,MAAM,gBAAgB;AACpB,cAAY,gBAAgB,yBAAyB;AACrD,SAAO,QAAQ,SAAS;;AAY1B,QATe,IAAI,WACjB,YAAY,0BAA0B,OAAO,EAC7C,IAAI,iBAAiB,EACrB,EACE,OAAO,iBACR,EACD,QACD"}
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@atomic-testing/react-legacy",
3
- "version": "0.78.0",
3
+ "version": "0.80.0",
4
4
  "description": "Adapter for testing React 17 and earlier",
5
- "main": "dist/index.js",
5
+ "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
7
- "typings": "dist/index.d.ts",
8
7
  "files": [
9
8
  "dist",
10
9
  "src"
@@ -23,9 +22,9 @@
23
22
  },
24
23
  "dependencies": {
25
24
  "react-dom": "^17.0.0",
26
- "@atomic-testing/core": "0.78.0",
27
- "@atomic-testing/react-core": "0.78.0",
28
- "@atomic-testing/dom-core": "0.78.0"
25
+ "@atomic-testing/core": "0.80.0",
26
+ "@atomic-testing/react-core": "0.80.0",
27
+ "@atomic-testing/dom-core": "0.80.0"
29
28
  },
30
29
  "devDependencies": {
31
30
  "@types/react": "^17.0.0",
@@ -40,6 +39,14 @@
40
39
  "react": "^16 || ^17",
41
40
  "react-dom": "^16 || ^17"
42
41
  },
42
+ "types": "dist/index.d.cts",
43
+ "exports": {
44
+ ".": {
45
+ "types": "./dist/index.d.mts",
46
+ "import": "./dist/index.mjs",
47
+ "require": "./dist/index.cjs"
48
+ }
49
+ },
43
50
  "scripts": {
44
51
  "build": "tsdown",
45
52
  "check:type": "tsc --noEmit"
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["node: ReactElement","partDefinitions: T","option?: Readonly<Partial<IReactTestEngineOption>>","TestEngine","ReactInteractor","rootElement: HTMLElement","_option?: Readonly<Partial<IReactTestEngineOption>>"],"sources":["../src/createTestEngine.ts"],"sourcesContent":["import { ReactElement } from 'react';\nimport ReactDOM from 'react-dom';\nimport { act } from 'react-dom/test-utils';\n\nimport { byAttribute, ScenePart, TestEngine } from '@atomic-testing/core';\nimport { ReactInteractor } from '@atomic-testing/react-core';\n\nimport { IReactTestEngineOption } from './types';\n\nlet _rootId = 0;\nfunction getNextRootElementId() {\n return `${_rootId++}`;\n}\n\nconst rootElementAttributeName = 'data-atomic-testing-react-legacy';\n\n/**\n * Create test engine for React 17 or before, for React 18 or later, use @atomic-testing/react-18 or @atomic-testing/react-19\n * This function takes a react node and render it into a container element. For rendered\n * components, use createRenderedLegacyTestEngine\n * @param node The React node to render\n * @param partDefinitions The scene part definitions\n * @param option\n * @returns The test engine\n */\nexport function createTestEngine<T extends ScenePart>(\n node: ReactElement,\n partDefinitions: T,\n option?: Readonly<Partial<IReactTestEngineOption>>\n): TestEngine<T> {\n const rootEl = option?.rootElement ?? document.body;\n const container = rootEl.appendChild(document.createElement('div'));\n const rootId = getNextRootElementId();\n container.setAttribute(rootElementAttributeName, rootId);\n\n act(() => {\n ReactDOM.render(node, container);\n });\n const cleanup = () => {\n ReactDOM.unmountComponentAtNode(container);\n rootEl.removeChild(container);\n return Promise.resolve();\n };\n\n const engine = new TestEngine(\n byAttribute(rootElementAttributeName, rootId),\n new ReactInteractor(),\n {\n parts: partDefinitions,\n },\n cleanup\n );\n\n return engine;\n}\n\n/**\n * Create test engine for React 17 or before, for React 18 or later, use @atomic-testing/react-18 or @atomic-testing/react-19\n * This function takes an html element purportedly rendered by React and create a test engine for it, it\n * can be useful in environment such as Storybook where Storybook renders the component and the test\n * @param rootElement The React node to render\n * @param partDefinitions The scene part definitions\n * @param option\n * @returns The test engine\n */\nexport function createRenderedTestEngine<T extends ScenePart>(\n rootElement: HTMLElement,\n partDefinitions: T,\n _option?: Readonly<Partial<IReactTestEngineOption>>\n): TestEngine<T> {\n const rootId = getNextRootElementId();\n rootElement.setAttribute(rootElementAttributeName, rootId);\n\n const cleanup = () => {\n rootElement.removeAttribute(rootElementAttributeName);\n return Promise.resolve();\n };\n\n const engine = new TestEngine(\n byAttribute(rootElementAttributeName, rootId),\n new ReactInteractor(),\n {\n parts: partDefinitions,\n },\n cleanup\n );\n\n return engine;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAI,UAAU;AACd,SAAS,uBAAuB;AAC9B,WAAU;AACX;AAED,MAAM,2BAA2B;;;;;;;;;;AAWjC,SAAgB,iBACdA,MACAC,iBACAC,QACe;CACf,MAAM,SAAS,QAAQ,eAAe,SAAS;CAC/C,MAAM,YAAY,OAAO,YAAY,SAAS,cAAc,MAAM,CAAC;CACnE,MAAM,SAAS,sBAAsB;AACrC,WAAU,aAAa,0BAA0B,OAAO;AAExD,+BAAI,MAAM;AACR,oBAAS,OAAO,MAAM,UAAU;CACjC,EAAC;CACF,MAAM,UAAU,MAAM;AACpB,oBAAS,uBAAuB,UAAU;AAC1C,SAAO,YAAY,UAAU;AAC7B,SAAO,QAAQ,SAAS;CACzB;CAED,MAAM,SAAS,IAAIC,iCACjB,uCAAY,0BAA0B,OAAO,EAC7C,IAAIC,+CACJ,EACE,OAAO,gBACR,GACD;AAGF,QAAO;AACR;;;;;;;;;;AAWD,SAAgB,yBACdC,aACAJ,iBACAK,SACe;CACf,MAAM,SAAS,sBAAsB;AACrC,aAAY,aAAa,0BAA0B,OAAO;CAE1D,MAAM,UAAU,MAAM;AACpB,cAAY,gBAAgB,yBAAyB;AACrD,SAAO,QAAQ,SAAS;CACzB;CAED,MAAM,SAAS,IAAIH,iCACjB,uCAAY,0BAA0B,OAAO,EAC7C,IAAIC,+CACJ,EACE,OAAO,gBACR,GACD;AAGF,QAAO;AACR"}