testeranto 0.49.7 → 0.49.9

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 {
@@ -39,8 +40,16 @@ export default <ITestShape extends ITTestShape>(
39
40
  const myContainer = useRef<any>(null);
40
41
  useEffect(() => {
41
42
  console.log(
42
- "useEffect called"
43
+ "useEffect called", myContainer.current
43
44
  );
45
+
46
+ if (!myContainer.current) {
47
+ // do componentDidMount logic
48
+ myContainer.current = true;
49
+ } else {
50
+ // do componentDidUpdate logic
51
+ }
52
+
44
53
  done(myContainer.current);
45
54
  }, []);
46
55
 
@@ -85,32 +94,56 @@ export default <ITestShape extends ITTestShape>(
85
94
 
86
95
  console.log("beforeEach", subject);
87
96
 
88
- ReactDom.createRoot(rootElement).
89
- render(
90
- // ignore this type error
91
- React.createElement(
92
- TesterantoComponent, {
93
- done: (reactElement: any) => resolve(reactElement),
94
- innerComp: testInput
95
- },
96
- []));
97
+ createPortal(
98
+ TesterantoComponent({
99
+ innerComp: testInput,
100
+ done: (reactElement: any) => {
101
+ process.nextTick(() => {
102
+ resolve(reactElement)// do something
103
+ })
104
+ }
105
+ }
106
+ ,
107
+ ),
108
+
109
+ // ignore this type error
110
+ // React.createElement(
111
+ // TesterantoComponent, {
112
+ // done: (reactElement: any) => {
113
+ // process.nextTick(() => {
114
+ // resolve(reactElement)// do something
115
+ // });
116
+
117
+ // },
118
+ // innerComp: testInput
119
+ // }),
120
+ rootElement
121
+ );
97
122
  });
98
123
  },
99
124
  andWhen: function (s: IStore, actioner): Promise<ISelection> {
100
- return actioner()(s);
125
+ return new Promise((resolve, rej) => {
126
+ process.nextTick(() => { resolve(actioner()(s)) })
127
+ });
101
128
  },
102
129
  butThen: async function (s: IStore): Promise<ISelection> {
103
- return s;
130
+ return new Promise((resolve, rej) => {
131
+ process.nextTick(() => { resolve(s) })
132
+ });
104
133
  },
105
134
  afterEach: async function (
106
135
  store: IStore,
107
136
  ndx,
108
137
  artificer
109
138
  ) {
110
- return {};
139
+ return new Promise((resolve, rej) => {
140
+ process.nextTick(() => { resolve({}) })
141
+ });
111
142
  },
112
143
  afterAll: (store: IStore, artificer) => {
113
- return;
144
+ return new Promise((resolve, rej) => {
145
+ process.nextTick(() => { resolve({}) })
146
+ });
114
147
  },
115
148
  },
116
149
  )