diff --git a/blocks/library/video/index.js b/blocks/library/video/index.js index 33143675fd82d7..88f38a41e904fe 100644 --- a/blocks/library/video/index.js +++ b/blocks/library/video/index.js @@ -11,11 +11,11 @@ import { Placeholder } from '@wordpress/components'; /** * Internal dependencies */ -import { registerBlockType, query } from '../../api'; +import { registerBlockType, source } from '../../api'; import MediaUploadButton from '../../media-upload-button'; import Editable from '../../editable'; -const { attr, children } = query; +const { attr, children } = source; registerBlockType( 'core/video', { title: __( 'Video' ), @@ -25,8 +25,14 @@ registerBlockType( 'core/video', { category: 'common', attributes: { - src: attr( 'video', 'src' ), - caption: children( 'figcaption' ), + src: { + type: 'string', + source: attr( 'video', 'src' ), + }, + caption: { + type: 'array', + source: children( 'figcaption' ), + }, }, edit( { attributes, setAttributes, className, focus, setFocus } ) { diff --git a/blocks/test/fixtures/core__video.html b/blocks/test/fixtures/core__video.html new file mode 100644 index 00000000000000..e07f78b6c31695 --- /dev/null +++ b/blocks/test/fixtures/core__video.html @@ -0,0 +1,3 @@ + +
+ diff --git a/blocks/test/fixtures/core__video.json b/blocks/test/fixtures/core__video.json new file mode 100644 index 00000000000000..c6765b6701bda2 --- /dev/null +++ b/blocks/test/fixtures/core__video.json @@ -0,0 +1,11 @@ +[ + { + "uid": "_uid_0", + "name": "core/video", + "isValid": true, + "attributes": { + "src": "https://awesome-fake.video/file.mp4", + "caption": [] + } + } +] diff --git a/blocks/test/fixtures/core__video.parsed.json b/blocks/test/fixtures/core__video.parsed.json new file mode 100644 index 00000000000000..11263bad0a5eec --- /dev/null +++ b/blocks/test/fixtures/core__video.parsed.json @@ -0,0 +1,11 @@ +[ + { + "blockName": "core/video", + "attrs": null, + "rawContent": "\n
\n" + }, + { + "attrs": {}, + "rawContent": "\n" + } +] diff --git a/blocks/test/fixtures/core__video.serialized.html b/blocks/test/fixtures/core__video.serialized.html new file mode 100644 index 00000000000000..5b6c233e241f19 --- /dev/null +++ b/blocks/test/fixtures/core__video.serialized.html @@ -0,0 +1,3 @@ + +
+ diff --git a/editor/test/state.js b/editor/test/state.js index 413942a31d17ad..83b9adbf671e9f 100644 --- a/editor/test/state.js +++ b/editor/test/state.js @@ -969,7 +969,7 @@ describe( 'state', () => { type: 'SETUP_EDITOR', } ); - expect( initial.recentlyUsedBlocks ).toEqual( expect.arrayContaining( [ 'core/test-block', 'core/paragraph' ] ) ); + expect( initial.recentlyUsedBlocks ).toEqual( expect.arrayContaining( [ 'core/paragraph' ] ) ); } ); } ); } );