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 // @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']);