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

RNMobile: Remove redundant code in Video block #59378

Merged
merged 1 commit into from
Feb 27, 2024
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
7 changes: 2 additions & 5 deletions packages/block-library/src/video/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class VideoEdit extends Component {
render() {
const { setAttributes, attributes, isSelected, wasBlockJustInserted } =
this.props;
const { id, src, guid } = attributes;
const { id, src } = attributes;
const { videoContainerHeight } = this.state;

const toolbarEditButton = (
Expand All @@ -236,10 +236,7 @@ class VideoEdit extends Component {
></MediaUpload>
);

// NOTE: `guid` is not part of the block's attribute definition. This case
// handled here is a temporary fix until a we find a better approach.
const isSourcePresent = src || ( guid && id );
if ( ! isSourcePresent ) {
if ( ! src ) {
return (
<View style={ { flex: 1 } }>
<MediaPlaceholder
Expand Down
14 changes: 0 additions & 14 deletions packages/block-library/src/video/test/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,6 @@ describe( 'Video block', () => {
initialHtml: `
<!-- wp:video {"id":1234} -->
<figure class="wp-block-video"><video controls src="https://VIDEO_URL.mp4"></video></figure>
<!-- /wp:video -->
`,
} );
const addVideoButton = screen.queryByText( 'Add video' );
expect( addVideoButton ).toBeNull();
} );

it( `should not render empty state when 'guid' and 'id' attributes are present`, async () => {
await initializeEditor( {
initialHtml: `
<!-- wp:video {"guid":"ABCD1234","id":1234 -->
<figure class="wp-block-video wp-block-embed is-type-video is-provider-videopress"><div class="wp-block-embed__wrapper">
https://videopress.com/<VIDEO_ID>
</div></figure>
<!-- /wp:video -->
`,
} );
Expand Down
Loading