Skip to content

Commit

Permalink
Resolve the true entry point during tests (#21505)
Browse files Browse the repository at this point in the history
* Resolve the entry point for tests the same way builds do

This way the source tests, test the same entry point configuration.

* Gate test selectors on www

These are currently only exposed in www builds

* Gate createEventHandle / useFocus on www

These are enabled in both www variants but not OSS experimental.

* Temporarily disable www-modern entry point

Use the main one that has all the exports until we fix more tests.

* Remove enableCache override that's no longer correct

* Open gates for www

These used to not be covered because they used Cache which wasn't exposed.
  • Loading branch information
sebmarkbage authored Jun 3, 2021
1 parent a8a4742 commit 86715ef
Show file tree
Hide file tree
Showing 26 changed files with 223 additions and 205 deletions.
6 changes: 3 additions & 3 deletions packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ describe('ReactDOMFiberAsync', () => {
expect(ops).toEqual(['BC', 'ABCD']);
});

// @gate experimental
// @gate experimental || www
it('flushControlled flushes updates before yielding to browser', () => {
let inst;
class Counter extends React.Component {
Expand Down Expand Up @@ -326,7 +326,7 @@ describe('ReactDOMFiberAsync', () => {
]);
});

// @gate experimental
// @gate experimental || www
it('flushControlled does not flush until end of outermost batchedUpdates', () => {
let inst;
class Counter extends React.Component {
Expand Down Expand Up @@ -357,7 +357,7 @@ describe('ReactDOMFiberAsync', () => {
]);
});

// @gate experimental
// @gate experimental || www
it('flushControlled returns nothing', () => {
// In the future, we may want to return a thenable "work" object.
let inst;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ describe('ReactDOMServerPartialHydration', () => {
expect(span.className).toBe('hi');
});

// @gate experimental
// @gate experimental || www
it('blocks updates to hydrate the content first if props changed at idle priority', async () => {
let suspend = false;
let resolve;
Expand Down Expand Up @@ -1498,7 +1498,7 @@ describe('ReactDOMServerPartialHydration', () => {
expect(container.textContent).toBe('ALoading B');
});

// @gate experimental
// @gate experimental || www
it('clears server boundaries when SuspenseList runs out of time hydrating', async () => {
let suspend = false;
let resolve;
Expand Down Expand Up @@ -1912,7 +1912,7 @@ describe('ReactDOMServerPartialHydration', () => {
document.body.removeChild(container);
});

// @gate experimental
// @gate www
it('does not invoke an event on a hydrated event handle until it commits', async () => {
const setClick = ReactDOM.unstable_createEventHandle('click');
let suspend = false;
Expand Down Expand Up @@ -2077,7 +2077,7 @@ describe('ReactDOMServerPartialHydration', () => {
document.body.removeChild(container);
});

// @gate experimental
// @gate www
it('invokes discrete events on nested suspense boundaries in a root (createEventHandle)', async () => {
let suspend = false;
let isServerRendering = true;
Expand Down Expand Up @@ -2617,7 +2617,7 @@ describe('ReactDOMServerPartialHydration', () => {
expect(span.innerHTML).toBe('Hidden child');
});

// @gate experimental
// @gate experimental || www
it('renders a hidden LegacyHidden component inside a Suspense boundary', async () => {
const ref = React.createRef();

Expand Down Expand Up @@ -2646,7 +2646,7 @@ describe('ReactDOMServerPartialHydration', () => {
expect(span.innerHTML).toBe('Hidden child');
});

// @gate experimental
// @gate experimental || www
it('renders a visible LegacyHidden component', async () => {
const ref = React.createRef();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
document.body.removeChild(container);
});

// @gate experimental
// @gate www
it('hydrates the target boundary synchronously during a click (createEventHandle)', async () => {
const setClick = ReactDOM.unstable_createEventHandle('click');
let isServerRendering = true;
Expand Down Expand Up @@ -438,7 +438,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
document.body.removeChild(container);
});

// @gate experimental
// @gate www
it('hydrates at higher pri if sync did not work first time (createEventHandle)', async () => {
let suspend = false;
let isServerRendering = true;
Expand Down Expand Up @@ -526,7 +526,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
document.body.removeChild(container);
});

// @gate experimental
// @gate www
it('hydrates at higher pri for secondary discrete events (createEventHandle)', async () => {
const setClick = ReactDOM.unstable_createEventHandle('click');
let suspend = false;
Expand Down Expand Up @@ -812,7 +812,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
document.body.removeChild(container);
});

// @gate experimental
// @gate experimental || www
it('hydrates the last explicitly hydrated target at higher priority', async () => {
function Child({text}) {
Scheduler.unstable_yieldValue(text);
Expand Down Expand Up @@ -861,7 +861,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
expect(Scheduler).toFlushAndYield(['App', 'C', 'B', 'A']);
});

// @gate experimental
// @gate experimental || www
it('hydrates before an update even if hydration moves away from it', async () => {
function Child({text}) {
Scheduler.unstable_yieldValue(text);
Expand Down
Loading

0 comments on commit 86715ef

Please sign in to comment.