Skip to content

Commit

Permalink
Gate createEventHandle / useFocus on www
Browse files Browse the repository at this point in the history
These are enabled in both www variants but not OSS experimental.
  • Loading branch information
sebmarkbage committed Jun 2, 2021
1 parent 955b294 commit f5bd334
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 76 deletions.
Original file line number Diff line number Diff line change
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ describe('DOMPluginEventSystem', () => {
act = ReactTestUtils.unstable_concurrentAct;
});

// @gate experimental
// @gate www
it('can render correctly with the ReactDOMServer', () => {
const clickEvent = jest.fn();
const setClick = ReactDOM.unstable_createEventHandle('click');
Expand All @@ -1275,7 +1275,7 @@ describe('DOMPluginEventSystem', () => {
expect(output).toBe(`<div>Hello world</div>`);
});

// @gate experimental
// @gate www
it('can render correctly with the ReactDOMServer hydration', () => {
const clickEvent = jest.fn();
const spanRef = React.createRef();
Expand All @@ -1301,7 +1301,7 @@ describe('DOMPluginEventSystem', () => {
expect(clickEvent).toHaveBeenCalledTimes(1);
});

// @gate experimental
// @gate www
it('should correctly work for a basic "click" listener', () => {
let log = [];
const clickEvent = jest.fn(event => {
Expand Down Expand Up @@ -1409,7 +1409,7 @@ describe('DOMPluginEventSystem', () => {
expect(clickEvent2).toBeCalledTimes(1);
});

// @gate experimental
// @gate www
it('should correctly work for setting and clearing a basic "click" listener', () => {
const clickEvent = jest.fn();
const divRef = React.createRef();
Expand Down Expand Up @@ -1450,7 +1450,7 @@ describe('DOMPluginEventSystem', () => {
expect(clickEvent).toBeCalledTimes(0);
});

// @gate experimental
// @gate www
it('should handle the target being a text node', () => {
const clickEvent = jest.fn();
const buttonRef = React.createRef();
Expand All @@ -1472,7 +1472,7 @@ describe('DOMPluginEventSystem', () => {
expect(clickEvent).toBeCalledTimes(1);
});

// @gate experimental
// @gate www
it('handle propagation of click events', () => {
const buttonRef = React.createRef();
const divRef = React.createRef();
Expand Down Expand Up @@ -1541,7 +1541,7 @@ describe('DOMPluginEventSystem', () => {
expect(log[3]).toEqual(['bubble', buttonElement]);
});

// @gate experimental
// @gate www
it('handle propagation of click events mixed with onClick events', () => {
const buttonRef = React.createRef();
const divRef = React.createRef();
Expand Down Expand Up @@ -1601,7 +1601,7 @@ describe('DOMPluginEventSystem', () => {
expect(log[5]).toEqual(['bubble', buttonElement]);
});

// @gate experimental
// @gate www
it('should correctly work for a basic "click" listener on the outer target', () => {
const log = [];
const clickEvent = jest.fn(event => {
Expand Down Expand Up @@ -1666,7 +1666,7 @@ describe('DOMPluginEventSystem', () => {
expect(clickEvent).toBeCalledTimes(2);
});

// @gate experimental
// @gate www
it('should correctly handle many nested target listeners', () => {
const buttonRef = React.createRef();
const targetListener1 = jest.fn();
Expand Down Expand Up @@ -1769,7 +1769,7 @@ describe('DOMPluginEventSystem', () => {
expect(targetListener4).toHaveBeenCalledTimes(2);
});

// @gate experimental
// @gate www
it('should correctly handle stopPropagation correctly for target events', () => {
const buttonRef = React.createRef();
const divRef = React.createRef();
Expand Down Expand Up @@ -1807,7 +1807,7 @@ describe('DOMPluginEventSystem', () => {
expect(clickEvent).toHaveBeenCalledTimes(0);
});

// @gate experimental
// @gate www
it('should correctly handle stopPropagation correctly for many target events', () => {
const buttonRef = React.createRef();
const targetListener1 = jest.fn(e => e.stopPropagation());
Expand Down Expand Up @@ -1860,7 +1860,7 @@ describe('DOMPluginEventSystem', () => {
expect(targetListener4).toHaveBeenCalledTimes(1);
});

// @gate experimental
// @gate www
it('should correctly handle stopPropagation for mixed capture/bubbling target listeners', () => {
const buttonRef = React.createRef();
const targetListener1 = jest.fn(e => e.stopPropagation());
Expand Down Expand Up @@ -1917,7 +1917,7 @@ describe('DOMPluginEventSystem', () => {
expect(targetListener4).toHaveBeenCalledTimes(0);
});

// @gate experimental
// @gate www
it('should work with concurrent mode updates', async () => {
const log = [];
const ref = React.createRef();
Expand Down Expand Up @@ -1970,7 +1970,7 @@ describe('DOMPluginEventSystem', () => {
expect(log).toEqual([{counter: 1}]);
});

// @gate experimental
// @gate www
it('should correctly work for a basic "click" window listener', () => {
const log = [];
const clickEvent = jest.fn(event => {
Expand Down Expand Up @@ -2021,7 +2021,7 @@ describe('DOMPluginEventSystem', () => {
expect(clickEvent).toBeCalledTimes(2);
});

// @gate experimental
// @gate www
it('handle propagation of click events on the window', () => {
const buttonRef = React.createRef();
const divRef = React.createRef();
Expand Down Expand Up @@ -2101,7 +2101,7 @@ describe('DOMPluginEventSystem', () => {
expect(log[5]).toEqual(['bubble', window]);
});

// @gate experimental
// @gate www
it('should correctly handle stopPropagation for mixed listeners', () => {
const buttonRef = React.createRef();
const rootListener1 = jest.fn(e => e.stopPropagation());
Expand Down Expand Up @@ -2152,7 +2152,7 @@ describe('DOMPluginEventSystem', () => {
expect(rootListener2).toHaveBeenCalledTimes(0);
});

// @gate experimental
// @gate www
it('should correctly handle stopPropagation for delegated listeners', () => {
const buttonRef = React.createRef();
const rootListener1 = jest.fn(e => e.stopPropagation());
Expand Down Expand Up @@ -2198,7 +2198,7 @@ describe('DOMPluginEventSystem', () => {
expect(rootListener4).toHaveBeenCalledTimes(0);
});

// @gate experimental
// @gate www
it('handle propagation of click events on the window and document', () => {
const buttonRef = React.createRef();
const divRef = React.createRef();
Expand Down Expand Up @@ -2311,7 +2311,7 @@ describe('DOMPluginEventSystem', () => {
}
});

// @gate experimental
// @gate www
it('does not support custom user events', () => {
// With eager listeners, supporting custom events via this API doesn't make sense
// because we can't know a full list of them ahead of time. Let's check we throw
Expand All @@ -2323,7 +2323,7 @@ describe('DOMPluginEventSystem', () => {
);
});

// @gate experimental
// @gate www
it('beforeblur and afterblur are called after a focused element is unmounted', () => {
const log = [];
// We have to persist here because we want to read relatedTarget later.
Expand Down Expand Up @@ -2382,7 +2382,7 @@ describe('DOMPluginEventSystem', () => {
expect(log).toEqual(['beforeblur', 'afterblur']);
});

// @gate experimental
// @gate www
it('beforeblur and afterblur are called after a nested focused element is unmounted', () => {
const log = [];
// We have to persist here because we want to read relatedTarget later.
Expand Down Expand Up @@ -2445,7 +2445,7 @@ describe('DOMPluginEventSystem', () => {
expect(log).toEqual(['beforeblur', 'afterblur']);
});

// @gate experimental
// @gate www
it('beforeblur should skip handlers from a deleted subtree after the focused element is unmounted', () => {
const onBeforeBlur = jest.fn();
const innerRef = React.createRef();
Expand Down Expand Up @@ -2499,7 +2499,7 @@ describe('DOMPluginEventSystem', () => {
expect(onBeforeBlur).toHaveBeenCalledTimes(1);
});

// @gate experimental
// @gate www
it('beforeblur and afterblur are called after a focused element is suspended', () => {
const log = [];
// We have to persist here because we want to read relatedTarget later.
Expand Down Expand Up @@ -2585,7 +2585,7 @@ describe('DOMPluginEventSystem', () => {
document.body.removeChild(container2);
});

// @gate experimental
// @gate www
it('beforeblur should skip handlers from a deleted subtree after the focused element is suspended', () => {
const onBeforeBlur = jest.fn();
const innerRef = React.createRef();
Expand Down Expand Up @@ -2666,7 +2666,7 @@ describe('DOMPluginEventSystem', () => {
document.body.removeChild(container2);
});

// @gate experimental
// @gate www
it('regression: does not fire beforeblur/afterblur if target is already hidden', () => {
const Suspense = React.Suspense;
let suspend = false;
Expand Down Expand Up @@ -2728,7 +2728,7 @@ describe('DOMPluginEventSystem', () => {
document.body.removeChild(container2);
});

// @gate experimental
// @gate www
it('handle propagation of click events between disjointed comment roots', () => {
const buttonRef = React.createRef();
const divRef = React.createRef();
Expand Down Expand Up @@ -2799,7 +2799,7 @@ describe('DOMPluginEventSystem', () => {
expect(log[5]).toEqual(['bubble', buttonElement]);
});

// @gate experimental
// @gate www
it('propagates known createEventHandle events through portals without inner listeners', () => {
const buttonRef = React.createRef();
const divRef = React.createRef();
Expand Down Expand Up @@ -2870,7 +2870,7 @@ describe('DOMPluginEventSystem', () => {
ReactDOMServer = require('react-dom/server');
});

// @gate experimental
// @gate www
it('handle propagation of click events on a scope', () => {
const buttonRef = React.createRef();
const log = [];
Expand Down Expand Up @@ -2926,7 +2926,7 @@ describe('DOMPluginEventSystem', () => {
]);
});

// @gate experimental
// @gate www
it('handle mixed propagation of click events on a scope', () => {
const buttonRef = React.createRef();
const divRef = React.createRef();
Expand Down Expand Up @@ -3017,7 +3017,7 @@ describe('DOMPluginEventSystem', () => {
]);
});

// @gate experimental
// @gate www
it('should not handle the target being a dangling text node within a scope', () => {
const clickEvent = jest.fn();
const buttonRef = React.createRef();
Expand Down Expand Up @@ -3048,7 +3048,7 @@ describe('DOMPluginEventSystem', () => {
expect(clickEvent).toBeCalledTimes(0);
});

// @gate experimental
// @gate www
it('handle stopPropagation (inner) correctly between scopes', () => {
const buttonRef = React.createRef();
const outerOnClick = jest.fn();
Expand Down Expand Up @@ -3090,7 +3090,7 @@ describe('DOMPluginEventSystem', () => {
expect(outerOnClick).toHaveBeenCalledTimes(0);
});

// @gate experimental
// @gate www
it('handle stopPropagation (outer) correctly between scopes', () => {
const buttonRef = React.createRef();
const outerOnClick = jest.fn(e => e.stopPropagation());
Expand Down Expand Up @@ -3132,7 +3132,7 @@ describe('DOMPluginEventSystem', () => {
expect(outerOnClick).toHaveBeenCalledTimes(1);
});

// @gate experimental
// @gate www
it('handle stopPropagation (inner and outer) correctly between scopes', () => {
const buttonRef = React.createRef();
const onClick = jest.fn(e => e.stopPropagation());
Expand Down Expand Up @@ -3172,7 +3172,7 @@ describe('DOMPluginEventSystem', () => {
expect(onClick).toHaveBeenCalledTimes(1);
});

// @gate experimental
// @gate www
it('should be able to register handlers for events affected by the intervention', () => {
const rootContainer = document.createElement('div');
container.appendChild(rootContainer);
Expand Down
Loading

0 comments on commit f5bd334

Please sign in to comment.