Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #21972: Add onResize event to video elements #21973

Merged
merged 2 commits into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fixtures/dom/src/components/fixtures/media-events/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default class MediaEvents extends React.Component {
onPlaying: false,
onProgress: false,
onRateChange: false,
onResize: false,
onSeeked: false,
onSeeking: false,
onSuspend: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ describe('ReactDOMEventListener', () => {
onPlaying() {},
onProgress() {},
onRateChange() {},
onResize() {},
onSeeked() {},
onSeeking() {},
onStalled() {},
Expand Down Expand Up @@ -430,6 +431,7 @@ describe('ReactDOMEventListener', () => {
case 'playing':
case 'progress':
case 'ratechange':
case 'resize':
case 'seeked':
case 'seeking':
case 'stalled':
Expand Down
16 changes: 16 additions & 0 deletions packages/react-dom/src/__tests__/ReactDOMEventPropagation-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,22 @@ describe('ReactDOMEventListener', () => {
});
});

it('onResize', () => {
testEmulatedBubblingEvent({
type: 'video',
reactEvent: 'onResize',
reactEventType: 'resize',
nativeEvent: 'resize',
dispatch(node) {
const e = new Event('resize', {
bubbles: false,
cancelable: true,
});
node.dispatchEvent(e);
},
});
});

it('onSeeked', () => {
testEmulatedBubblingEvent({
type: 'video',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Array [
"progress",
"rateChange",
"reset",
"resize",
"scroll",
"seeked",
"seeking",
Expand Down
1 change: 1 addition & 0 deletions packages/react-dom/src/events/DOMEventNames.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export type DOMEventName =
| 'progress'
| 'ratechange'
| 'reset'
| 'resize'
| 'scroll'
| 'seeked'
| 'seeking'
Expand Down
1 change: 1 addition & 0 deletions packages/react-dom/src/events/DOMEventProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ const simpleEventPluginEvents = [
'progress',
'rateChange',
'reset',
'resize',
'seeked',
'seeking',
'stalled',
Expand Down
1 change: 1 addition & 0 deletions packages/react-dom/src/events/DOMPluginEventSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export const mediaEventTypes: Array<DOMEventName> = [
'playing',
'progress',
'ratechange',
'resize',
'seeked',
'seeking',
'stalled',
Expand Down
1 change: 1 addition & 0 deletions packages/react-dom/src/events/ReactDOMEventListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ export function getEventPriority(domEventName: DOMEventName): * {
case 'pointerup':
case 'ratechange':
case 'reset':
case 'resize':
case 'seeked':
case 'submit':
case 'touchcancel':
Expand Down
1 change: 1 addition & 0 deletions packages/react-dom/src/events/TopLevelEventTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export type TopLevelType =
| 'progress'
| 'ratechange'
| 'reset'
| 'resize'
| 'scroll'
| 'seeked'
| 'seeking'
Expand Down
1 change: 1 addition & 0 deletions packages/react-dom/src/test-utils/ReactTestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ const simulatedEventTypes = [
'pointerUp',
'rateChange',
'reset',
'resize',
'seeked',
'submit',
'touchCancel',
Expand Down