testeranto 0.49.8 → 0.49.10

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.
@@ -4,6 +4,7 @@ import React, {
4
4
  useEffect, useRef,
5
5
  } from "react";
6
6
  import ReactDom from "react-dom/client";
7
+ import { createPortal } from 'react-dom';
7
8
 
8
9
  import { ITTestShape, ITestImplementation, ITestSpecification } from "../../../core";
9
10
  import {
@@ -13,7 +14,10 @@ import {
13
14
 
14
15
  export type ISubject = HTMLElement;
15
16
 
16
- export default <ITestShape extends ITTestShape>(
17
+ export default <
18
+ ITestShape extends ITTestShape,
19
+ IProps
20
+ >(
17
21
  testImplementations: ITestImplementation<
18
22
  IState,
19
23
  ISelection,
@@ -23,6 +27,7 @@ export default <ITestShape extends ITTestShape>(
23
27
  >,
24
28
  testSpecifications: ITestSpecification<
25
29
  ITestShape,
30
+ // [HTMLElement, IProps], // ISubject,
26
31
  ISubject,
27
32
  IStore,
28
33
  ISelection,
@@ -42,12 +47,12 @@ export default <ITestShape extends ITTestShape>(
42
47
  "useEffect called", myContainer.current
43
48
  );
44
49
 
45
- if (!myContainer.current) {
46
- // do componentDidMount logic
47
- myContainer.current = true;
48
- } else {
49
- // do componentDidUpdate logic
50
- }
50
+ // if (!myContainer.current) {
51
+ // // do componentDidMount logic
52
+ // myContainer.current = true;
53
+ // } else {
54
+ // // do componentDidUpdate logic
55
+ // }
51
56
 
52
57
  done(myContainer.current);
53
58
  }, []);
@@ -62,6 +67,7 @@ export default <ITestShape extends ITTestShape>(
62
67
  Testeranto<
63
68
  ITestShape,
64
69
  IInput,
70
+ // [HTMLElement, IProps], // ISubject,
65
71
  ISubject,
66
72
  IStore,
67
73
  ISelection,
@@ -76,7 +82,7 @@ export default <ITestShape extends ITTestShape>(
76
82
  beforeAll: async (
77
83
  input,
78
84
  artificer
79
- ): Promise<ISubject> => {
85
+ ): Promise<HTMLElement> => {
80
86
  console.log("beforeAll", input);
81
87
  return await new Promise((resolve, rej) => {
82
88
  resolve(rootElement);
@@ -93,20 +99,19 @@ export default <ITestShape extends ITTestShape>(
93
99
 
94
100
  console.log("beforeEach", subject);
95
101
 
96
- ReactDom.createRoot(rootElement).
97
- render(
98
- // ignore this type error
99
- React.createElement(
100
- TesterantoComponent, {
101
- done: (reactElement: any) => {
102
- process.nextTick(() => {
103
- resolve(reactElement)// do something
104
- });
105
-
106
- },
107
- innerComp: testInput
108
- },
109
- []));
102
+ createPortal(
103
+ TesterantoComponent({
104
+ innerComp: testInput,
105
+ done: (reactElement: any) => {
106
+ process.nextTick(() => {
107
+ resolve(reactElement)// do something
108
+ })
109
+ }
110
+ }
111
+ ,
112
+ ),
113
+ rootElement
114
+ );
110
115
  });
111
116
  },
112
117
  andWhen: function (s: IStore, actioner): Promise<ISelection> {