Skip to content

Commit

Permalink
Enable tests from before
Browse files Browse the repository at this point in the history
These tests were written with replaying in mind and now we can properly
enable them.
  • Loading branch information
sebmarkbage committed Sep 10, 2019
1 parent a5bb83d commit 8845c1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1805,12 +1805,6 @@ describe('ReactDOMServerPartialHydration', () => {
Scheduler.unstable_flushAll();
jest.runAllTimers();

// TODO: With selective hydration the event should've been replayed
// but for now we'll have to issue it again.
act(() => {
a.click();
});

expect(clicks).toBe(1);

expect(container.textContent).toBe('Hello');
Expand Down Expand Up @@ -1885,12 +1879,6 @@ describe('ReactDOMServerPartialHydration', () => {
Scheduler.unstable_flushAll();
jest.runAllTimers();

// TODO: With selective hydration the event should've been replayed
// but for now we'll have to issue it again.
act(() => {
a.click();
});

expect(onEvent).toHaveBeenCalledTimes(1);

document.body.removeChild(container);
Expand Down Expand Up @@ -1963,12 +1951,6 @@ describe('ReactDOMServerPartialHydration', () => {
Scheduler.unstable_flushAll();
jest.runAllTimers();

// TODO: With selective hydration the event should've been replayed
// but for now we'll have to issue it again.
act(() => {
span.click();
});

expect(clicksOnChild).toBe(1);
// This will be zero due to the stopPropagation.
expect(clicksOnParent).toBe(0);
Expand Down Expand Up @@ -2047,11 +2029,6 @@ describe('ReactDOMServerPartialHydration', () => {
jest.runAllTimers();

// We're now full hydrated.
// TODO: With selective hydration the event should've been replayed
// but for now we'll have to issue it again.
act(() => {
a.click();
});

expect(clicks).toBe(1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ let React;
let ReactDOM;
let ReactDOMServer;
let Scheduler;
let act;

// These tests rely both on ReactDOMServer and ReactDOM.
// If a test only needs ReactDOMServer, put it in ReactServerRendering-test instead.
Expand All @@ -24,7 +23,6 @@ describe('ReactDOMServerHydration', () => {
ReactDOM = require('react-dom');
ReactDOMServer = require('react-dom/server');
Scheduler = require('scheduler');
act = require('react-dom/test-utils').act;
});

it('should have the correct mounting behavior (old hydrate API)', () => {
Expand Down Expand Up @@ -572,13 +570,12 @@ describe('ReactDOMServerHydration', () => {
expect(clicks).toBe(0);

// Finish the rest of the hydration.
expect(Scheduler).toFlushAndYield(['Sibling2']);

// TODO: With selective hydration the event should've been replayed
// but for now we'll have to issue it again.
act(() => {
a.click();
});
if (__DEV__) {
// In DEV effects gets double invoked.
expect(Scheduler).toFlushAndYield(['Sibling2', 'Button', 'Button']);
} else {
expect(Scheduler).toFlushAndYield(['Sibling2', 'Button']);
}

expect(clicks).toBe(1);

Expand Down Expand Up @@ -634,11 +631,6 @@ describe('ReactDOMServerHydration', () => {
Scheduler.unstable_flushAll();

// We're now full hydrated.
// TODO: With selective hydration the event should've been replayed
// but for now we'll have to issue it again.
act(() => {
a.click();
});

expect(clicks).toBe(1);

Expand Down

0 comments on commit 8845c1f

Please sign in to comment.