Fix responder logic in ReactDOMServerSelectiveHydration-test (#19227)
This commit is contained in:
parent
b231445f96
commit
cd0275dcb2
|
@ -349,7 +349,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
|
||||||
|
|
||||||
// @gate experimental
|
// @gate experimental
|
||||||
it('hydrates the target boundary synchronously during a click (flare)', async () => {
|
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}) {
|
function Child({text}) {
|
||||||
Scheduler.unstable_yieldValue(text);
|
Scheduler.unstable_yieldValue(text);
|
||||||
|
@ -415,7 +415,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
|
||||||
|
|
||||||
// @gate experimental
|
// @gate experimental
|
||||||
it('hydrates at higher pri if sync did not work first time (flare)', async () => {
|
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 suspend = false;
|
||||||
let resolve;
|
let resolve;
|
||||||
const promise = new Promise(resolvePromise => (resolve = resolvePromise));
|
const promise = new Promise(resolvePromise => (resolve = resolvePromise));
|
||||||
|
@ -476,13 +476,11 @@ describe('ReactDOMServerSelectiveHydration', () => {
|
||||||
// Nothing has been hydrated so far.
|
// Nothing has been hydrated so far.
|
||||||
expect(Scheduler).toHaveYielded([]);
|
expect(Scheduler).toHaveYielded([]);
|
||||||
|
|
||||||
// This click target cannot be hydrated yet because it's suspended.
|
const target = createEventTarget(spanD);
|
||||||
const result = dispatchClickEvent(spanD);
|
target.virtualclick();
|
||||||
|
|
||||||
expect(Scheduler).toHaveYielded(['App']);
|
expect(Scheduler).toHaveYielded(['App']);
|
||||||
|
|
||||||
expect(result).toBe(true);
|
|
||||||
|
|
||||||
// Continuing rendering will render B next.
|
// Continuing rendering will render B next.
|
||||||
expect(Scheduler).toFlushAndYield(['B', 'C']);
|
expect(Scheduler).toFlushAndYield(['B', 'C']);
|
||||||
|
|
||||||
|
@ -499,7 +497,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
|
||||||
|
|
||||||
// @gate experimental
|
// @gate experimental
|
||||||
it('hydrates at higher pri for secondary discrete events (flare)', async () => {
|
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 suspend = false;
|
||||||
let resolve;
|
let resolve;
|
||||||
const promise = new Promise(resolvePromise => (resolve = resolvePromise));
|
const promise = new Promise(resolvePromise => (resolve = resolvePromise));
|
||||||
|
@ -563,9 +561,9 @@ describe('ReactDOMServerSelectiveHydration', () => {
|
||||||
expect(Scheduler).toHaveYielded([]);
|
expect(Scheduler).toHaveYielded([]);
|
||||||
|
|
||||||
// This click target cannot be hydrated yet because the first is Suspended.
|
// This click target cannot be hydrated yet because the first is Suspended.
|
||||||
dispatchClickEvent(spanA);
|
createEventTarget(spanA).virtualclick();
|
||||||
dispatchClickEvent(spanC);
|
createEventTarget(spanC).virtualclick();
|
||||||
dispatchClickEvent(spanD);
|
createEventTarget(spanD).virtualclick();
|
||||||
|
|
||||||
expect(Scheduler).toHaveYielded(['App']);
|
expect(Scheduler).toHaveYielded(['App']);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue