@wordpress/block-library 7.17.0 → 7.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/audio/edit.js +44 -4
- package/build/audio/edit.js.map +1 -1
- package/build/button/deprecated.js +16 -2
- package/build/button/deprecated.js.map +1 -1
- package/build/button/edit.js +14 -8
- package/build/button/edit.js.map +1 -1
- package/build/button/index.js +4 -1
- package/build/button/index.js.map +1 -1
- package/build/button/save.js +2 -0
- package/build/button/save.js.map +1 -1
- package/build/buttons/edit.native.js +1 -1
- package/build/buttons/edit.native.js.map +1 -1
- package/build/columns/transforms.js +5 -0
- package/build/columns/transforms.js.map +1 -1
- package/build/comment-template/index.js +6 -2
- package/build/comment-template/index.js.map +1 -1
- package/build/cover/edit/index.js +3 -1
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +3 -7
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/embed/deprecated.js +43 -4
- package/build/embed/deprecated.js.map +1 -1
- package/build/file/deprecated.js +108 -4
- package/build/file/deprecated.js.map +1 -1
- package/build/file/transforms.js +3 -9
- package/build/file/transforms.js.map +1 -1
- package/build/gallery/deprecated.js +148 -23
- package/build/gallery/deprecated.js.map +1 -1
- package/build/gallery/gallery.js +3 -2
- package/build/gallery/gallery.js.map +1 -1
- package/build/gallery/use-image-sizes.js +2 -1
- package/build/gallery/use-image-sizes.js.map +1 -1
- package/build/gallery/v1/edit.js +6 -3
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/group/edit.js +105 -48
- package/build/group/edit.js.map +1 -1
- package/build/group/index.js +3 -0
- package/build/group/index.js.map +1 -1
- package/build/group/placeholder.js +168 -0
- package/build/group/placeholder.js.map +1 -0
- package/build/group/variations.js +3 -3
- package/build/group/variations.js.map +1 -1
- package/build/image/edit.native.js +1 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +6 -9
- package/build/image/image.js.map +1 -1
- package/build/latest-comments/edit.js +2 -1
- package/build/latest-comments/edit.js.map +1 -1
- package/build/latest-comments/index.js +5 -1
- package/build/latest-comments/index.js.map +1 -1
- package/build/latest-posts/deprecated.js +13 -0
- package/build/latest-posts/deprecated.js.map +1 -1
- package/build/latest-posts/edit.js +1 -1
- package/build/latest-posts/edit.js.map +1 -1
- package/build/latest-posts/index.js +13 -0
- package/build/latest-posts/index.js.map +1 -1
- package/build/list/utils.js +4 -8
- package/build/list/utils.js.map +1 -1
- package/build/list-item/edit.js +2 -1
- package/build/list-item/edit.js.map +1 -1
- package/build/list-item/hooks/use-outdent-list-item.js +5 -7
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build/navigation/edit/index.js +94 -103
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/manage-menus-button.js +36 -0
- package/build/navigation/edit/manage-menus-button.js.map +1 -0
- package/build/navigation/edit/navigation-menu-selector.js +12 -5
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/edit/responsive-wrapper.js +2 -6
- package/build/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build/navigation/edit/unsaved-inner-blocks.js +5 -17
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation-link/edit.js +14 -3
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +4 -4
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/edit.js +29 -10
- package/build/page-list/edit.js.map +1 -1
- package/build/post-author/edit.js +35 -20
- package/build/post-author/edit.js.map +1 -1
- package/build/post-comments-count/index.js +4 -0
- package/build/post-comments-count/index.js.map +1 -1
- package/build/post-comments-form/index.js +4 -0
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-comments-link/index.js +4 -0
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-content/edit.js +14 -6
- package/build/post-content/edit.js.map +1 -1
- package/build/post-content/index.js +3 -0
- package/build/post-content/index.js.map +1 -1
- package/build/pullquote/deprecated.js +6 -6
- package/build/pullquote/deprecated.js.map +1 -1
- package/build/search/edit.js +1 -3
- package/build/search/edit.js.map +1 -1
- package/build/site-logo/edit.js +2 -2
- package/build/site-logo/edit.js.map +1 -1
- package/build/site-tagline/edit.js +21 -9
- package/build/site-tagline/edit.js.map +1 -1
- package/build/site-title/edit/index.js +20 -8
- package/build/site-title/edit/index.js.map +1 -1
- package/build/social-link/edit.js +11 -2
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/index.js +3 -0
- package/build/social-link/index.js.map +1 -1
- package/build/spacer/controls.js +3 -7
- package/build/spacer/controls.js.map +1 -1
- package/build/table/deprecated.js +282 -27
- package/build/table/deprecated.js.map +1 -1
- package/build/table/state.js +1 -1
- package/build/table/state.js.map +1 -1
- package/build/template-part/variations.js +5 -0
- package/build/template-part/variations.js.map +1 -1
- package/build/utils/clean-empty-object.js +5 -4
- package/build/utils/clean-empty-object.js.map +1 -1
- package/build/video/deprecated.js +159 -0
- package/build/video/deprecated.js.map +1 -0
- package/build/video/edit.js +41 -5
- package/build/video/edit.js.map +1 -1
- package/build/video/index.js +3 -0
- package/build/video/index.js.map +1 -1
- package/build/video/tracks-editor.js +3 -28
- package/build/video/tracks-editor.js.map +1 -1
- package/build-module/audio/edit.js +46 -7
- package/build-module/audio/edit.js.map +1 -1
- package/build-module/button/deprecated.js +16 -2
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/edit.js +16 -10
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/index.js +4 -1
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/save.js +2 -0
- package/build-module/button/save.js.map +1 -1
- package/build-module/buttons/edit.native.js +1 -1
- package/build-module/buttons/edit.native.js.map +1 -1
- package/build-module/columns/transforms.js +5 -0
- package/build-module/columns/transforms.js.map +1 -1
- package/build-module/comment-template/index.js +6 -2
- package/build-module/comment-template/index.js.map +1 -1
- package/build-module/cover/edit/index.js +3 -1
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +4 -8
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/embed/deprecated.js +44 -5
- package/build-module/embed/deprecated.js.map +1 -1
- package/build-module/file/deprecated.js +108 -4
- package/build-module/file/deprecated.js.map +1 -1
- package/build-module/file/transforms.js +3 -8
- package/build-module/file/transforms.js.map +1 -1
- package/build-module/gallery/deprecated.js +147 -25
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/gallery/gallery.js +3 -2
- package/build-module/gallery/gallery.js.map +1 -1
- package/build-module/gallery/use-image-sizes.js +3 -2
- package/build-module/gallery/use-image-sizes.js.map +1 -1
- package/build-module/gallery/v1/edit.js +7 -4
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/group/edit.js +101 -48
- package/build-module/group/edit.js.map +1 -1
- package/build-module/group/index.js +3 -0
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/placeholder.js +154 -0
- package/build-module/group/placeholder.js.map +1 -0
- package/build-module/group/variations.js +3 -3
- package/build-module/group/variations.js.map +1 -1
- package/build-module/image/edit.native.js +1 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +8 -11
- package/build-module/image/image.js.map +1 -1
- package/build-module/latest-comments/edit.js +2 -1
- package/build-module/latest-comments/edit.js.map +1 -1
- package/build-module/latest-comments/index.js +5 -1
- package/build-module/latest-comments/index.js.map +1 -1
- package/build-module/latest-posts/deprecated.js +13 -0
- package/build-module/latest-posts/deprecated.js.map +1 -1
- package/build-module/latest-posts/edit.js +2 -2
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/latest-posts/index.js +13 -0
- package/build-module/latest-posts/index.js.map +1 -1
- package/build-module/list/utils.js +5 -9
- package/build-module/list/utils.js.map +1 -1
- package/build-module/list-item/edit.js +2 -1
- package/build-module/list-item/edit.js.map +1 -1
- package/build-module/list-item/hooks/use-outdent-list-item.js +5 -6
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build-module/navigation/edit/index.js +96 -105
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/manage-menus-button.js +26 -0
- package/build-module/navigation/edit/manage-menus-button.js.map +1 -0
- package/build-module/navigation/edit/navigation-menu-selector.js +13 -6
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/edit/responsive-wrapper.js +2 -6
- package/build-module/navigation/edit/responsive-wrapper.js.map +1 -1
- package/build-module/navigation/edit/unsaved-inner-blocks.js +7 -18
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation-link/edit.js +14 -4
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +4 -4
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/edit.js +29 -10
- package/build-module/page-list/edit.js.map +1 -1
- package/build-module/post-author/edit.js +35 -21
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-comments-count/index.js +4 -0
- package/build-module/post-comments-count/index.js.map +1 -1
- package/build-module/post-comments-form/index.js +4 -0
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-comments-link/index.js +4 -0
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-content/edit.js +14 -6
- package/build-module/post-content/edit.js.map +1 -1
- package/build-module/post-content/index.js +3 -0
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/pullquote/deprecated.js +7 -7
- package/build-module/pullquote/deprecated.js.map +1 -1
- package/build-module/search/edit.js +1 -3
- package/build-module/search/edit.js.map +1 -1
- package/build-module/site-logo/edit.js +3 -3
- package/build-module/site-logo/edit.js.map +1 -1
- package/build-module/site-tagline/edit.js +23 -11
- package/build-module/site-tagline/edit.js.map +1 -1
- package/build-module/site-title/edit/index.js +22 -10
- package/build-module/site-title/edit/index.js.map +1 -1
- package/build-module/social-link/edit.js +11 -2
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/index.js +3 -0
- package/build-module/social-link/index.js.map +1 -1
- package/build-module/spacer/controls.js +4 -8
- package/build-module/spacer/controls.js.map +1 -1
- package/build-module/table/deprecated.js +282 -27
- package/build-module/table/deprecated.js.map +1 -1
- package/build-module/table/state.js +1 -1
- package/build-module/table/state.js.map +1 -1
- package/build-module/template-part/variations.js +5 -0
- package/build-module/template-part/variations.js.map +1 -1
- package/build-module/utils/clean-empty-object.js +5 -5
- package/build-module/utils/clean-empty-object.js.map +1 -1
- package/build-module/video/deprecated.js +147 -0
- package/build-module/video/deprecated.js.map +1 -0
- package/build-module/video/edit.js +45 -9
- package/build-module/video/edit.js.map +1 -1
- package/build-module/video/index.js +2 -0
- package/build-module/video/index.js.map +1 -1
- package/build-module/video/tracks-editor.js +4 -29
- package/build-module/video/tracks-editor.js.map +1 -1
- package/build-style/button/style-rtl.css +1 -0
- package/build-style/button/style.css +1 -0
- package/build-style/comment-template/style-rtl.css +1 -0
- package/build-style/comment-template/style.css +1 -0
- package/build-style/editor-rtl.css +80 -5
- package/build-style/editor.css +80 -5
- package/build-style/group/editor-rtl.css +44 -0
- package/build-style/group/editor.css +44 -0
- package/build-style/latest-comments/style-rtl.css +1 -0
- package/build-style/latest-comments/style.css +1 -0
- package/build-style/latest-posts/style-rtl.css +3 -0
- package/build-style/latest-posts/style.css +3 -0
- package/build-style/navigation/editor-rtl.css +27 -4
- package/build-style/navigation/editor.css +27 -4
- package/build-style/navigation/style-rtl.css +13 -1
- package/build-style/navigation/style.css +13 -1
- package/build-style/navigation-link/editor-rtl.css +8 -1
- package/build-style/navigation-link/editor.css +8 -1
- package/build-style/post-comments-form/style-rtl.css +3 -0
- package/build-style/post-comments-form/style.css +3 -0
- package/build-style/query/editor-rtl.css +1 -1
- package/build-style/query/editor.css +1 -1
- package/build-style/query-pagination/style-rtl.css +1 -1
- package/build-style/query-pagination/style.css +1 -1
- package/build-style/style-rtl.css +28 -2
- package/build-style/style.css +28 -2
- package/build-style/table/editor-rtl.css +1 -0
- package/build-style/table/editor.css +1 -0
- package/build-style/table/style-rtl.css +5 -0
- package/build-style/table/style.css +5 -0
- package/build-style/table/theme-rtl.css +1 -3
- package/build-style/table/theme.css +1 -3
- package/build-style/theme-rtl.css +1 -3
- package/build-style/theme.css +1 -3
- package/package.json +29 -28
- package/src/audio/edit.js +79 -24
- package/src/avatar/index.php +1 -1
- package/src/block/test/edit.native.js +8 -8
- package/src/button/block.json +4 -1
- package/src/button/deprecated.js +18 -2
- package/src/button/edit.js +12 -10
- package/src/button/save.js +12 -2
- package/src/button/style.scss +2 -0
- package/src/buttons/edit.native.js +1 -1
- package/src/buttons/test/edit.native.js +19 -19
- package/src/columns/test/edit.native.js +32 -32
- package/src/columns/transforms.js +8 -0
- package/src/comment-template/block.json +6 -2
- package/src/comment-template/style.scss +2 -0
- package/src/cover/edit/index.js +3 -1
- package/src/cover/edit/inspector-controls.js +11 -13
- package/src/cover/test/edit.native.js +26 -26
- package/src/embed/deprecated.js +53 -26
- package/src/embed/test/index.native.js +43 -43
- package/src/file/deprecated.js +130 -2
- package/src/file/transforms.js +3 -8
- package/src/gallery/deprecated.js +129 -4
- package/src/gallery/gallery.js +2 -0
- package/src/gallery/index.php +19 -10
- package/src/gallery/test/index.native.js +11 -11
- package/src/gallery/use-image-sizes.js +3 -2
- package/src/gallery/v1/edit.js +21 -25
- package/src/group/block.json +3 -0
- package/src/group/edit.js +105 -46
- package/src/group/editor.scss +48 -0
- package/src/group/placeholder.js +187 -0
- package/src/group/test/edit.native.js +3 -3
- package/src/group/test/placeholder.js +78 -0
- package/src/group/variations.js +3 -3
- package/src/image/edit.native.js +1 -1
- package/src/image/image.js +22 -10
- package/src/image/test/edit.native.js +17 -17
- package/src/latest-comments/block.json +5 -1
- package/src/latest-comments/edit.js +1 -0
- package/src/latest-comments/style.scss +3 -0
- package/src/latest-posts/block.json +13 -0
- package/src/latest-posts/edit.js +2 -2
- package/src/latest-posts/style.scss +3 -0
- package/src/list/test/edit.native.js +36 -36
- package/src/list/utils.js +3 -11
- package/src/list-item/edit.js +1 -0
- package/src/list-item/hooks/use-outdent-list-item.js +3 -6
- package/src/missing/test/edit-integration.native.js +5 -5
- package/src/navigation/edit/index.js +186 -161
- package/src/navigation/edit/manage-menus-button.js +21 -0
- package/src/navigation/edit/navigation-menu-selector.js +20 -5
- package/src/navigation/edit/responsive-wrapper.js +2 -10
- package/src/navigation/edit/unsaved-inner-blocks.js +5 -22
- package/src/navigation/editor.scss +29 -4
- package/src/navigation/style.scss +19 -1
- package/src/navigation-link/edit.js +13 -4
- package/src/navigation-link/editor.scss +8 -0
- package/src/navigation-submenu/edit.js +7 -5
- package/src/page-list/edit.js +36 -22
- package/src/post-author/edit.js +44 -20
- package/src/post-comments-count/block.json +4 -0
- package/src/post-comments-form/block.json +4 -0
- package/src/post-comments-form/style.scss +3 -0
- package/src/post-comments-link/block.json +4 -0
- package/src/post-content/block.json +3 -0
- package/src/post-content/edit.js +8 -4
- package/src/pullquote/deprecated.js +7 -7
- package/src/query/editor.scss +1 -1
- package/src/query-pagination/style.scss +1 -1
- package/src/read-more/index.php +9 -2
- package/src/search/edit.js +1 -1
- package/src/shortcode/test/edit.native.js +5 -5
- package/src/site-logo/edit.js +3 -3
- package/src/site-tagline/edit.js +25 -18
- package/src/site-title/edit/index.js +26 -12
- package/src/social-link/block.json +3 -0
- package/src/social-link/edit.js +8 -1
- package/src/social-link/index.php +11 -7
- package/src/social-link/test/index.native.js +10 -10
- package/src/social-links/test/edit.native.js +4 -4
- package/src/spacer/controls.js +10 -12
- package/src/spacer/test/index.native.js +17 -17
- package/src/table/deprecated.js +587 -348
- package/src/table/editor.scss +1 -0
- package/src/table/state.js +1 -1
- package/src/table/style.scss +7 -0
- package/src/table/theme.scss +1 -3
- package/src/template-part/index.php +5 -0
- package/src/template-part/variations.js +4 -0
- package/src/utils/clean-empty-object.js +5 -6
- package/src/video/deprecated.js +57 -0
- package/src/video/edit.js +71 -23
- package/src/video/index.js +2 -0
- package/src/video/tracks-editor.js +12 -28
|
@@ -75,7 +75,7 @@ describe( 'Columns block', () => {
|
|
|
75
75
|
const screen = await initializeEditor( {
|
|
76
76
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
77
77
|
} );
|
|
78
|
-
const {
|
|
78
|
+
const { getByLabelText } = screen;
|
|
79
79
|
|
|
80
80
|
// Get block
|
|
81
81
|
const columnsBlock = await getBlock( screen, 'Columns' );
|
|
@@ -85,7 +85,7 @@ describe( 'Columns block', () => {
|
|
|
85
85
|
await openBlockSettings( screen );
|
|
86
86
|
|
|
87
87
|
// Update the number of columns by adding one
|
|
88
|
-
const columnsControl =
|
|
88
|
+
const columnsControl = getByLabelText( /Number of columns/ );
|
|
89
89
|
fireEvent( columnsControl, 'accessibilityAction', {
|
|
90
90
|
nativeEvent: { actionName: 'increment' },
|
|
91
91
|
} );
|
|
@@ -97,7 +97,7 @@ describe( 'Columns block', () => {
|
|
|
97
97
|
const screen = await initializeEditor( {
|
|
98
98
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
99
99
|
} );
|
|
100
|
-
const {
|
|
100
|
+
const { getByLabelText } = screen;
|
|
101
101
|
|
|
102
102
|
// Wait for the block to be created.
|
|
103
103
|
const columnsBlock = await getBlock( screen, 'Columns' );
|
|
@@ -107,7 +107,7 @@ describe( 'Columns block', () => {
|
|
|
107
107
|
await openBlockSettings( screen );
|
|
108
108
|
|
|
109
109
|
// Update the number of columns by removing one
|
|
110
|
-
const columnsControl =
|
|
110
|
+
const columnsControl = getByLabelText( /Number of columns/ );
|
|
111
111
|
fireEvent( columnsControl, 'accessibilityAction', {
|
|
112
112
|
nativeEvent: { actionName: 'decrement' },
|
|
113
113
|
} );
|
|
@@ -117,7 +117,7 @@ describe( 'Columns block', () => {
|
|
|
117
117
|
|
|
118
118
|
it( 'reaches the minimum limit of number of column blocks', async () => {
|
|
119
119
|
const screen = await initializeEditor();
|
|
120
|
-
const {
|
|
120
|
+
const { getByLabelText, getByTestId } = screen;
|
|
121
121
|
|
|
122
122
|
// Add block
|
|
123
123
|
await addBlock( screen, 'Columns' );
|
|
@@ -131,7 +131,7 @@ describe( 'Columns block', () => {
|
|
|
131
131
|
const blockVariationModal = getByTestId( 'block-variation-modal' );
|
|
132
132
|
await waitFor( () => blockVariationModal.props.isVisible );
|
|
133
133
|
const threeColumnLayout =
|
|
134
|
-
within( blockVariationModal ).
|
|
134
|
+
within( blockVariationModal ).getByLabelText(
|
|
135
135
|
/33 \/ 33 \/ 33 block/
|
|
136
136
|
);
|
|
137
137
|
fireEvent.press( threeColumnLayout );
|
|
@@ -144,7 +144,7 @@ describe( 'Columns block', () => {
|
|
|
144
144
|
await openBlockSettings( screen );
|
|
145
145
|
|
|
146
146
|
// Update the number of columns by adding one
|
|
147
|
-
const columnsControl =
|
|
147
|
+
const columnsControl = getByLabelText( /Number of columns/ );
|
|
148
148
|
fireEvent( columnsControl, 'accessibilityAction', {
|
|
149
149
|
nativeEvent: { actionName: 'increment' },
|
|
150
150
|
} );
|
|
@@ -164,7 +164,7 @@ describe( 'Columns block', () => {
|
|
|
164
164
|
const screen = await initializeEditor( {
|
|
165
165
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
166
166
|
} );
|
|
167
|
-
const {
|
|
167
|
+
const { getByLabelText } = screen;
|
|
168
168
|
|
|
169
169
|
// Get block
|
|
170
170
|
const columnsBlock = await getBlock( screen, 'Columns' );
|
|
@@ -175,11 +175,11 @@ describe( 'Columns block', () => {
|
|
|
175
175
|
fireEvent.press( firstColumnBlock );
|
|
176
176
|
|
|
177
177
|
// Open block actions menu
|
|
178
|
-
const blockActionsButton =
|
|
178
|
+
const blockActionsButton = getByLabelText( /Open Block Actions Menu/ );
|
|
179
179
|
fireEvent.press( blockActionsButton );
|
|
180
180
|
|
|
181
181
|
// Delete block
|
|
182
|
-
const deleteButton =
|
|
182
|
+
const deleteButton = getByLabelText( /Remove block/ );
|
|
183
183
|
fireEvent.press( deleteButton );
|
|
184
184
|
|
|
185
185
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
@@ -189,7 +189,7 @@ describe( 'Columns block', () => {
|
|
|
189
189
|
const screen = await initializeEditor( {
|
|
190
190
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
191
191
|
} );
|
|
192
|
-
const {
|
|
192
|
+
const { getByLabelText } = screen;
|
|
193
193
|
|
|
194
194
|
// Get block
|
|
195
195
|
const columnsBlock = await getBlock( screen, 'Columns' );
|
|
@@ -200,11 +200,11 @@ describe( 'Columns block', () => {
|
|
|
200
200
|
fireEvent.press( firstColumnBlock );
|
|
201
201
|
|
|
202
202
|
// Open block actions menu
|
|
203
|
-
let blockActionsButton =
|
|
203
|
+
let blockActionsButton = getByLabelText( /Open Block Actions Menu/ );
|
|
204
204
|
fireEvent.press( blockActionsButton );
|
|
205
205
|
|
|
206
206
|
// Delete block
|
|
207
|
-
let deleteButton =
|
|
207
|
+
let deleteButton = getByLabelText( /Remove block/ );
|
|
208
208
|
fireEvent.press( deleteButton );
|
|
209
209
|
|
|
210
210
|
// Get the only left column
|
|
@@ -212,11 +212,11 @@ describe( 'Columns block', () => {
|
|
|
212
212
|
fireEvent.press( lastColumnBlock );
|
|
213
213
|
|
|
214
214
|
// Open block actions menu
|
|
215
|
-
blockActionsButton =
|
|
215
|
+
blockActionsButton = getByLabelText( /Open Block Actions Menu/ );
|
|
216
216
|
fireEvent.press( blockActionsButton );
|
|
217
217
|
|
|
218
218
|
// Delete block
|
|
219
|
-
deleteButton =
|
|
219
|
+
deleteButton = getByLabelText( /Remove block/ );
|
|
220
220
|
fireEvent.press( deleteButton );
|
|
221
221
|
|
|
222
222
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
@@ -226,20 +226,20 @@ describe( 'Columns block', () => {
|
|
|
226
226
|
const screen = await initializeEditor( {
|
|
227
227
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
228
228
|
} );
|
|
229
|
-
const {
|
|
229
|
+
const { getByLabelText } = screen;
|
|
230
230
|
|
|
231
231
|
// Get block
|
|
232
232
|
const columnsBlock = await getBlock( screen, 'Columns' );
|
|
233
233
|
fireEvent.press( columnsBlock );
|
|
234
234
|
|
|
235
235
|
// Open vertical alignment menu
|
|
236
|
-
const verticalAlignmentButton =
|
|
236
|
+
const verticalAlignmentButton = getByLabelText(
|
|
237
237
|
/Change vertical alignment/
|
|
238
238
|
);
|
|
239
239
|
fireEvent.press( verticalAlignmentButton );
|
|
240
240
|
|
|
241
241
|
// Get Align top button
|
|
242
|
-
const verticalTopAlignmentButton =
|
|
242
|
+
const verticalTopAlignmentButton = getByLabelText( /Align top/ );
|
|
243
243
|
fireEvent.press( verticalTopAlignmentButton );
|
|
244
244
|
|
|
245
245
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
@@ -249,20 +249,20 @@ describe( 'Columns block', () => {
|
|
|
249
249
|
const screen = await initializeEditor( {
|
|
250
250
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
251
251
|
} );
|
|
252
|
-
const {
|
|
252
|
+
const { getByLabelText } = screen;
|
|
253
253
|
|
|
254
254
|
// Get block
|
|
255
255
|
const columnsBlock = await getBlock( screen, 'Columns' );
|
|
256
256
|
fireEvent.press( columnsBlock );
|
|
257
257
|
|
|
258
258
|
// Open vertical alignment menu
|
|
259
|
-
const verticalAlignmentButton =
|
|
259
|
+
const verticalAlignmentButton = getByLabelText(
|
|
260
260
|
/Change vertical alignment/
|
|
261
261
|
);
|
|
262
262
|
fireEvent.press( verticalAlignmentButton );
|
|
263
263
|
|
|
264
264
|
// Get Align top button
|
|
265
|
-
const verticalTopAlignmentButton =
|
|
265
|
+
const verticalTopAlignmentButton = getByLabelText( /Align top/ );
|
|
266
266
|
fireEvent.press( verticalTopAlignmentButton );
|
|
267
267
|
|
|
268
268
|
// Get the first column
|
|
@@ -273,7 +273,7 @@ describe( 'Columns block', () => {
|
|
|
273
273
|
fireEvent.press( verticalAlignmentButton );
|
|
274
274
|
|
|
275
275
|
// Get Align bottom button
|
|
276
|
-
const verticalBottomAlignmentButton =
|
|
276
|
+
const verticalBottomAlignmentButton = getByLabelText( /Align bottom/ );
|
|
277
277
|
fireEvent.press( verticalBottomAlignmentButton );
|
|
278
278
|
|
|
279
279
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
@@ -283,20 +283,20 @@ describe( 'Columns block', () => {
|
|
|
283
283
|
const screen = await initializeEditor( {
|
|
284
284
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
285
285
|
} );
|
|
286
|
-
const {
|
|
286
|
+
const { getByLabelText } = screen;
|
|
287
287
|
|
|
288
288
|
// Get block
|
|
289
289
|
const columnsBlock = await getBlock( screen, 'Columns' );
|
|
290
290
|
fireEvent.press( columnsBlock );
|
|
291
291
|
|
|
292
292
|
// Open vertical alignment menu
|
|
293
|
-
const verticalAlignmentButton =
|
|
293
|
+
const verticalAlignmentButton = getByLabelText(
|
|
294
294
|
/Change vertical alignment/
|
|
295
295
|
);
|
|
296
296
|
fireEvent.press( verticalAlignmentButton );
|
|
297
297
|
|
|
298
298
|
// Get Align top button
|
|
299
|
-
const verticalTopAlignmentButton =
|
|
299
|
+
const verticalTopAlignmentButton = getByLabelText( /Align top/ );
|
|
300
300
|
fireEvent.press( verticalTopAlignmentButton );
|
|
301
301
|
|
|
302
302
|
// Add a new column
|
|
@@ -310,7 +310,7 @@ describe( 'Columns block', () => {
|
|
|
310
310
|
describe( 'when using columns percentage mechanism', () => {
|
|
311
311
|
it( "updates the slider's input value", async () => {
|
|
312
312
|
const screen = await initializeEditor();
|
|
313
|
-
const {
|
|
313
|
+
const { getByLabelText, getByTestId } = screen;
|
|
314
314
|
|
|
315
315
|
// Add block
|
|
316
316
|
await addBlock( screen, 'Columns' );
|
|
@@ -324,7 +324,7 @@ describe( 'Columns block', () => {
|
|
|
324
324
|
const blockVariationModal = getByTestId( 'block-variation-modal' );
|
|
325
325
|
await waitFor( () => blockVariationModal.props.isVisible );
|
|
326
326
|
const threeColumnLayout =
|
|
327
|
-
within( blockVariationModal ).
|
|
327
|
+
within( blockVariationModal ).getByLabelText(
|
|
328
328
|
/33 \/ 33 \/ 33 block/
|
|
329
329
|
);
|
|
330
330
|
fireEvent.press( threeColumnLayout );
|
|
@@ -337,7 +337,7 @@ describe( 'Columns block', () => {
|
|
|
337
337
|
await openBlockSettings( screen );
|
|
338
338
|
|
|
339
339
|
// Get width control
|
|
340
|
-
const widthControl =
|
|
340
|
+
const widthControl = getByLabelText( /Width. Value is/ );
|
|
341
341
|
fireEvent.press( within( widthControl ).getByText( '33.3' ) );
|
|
342
342
|
const widthTextInput =
|
|
343
343
|
within( widthControl ).getByDisplayValue( '33.3' );
|
|
@@ -350,7 +350,7 @@ describe( 'Columns block', () => {
|
|
|
350
350
|
const screen = await initializeEditor( {
|
|
351
351
|
initialHtml: TWO_COLUMNS_BLOCK_HTML,
|
|
352
352
|
} );
|
|
353
|
-
const {
|
|
353
|
+
const { getByLabelText, getByTestId } = screen;
|
|
354
354
|
|
|
355
355
|
// Get block
|
|
356
356
|
const columnsBlock = await getBlock( screen, 'Columns' );
|
|
@@ -364,7 +364,7 @@ describe( 'Columns block', () => {
|
|
|
364
364
|
await openBlockSettings( screen );
|
|
365
365
|
|
|
366
366
|
// Set custom width value for the first column
|
|
367
|
-
let widthControl =
|
|
367
|
+
let widthControl = getByLabelText( /Width. Value is/ );
|
|
368
368
|
fireEvent.press( within( widthControl ).getByText( '50' ) );
|
|
369
369
|
let widthTextInput =
|
|
370
370
|
within( widthControl ).getByDisplayValue( '50' );
|
|
@@ -383,7 +383,7 @@ describe( 'Columns block', () => {
|
|
|
383
383
|
await openBlockSettings( screen );
|
|
384
384
|
|
|
385
385
|
// Set custom width value for the second column
|
|
386
|
-
widthControl =
|
|
386
|
+
widthControl = getByLabelText( /Width. Value is/ );
|
|
387
387
|
fireEvent.press( within( widthControl ).getByText( '50' ) );
|
|
388
388
|
widthTextInput = within( widthControl ).getByDisplayValue( '50' );
|
|
389
389
|
fireEvent.changeText( widthTextInput, '55.5' );
|
|
@@ -422,7 +422,7 @@ describe( 'Columns block', () => {
|
|
|
422
422
|
);
|
|
423
423
|
await waitFor( () => blockVariationModal.props.isVisible );
|
|
424
424
|
const columnLayout =
|
|
425
|
-
within( blockVariationModal ).
|
|
425
|
+
within( blockVariationModal ).getByLabelText( layout );
|
|
426
426
|
fireEvent.press( columnLayout );
|
|
427
427
|
|
|
428
428
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
@@ -105,6 +105,14 @@ const transforms = {
|
|
|
105
105
|
},
|
|
106
106
|
},
|
|
107
107
|
],
|
|
108
|
+
to: [
|
|
109
|
+
{
|
|
110
|
+
type: 'block',
|
|
111
|
+
blocks: [ '*' ],
|
|
112
|
+
transform: ( attributes, innerBlocks ) =>
|
|
113
|
+
innerBlocks.flatMap( ( innerBlock ) => innerBlock.innerBlocks ),
|
|
114
|
+
},
|
|
115
|
+
],
|
|
108
116
|
};
|
|
109
117
|
|
|
110
118
|
export default transforms;
|
|
@@ -9,9 +9,13 @@
|
|
|
9
9
|
"textdomain": "default",
|
|
10
10
|
"usesContext": [ "postId" ],
|
|
11
11
|
"supports": {
|
|
12
|
-
"reusable": false,
|
|
13
|
-
"html": false,
|
|
14
12
|
"align": true,
|
|
13
|
+
"html": false,
|
|
14
|
+
"reusable": false,
|
|
15
|
+
"spacing": {
|
|
16
|
+
"margin": true,
|
|
17
|
+
"padding": true
|
|
18
|
+
},
|
|
15
19
|
"typography": {
|
|
16
20
|
"fontSize": true,
|
|
17
21
|
"lineHeight": true,
|
package/src/cover/edit/index.js
CHANGED
|
@@ -188,7 +188,9 @@ function CoverEdit( {
|
|
|
188
188
|
className: 'wp-block-cover__inner-container',
|
|
189
189
|
},
|
|
190
190
|
{
|
|
191
|
-
template
|
|
191
|
+
// Avoid template sync when the `templateLock` value is `all` or `contentOnly`.
|
|
192
|
+
// See: https://github.com/WordPress/gutenberg/pull/45632
|
|
193
|
+
template: ! hasInnerBlocks ? innerBlocksTemplate : undefined,
|
|
192
194
|
templateInsertUpdatesSelection: true,
|
|
193
195
|
allowedBlocks,
|
|
194
196
|
templateLock,
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Fragment, useMemo } from '@wordpress/element';
|
|
5
5
|
import {
|
|
6
|
-
BaseControl,
|
|
7
6
|
Button,
|
|
8
7
|
ExternalLink,
|
|
9
8
|
FocalPointPicker,
|
|
@@ -73,18 +72,17 @@ function CoverHeightInput( {
|
|
|
73
72
|
const min = isPx ? COVER_MIN_HEIGHT : 0;
|
|
74
73
|
|
|
75
74
|
return (
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
</BaseControl>
|
|
75
|
+
<UnitControl
|
|
76
|
+
label={ __( 'Minimum height of cover' ) }
|
|
77
|
+
id={ inputId }
|
|
78
|
+
isResetValueOnUnitChange
|
|
79
|
+
min={ min }
|
|
80
|
+
onChange={ handleOnChange }
|
|
81
|
+
onUnitChange={ onUnitChange }
|
|
82
|
+
__unstableInputWidth={ '80px' }
|
|
83
|
+
units={ units }
|
|
84
|
+
value={ computedValue }
|
|
85
|
+
/>
|
|
88
86
|
);
|
|
89
87
|
}
|
|
90
88
|
export default function CoverInspectorControls( {
|
|
@@ -307,7 +307,7 @@ describe( 'when an image is attached', () => {
|
|
|
307
307
|
const screen = await initializeEditor( {
|
|
308
308
|
initialHtml: COVER_BLOCK_IMAGE_HTML,
|
|
309
309
|
} );
|
|
310
|
-
const {
|
|
310
|
+
const { getByLabelText } = screen;
|
|
311
311
|
|
|
312
312
|
// Get block
|
|
313
313
|
const coverBlock = await getBlock( screen, 'Cover' );
|
|
@@ -317,7 +317,7 @@ describe( 'when an image is attached', () => {
|
|
|
317
317
|
await openBlockSettings( screen );
|
|
318
318
|
|
|
319
319
|
// Update Opacity attribute
|
|
320
|
-
const opacityControl =
|
|
320
|
+
const opacityControl = getByLabelText( /Opacity/ );
|
|
321
321
|
fireEvent.press( within( opacityControl ).getByText( '50' ) );
|
|
322
322
|
const heightTextInput =
|
|
323
323
|
within( opacityControl ).getByDisplayValue( '50' );
|
|
@@ -334,12 +334,12 @@ describe( 'when an image is attached', () => {
|
|
|
334
334
|
|
|
335
335
|
describe( 'color settings', () => {
|
|
336
336
|
it( 'sets a color for the overlay background when the placeholder is visible', async () => {
|
|
337
|
-
const { getByTestId,
|
|
337
|
+
const { getByTestId, getByLabelText } = await initializeEditor( {
|
|
338
338
|
initialHtml: COVER_BLOCK_PLACEHOLDER_HTML,
|
|
339
339
|
} );
|
|
340
340
|
|
|
341
341
|
const block = await waitFor( () =>
|
|
342
|
-
|
|
342
|
+
getByLabelText( 'Cover block. Empty' )
|
|
343
343
|
);
|
|
344
344
|
expect( block ).toBeDefined();
|
|
345
345
|
|
|
@@ -354,13 +354,13 @@ describe( 'color settings', () => {
|
|
|
354
354
|
|
|
355
355
|
// Wait for the block to be created.
|
|
356
356
|
const coverBlockWithOverlay = await waitFor( () =>
|
|
357
|
-
|
|
357
|
+
getByLabelText( /Cover Block\. Row 1/ )
|
|
358
358
|
);
|
|
359
359
|
fireEvent.press( coverBlockWithOverlay );
|
|
360
360
|
|
|
361
361
|
// Open Block Settings.
|
|
362
362
|
const settingsButton = await waitFor( () =>
|
|
363
|
-
|
|
363
|
+
getByLabelText( 'Open Settings' )
|
|
364
364
|
);
|
|
365
365
|
fireEvent.press( settingsButton );
|
|
366
366
|
|
|
@@ -370,7 +370,7 @@ describe( 'color settings', () => {
|
|
|
370
370
|
|
|
371
371
|
// Open the overlay color settings.
|
|
372
372
|
const colorOverlay = await waitFor( () =>
|
|
373
|
-
|
|
373
|
+
getByLabelText( 'Color. Empty' )
|
|
374
374
|
);
|
|
375
375
|
expect( colorOverlay ).toBeDefined();
|
|
376
376
|
fireEvent.press( colorOverlay );
|
|
@@ -389,20 +389,20 @@ describe( 'color settings', () => {
|
|
|
389
389
|
} );
|
|
390
390
|
|
|
391
391
|
it( 'sets a gradient overlay background when a solid background was already selected', async () => {
|
|
392
|
-
const { getByTestId,
|
|
392
|
+
const { getByTestId, getByLabelText } = await initializeEditor( {
|
|
393
393
|
initialHtml: COVER_BLOCK_SOLID_COLOR_HTML,
|
|
394
394
|
} );
|
|
395
395
|
|
|
396
396
|
// Wait for the block to be created.
|
|
397
397
|
const coverBlock = await waitFor( () =>
|
|
398
|
-
|
|
398
|
+
getByLabelText( /Cover Block\. Row 1/ )
|
|
399
399
|
);
|
|
400
400
|
expect( coverBlock ).toBeDefined();
|
|
401
401
|
fireEvent.press( coverBlock );
|
|
402
402
|
|
|
403
403
|
// Open Block Settings.
|
|
404
404
|
const settingsButton = await waitFor( () =>
|
|
405
|
-
|
|
405
|
+
getByLabelText( 'Open Settings' )
|
|
406
406
|
);
|
|
407
407
|
fireEvent.press( settingsButton );
|
|
408
408
|
|
|
@@ -412,7 +412,7 @@ describe( 'color settings', () => {
|
|
|
412
412
|
|
|
413
413
|
// Open the overlay color settings.
|
|
414
414
|
const colorOverlay = await waitFor( () =>
|
|
415
|
-
|
|
415
|
+
getByLabelText( 'Color. Empty' )
|
|
416
416
|
);
|
|
417
417
|
expect( colorOverlay ).toBeDefined();
|
|
418
418
|
fireEvent.press( colorOverlay );
|
|
@@ -423,7 +423,7 @@ describe( 'color settings', () => {
|
|
|
423
423
|
|
|
424
424
|
// Open the gradients.
|
|
425
425
|
const gradientsButton = await waitFor( () =>
|
|
426
|
-
|
|
426
|
+
getByLabelText( 'Gradient' )
|
|
427
427
|
);
|
|
428
428
|
expect( gradientsButton ).toBeDefined();
|
|
429
429
|
|
|
@@ -446,12 +446,12 @@ describe( 'color settings', () => {
|
|
|
446
446
|
} );
|
|
447
447
|
|
|
448
448
|
it( 'toggles between solid colors and gradients', async () => {
|
|
449
|
-
const { getByTestId,
|
|
449
|
+
const { getByTestId, getByLabelText } = await initializeEditor( {
|
|
450
450
|
initialHtml: COVER_BLOCK_PLACEHOLDER_HTML,
|
|
451
451
|
} );
|
|
452
452
|
|
|
453
453
|
const block = await waitFor( () =>
|
|
454
|
-
|
|
454
|
+
getByLabelText( 'Cover block. Empty' )
|
|
455
455
|
);
|
|
456
456
|
expect( block ).toBeDefined();
|
|
457
457
|
|
|
@@ -466,13 +466,13 @@ describe( 'color settings', () => {
|
|
|
466
466
|
|
|
467
467
|
// Wait for the block to be created.
|
|
468
468
|
const coverBlockWithOverlay = await waitFor( () =>
|
|
469
|
-
|
|
469
|
+
getByLabelText( /Cover Block\. Row 1/ )
|
|
470
470
|
);
|
|
471
471
|
fireEvent.press( coverBlockWithOverlay );
|
|
472
472
|
|
|
473
473
|
// Open Block Settings.
|
|
474
474
|
const settingsButton = await waitFor( () =>
|
|
475
|
-
|
|
475
|
+
getByLabelText( 'Open Settings' )
|
|
476
476
|
);
|
|
477
477
|
fireEvent.press( settingsButton );
|
|
478
478
|
|
|
@@ -482,7 +482,7 @@ describe( 'color settings', () => {
|
|
|
482
482
|
|
|
483
483
|
// Open the overlay color settings.
|
|
484
484
|
const colorOverlay = await waitFor( () =>
|
|
485
|
-
|
|
485
|
+
getByLabelText( 'Color. Empty' )
|
|
486
486
|
);
|
|
487
487
|
expect( colorOverlay ).toBeDefined();
|
|
488
488
|
fireEvent.press( colorOverlay );
|
|
@@ -499,7 +499,7 @@ describe( 'color settings', () => {
|
|
|
499
499
|
|
|
500
500
|
// Open the gradients.
|
|
501
501
|
const gradientsButton = await waitFor( () =>
|
|
502
|
-
|
|
502
|
+
getByLabelText( 'Gradient' )
|
|
503
503
|
);
|
|
504
504
|
expect( gradientsButton ).toBeDefined();
|
|
505
505
|
|
|
@@ -516,11 +516,11 @@ describe( 'color settings', () => {
|
|
|
516
516
|
fireEvent.press( newGradientButton );
|
|
517
517
|
|
|
518
518
|
// Go back to the settings list.
|
|
519
|
-
fireEvent.press( await waitFor( () =>
|
|
519
|
+
fireEvent.press( await waitFor( () => getByLabelText( 'Go back' ) ) );
|
|
520
520
|
|
|
521
521
|
// Find the color setting.
|
|
522
522
|
const colorSetting = await waitFor( () =>
|
|
523
|
-
|
|
523
|
+
getByLabelText( 'Color. Empty' )
|
|
524
524
|
);
|
|
525
525
|
expect( colorSetting ).toBeDefined();
|
|
526
526
|
fireEvent.press( colorSetting );
|
|
@@ -532,21 +532,21 @@ describe( 'color settings', () => {
|
|
|
532
532
|
} );
|
|
533
533
|
|
|
534
534
|
it( 'clears the selected overlay color and mantains the inner blocks', async () => {
|
|
535
|
-
const { getByTestId,
|
|
535
|
+
const { getByTestId, getByLabelText, getByText } =
|
|
536
536
|
await initializeEditor( {
|
|
537
537
|
initialHtml: COVER_BLOCK_SOLID_COLOR_HTML,
|
|
538
538
|
} );
|
|
539
539
|
|
|
540
540
|
// Wait for the block to be created.
|
|
541
541
|
const coverBlock = await waitFor( () =>
|
|
542
|
-
|
|
542
|
+
getByLabelText( /Cover Block\. Row 1/ )
|
|
543
543
|
);
|
|
544
544
|
expect( coverBlock ).toBeDefined();
|
|
545
545
|
fireEvent.press( coverBlock );
|
|
546
546
|
|
|
547
547
|
// Open Block Settings.
|
|
548
548
|
const settingsButton = await waitFor( () =>
|
|
549
|
-
|
|
549
|
+
getByLabelText( 'Open Settings' )
|
|
550
550
|
);
|
|
551
551
|
fireEvent.press( settingsButton );
|
|
552
552
|
|
|
@@ -556,7 +556,7 @@ describe( 'color settings', () => {
|
|
|
556
556
|
|
|
557
557
|
// Open the overlay color settings.
|
|
558
558
|
const colorOverlay = await waitFor( () =>
|
|
559
|
-
|
|
559
|
+
getByLabelText( 'Color. Empty' )
|
|
560
560
|
);
|
|
561
561
|
expect( colorOverlay ).toBeDefined();
|
|
562
562
|
fireEvent.press( colorOverlay );
|
|
@@ -635,7 +635,7 @@ describe( 'minimum height settings', () => {
|
|
|
635
635
|
const screen = await initializeEditor( {
|
|
636
636
|
initialHtml: COVER_BLOCK_CUSTOM_HEIGHT_HTML,
|
|
637
637
|
} );
|
|
638
|
-
const {
|
|
638
|
+
const { getByLabelText, getByText } = screen;
|
|
639
639
|
|
|
640
640
|
// Get block
|
|
641
641
|
const coverBlock = await getBlock( screen, 'Cover' );
|
|
@@ -649,7 +649,7 @@ describe( 'minimum height settings', () => {
|
|
|
649
649
|
fireEvent.press( getByText( unitName ) );
|
|
650
650
|
|
|
651
651
|
// Update height attribute
|
|
652
|
-
const heightControl =
|
|
652
|
+
const heightControl = getByLabelText( /Minimum height/ );
|
|
653
653
|
fireEvent.press( within( heightControl ).getByText( value ) );
|
|
654
654
|
const heightTextInput =
|
|
655
655
|
within( heightControl ).getByDisplayValue( value );
|
package/src/embed/deprecated.js
CHANGED
|
@@ -11,36 +11,63 @@ import metadata from './block.json';
|
|
|
11
11
|
/**
|
|
12
12
|
* WordPress dependencies
|
|
13
13
|
*/
|
|
14
|
-
import { RichText } from '@wordpress/block-editor';
|
|
14
|
+
import { RichText, useBlockProps } from '@wordpress/block-editor';
|
|
15
15
|
|
|
16
16
|
const { attributes: blockAttributes } = metadata;
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
18
|
+
// In #41140 support was added to global styles for caption elements which added a `wp-element-caption` classname
|
|
19
|
+
// to the embed figcaption element.
|
|
20
|
+
const v2 = {
|
|
21
|
+
attributes: blockAttributes,
|
|
22
|
+
save( { attributes } ) {
|
|
23
|
+
const { url, caption, type, providerNameSlug } = attributes;
|
|
24
|
+
|
|
25
|
+
if ( ! url ) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const className = classnames( 'wp-block-embed', {
|
|
30
|
+
[ `is-type-${ type }` ]: type,
|
|
31
|
+
[ `is-provider-${ providerNameSlug }` ]: providerNameSlug,
|
|
32
|
+
[ `wp-block-embed-${ providerNameSlug }` ]: providerNameSlug,
|
|
33
|
+
} );
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<figure { ...useBlockProps.save( { className } ) }>
|
|
37
|
+
<div className="wp-block-embed__wrapper">
|
|
33
38
|
{ `\n${ url }\n` /* URL needs to be on its own line. */ }
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
</div>
|
|
40
|
+
{ ! RichText.isEmpty( caption ) && (
|
|
41
|
+
<RichText.Content tagName="figcaption" value={ caption } />
|
|
42
|
+
) }
|
|
43
|
+
</figure>
|
|
44
|
+
);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const v1 = {
|
|
49
|
+
attributes: blockAttributes,
|
|
50
|
+
save( { attributes: { url, caption, type, providerNameSlug } } ) {
|
|
51
|
+
if ( ! url ) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const embedClassName = classnames( 'wp-block-embed', {
|
|
56
|
+
[ `is-type-${ type }` ]: type,
|
|
57
|
+
[ `is-provider-${ providerNameSlug }` ]: providerNameSlug,
|
|
58
|
+
} );
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<figure className={ embedClassName }>
|
|
62
|
+
{ `\n${ url }\n` /* URL needs to be on its own line. */ }
|
|
63
|
+
{ ! RichText.isEmpty( caption ) && (
|
|
64
|
+
<RichText.Content tagName="figcaption" value={ caption } />
|
|
65
|
+
) }
|
|
66
|
+
</figure>
|
|
67
|
+
);
|
|
43
68
|
},
|
|
44
|
-
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const deprecated = [ v2, v1 ];
|
|
45
72
|
|
|
46
73
|
export default deprecated;
|