mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[react-ui] Remove event object warnings (#16822)
This commit is contained in:
@@ -303,16 +303,6 @@ function validateEventValue(eventValue: any): void {
|
||||
);
|
||||
}
|
||||
};
|
||||
eventValue.preventDefault = () => {
|
||||
if (__DEV__) {
|
||||
showWarning('preventDefault()');
|
||||
}
|
||||
};
|
||||
eventValue.stopPropagation = () => {
|
||||
if (__DEV__) {
|
||||
showWarning('stopPropagation()');
|
||||
}
|
||||
};
|
||||
eventValue.isDefaultPrevented = () => {
|
||||
if (__DEV__) {
|
||||
showWarning('isDefaultPrevented()');
|
||||
|
||||
@@ -837,30 +837,6 @@ describe('DOMEventResponderSystem', () => {
|
||||
</button>
|
||||
);
|
||||
};
|
||||
expect(() => {
|
||||
handler = event => {
|
||||
event.preventDefault();
|
||||
};
|
||||
ReactDOM.render(<Test />, container);
|
||||
dispatchClickEvent(buttonRef.current);
|
||||
}).toWarnDev(
|
||||
'Warning: preventDefault() is not available on event objects created from event responder modules ' +
|
||||
'(React Flare).' +
|
||||
' Try wrapping in a conditional, i.e. `if (event.type !== "press") { event.preventDefault() }`',
|
||||
{withoutStack: true},
|
||||
);
|
||||
expect(() => {
|
||||
handler = event => {
|
||||
event.stopPropagation();
|
||||
};
|
||||
ReactDOM.render(<Test />, container);
|
||||
dispatchClickEvent(buttonRef.current);
|
||||
}).toWarnDev(
|
||||
'Warning: stopPropagation() is not available on event objects created from event responder modules ' +
|
||||
'(React Flare).' +
|
||||
' Try wrapping in a conditional, i.e. `if (event.type !== "press") { event.stopPropagation() }`',
|
||||
{withoutStack: true},
|
||||
);
|
||||
expect(() => {
|
||||
handler = event => {
|
||||
event.isDefaultPrevented();
|
||||
|
||||
Reference in New Issue
Block a user