Skip to content

Commit

Permalink
Fix responder logic in ReactDOMServerSelectiveHydration-test (#19227)
Browse files Browse the repository at this point in the history
  • Loading branch information
trueadm committed Jul 1, 2020
1 parent b231445 commit cd0275d
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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']);

Expand All @@ -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));
Expand Down Expand Up @@ -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']);

Expand Down

0 comments on commit cd0275d

Please sign in to comment.