fix tests

This commit is contained in:
Tianyu Yao
2023-01-20 11:47:08 -08:00
parent 7c8acf9d26
commit 31ca11900f
3 changed files with 8 additions and 4 deletions
@@ -648,9 +648,10 @@ export function dispatchEventForPluginEventSystem(
// Special case: Flush continuous updates before the capture phase of a discrete event.
if (
eventSystemFlags & IS_CAPTURE_PHASE &&
node !== null &&
getCurrentUpdatePriority() === DiscreteEventPriority
) {
const root: ?FiberRoot = node?.stateNode;
const root: ?FiberRoot = node.stateNode;
if (root != null) {
flushPendingContinuousUpdates(root);
}
@@ -1280,8 +1280,10 @@ describe('DOMPluginEventSystem', () => {
);
}
const root = ReactDOMClient.createRoot(container);
root.render(<Test />);
expect(Scheduler).toFlushAndYieldThrough(['Render:0']);
await act(async () => {
root.render(<Test />);
});
expect(Scheduler).toHaveYielded(['Render:0']);
const buttonElement = buttonRef.current;
// Expect the click event to be able to get the latest state value set by mouse over events
@@ -3294,5 +3296,5 @@ describe('DOMPluginEventSystem', () => {
}
withEnableLegacyFBSupport(false);
// withEnableLegacyFBSupport(true);
withEnableLegacyFBSupport(true);
});
+1
View File
@@ -139,6 +139,7 @@ import {
claimNextTransitionLane,
claimNextRetryLane,
includesSyncLane,
includesSomeLane,
isSubsetOfLanes,
mergeLanes,
removeLanes,