Fix responder logic in ReactDOMServerSelectiveHydration-test (#19227)

This commit is contained in:
Dominic Gannaway 2020-07-01 16:28:49 +01:00 committed by GitHub
parent b231445f96
commit cd0275dcb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 10 deletions

View File

@ -349,7 +349,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
// @gate experimental
it('hydrates the target boundary synchronously during a click (flare)', async () => {
const usePress = require('react-interactions/events/press').usePress;
const usePress = require('react-interactions/events/press-legacy').usePress;
function Child({text}) {
Scheduler.unstable_yieldValue(text);
@ -415,7 +415,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
// @gate experimental
it('hydrates at higher pri if sync did not work first time (flare)', async () => {
const usePress = require('react-interactions/events/press').usePress;
const usePress = require('react-interactions/events/press-legacy').usePress;
let suspend = false;
let resolve;
const promise = new Promise(resolvePromise => (resolve = resolvePromise));
@ -476,13 +476,11 @@ describe('ReactDOMServerSelectiveHydration', () => {
// Nothing has been hydrated so far.
expect(Scheduler).toHaveYielded([]);
// This click target cannot be hydrated yet because it's suspended.
const result = dispatchClickEvent(spanD);
const target = createEventTarget(spanD);
target.virtualclick();
expect(Scheduler).toHaveYielded(['App']);
expect(result).toBe(true);
// Continuing rendering will render B next.
expect(Scheduler).toFlushAndYield(['B', 'C']);
@ -499,7 +497,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
// @gate experimental
it('hydrates at higher pri for secondary discrete events (flare)', async () => {
const usePress = require('react-interactions/events/press').usePress;
const usePress = require('react-interactions/events/press-legacy').usePress;
let suspend = false;
let resolve;
const promise = new Promise(resolvePromise => (resolve = resolvePromise));
@ -563,9 +561,9 @@ describe('ReactDOMServerSelectiveHydration', () => {
expect(Scheduler).toHaveYielded([]);
// This click target cannot be hydrated yet because the first is Suspended.
dispatchClickEvent(spanA);
dispatchClickEvent(spanC);
dispatchClickEvent(spanD);
createEventTarget(spanA).virtualclick();
createEventTarget(spanC).virtualclick();
createEventTarget(spanD).virtualclick();
expect(Scheduler).toHaveYielded(['App']);