@wordpress/block-library 7.18.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 +2 -0
- package/build/button/deprecated.js +16 -2
- package/build/button/deprecated.js.map +1 -1
- package/build/button/edit.js +13 -7
- 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/columns/transforms.js +5 -0
- package/build/columns/transforms.js.map +1 -1
- package/build/cover/edit/index.js +3 -1
- package/build/cover/edit/index.js.map +1 -1
- package/build/gallery/v1/edit.js +4 -2
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/group/edit.js +98 -45
- 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/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/index.js +13 -0
- package/build/latest-posts/index.js.map +1 -1
- package/build/list-item/edit.js +2 -1
- package/build/list-item/edit.js.map +1 -1
- package/build/navigation/edit/index.js +82 -92
- 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 -19
- package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build/navigation-link/edit.js +10 -1
- package/build/navigation-link/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-content/index.js +3 -0
- package/build/post-content/index.js.map +1 -1
- package/build/site-logo/edit.js +1 -1
- package/build/site-logo/edit.js.map +1 -1
- package/build/template-part/variations.js +5 -0
- package/build/template-part/variations.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 +15 -9
- 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/columns/transforms.js +5 -0
- package/build-module/columns/transforms.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/gallery/v1/edit.js +5 -3
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/group/edit.js +94 -45
- 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/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/index.js +13 -0
- package/build-module/latest-posts/index.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/navigation/edit/index.js +84 -94
- 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 -20
- package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
- package/build-module/navigation-link/edit.js +10 -1
- package/build-module/navigation-link/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-content/index.js +3 -0
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/site-logo/edit.js +1 -1
- package/build-module/site-logo/edit.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-style/editor-rtl.css +76 -1
- package/build-style/editor.css +76 -1
- 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 +23 -0
- package/build-style/navigation/editor.css +23 -0
- package/build-style/navigation/style-rtl.css +10 -0
- package/build-style/navigation/style.css +10 -0
- package/build-style/navigation-link/editor-rtl.css +8 -1
- package/build-style/navigation-link/editor.css +8 -1
- 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 +20 -1
- package/build-style/style.css +20 -1
- 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 +28 -28
- 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 +11 -9
- package/src/button/save.js +12 -2
- 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/cover/edit/index.js +3 -1
- package/src/cover/test/edit.native.js +26 -26
- package/src/embed/test/index.native.js +43 -43
- package/src/gallery/test/index.native.js +11 -11
- package/src/gallery/v1/edit.js +19 -24
- package/src/group/block.json +3 -0
- package/src/group/edit.js +95 -44
- 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/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/style.scss +3 -0
- package/src/list/test/edit.native.js +36 -36
- package/src/list-item/edit.js +1 -0
- package/src/missing/test/edit-integration.native.js +5 -5
- package/src/navigation/edit/index.js +173 -146
- 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 -29
- package/src/navigation/editor.scss +25 -0
- package/src/navigation/style.scss +16 -0
- package/src/navigation-link/edit.js +8 -0
- package/src/navigation-link/editor.scss +8 -0
- package/src/post-author/edit.js +44 -20
- package/src/post-content/block.json +3 -0
- 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/shortcode/test/edit.native.js +5 -5
- package/src/site-logo/edit.js +1 -1
- package/src/social-link/test/index.native.js +10 -10
- package/src/social-links/test/edit.native.js +4 -4
- package/src/spacer/test/index.native.js +17 -17
- package/src/table/editor.scss +1 -0
- 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/post-author/edit.js
CHANGED
|
@@ -13,11 +13,23 @@ import {
|
|
|
13
13
|
RichText,
|
|
14
14
|
useBlockProps,
|
|
15
15
|
} from '@wordpress/block-editor';
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
ComboboxControl,
|
|
18
|
+
PanelBody,
|
|
19
|
+
SelectControl,
|
|
20
|
+
ToggleControl,
|
|
21
|
+
} from '@wordpress/components';
|
|
17
22
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
18
23
|
import { __ } from '@wordpress/i18n';
|
|
19
24
|
import { store as coreStore } from '@wordpress/core-data';
|
|
20
25
|
|
|
26
|
+
const minimumUsersForCombobox = 25;
|
|
27
|
+
|
|
28
|
+
const AUTHORS_QUERY = {
|
|
29
|
+
who: 'authors',
|
|
30
|
+
per_page: 100,
|
|
31
|
+
};
|
|
32
|
+
|
|
21
33
|
function PostAuthorEdit( {
|
|
22
34
|
isSelected,
|
|
23
35
|
context: { postType, postId, queryId },
|
|
@@ -38,7 +50,7 @@ function PostAuthorEdit( {
|
|
|
38
50
|
return {
|
|
39
51
|
authorId: _authorId,
|
|
40
52
|
authorDetails: _authorId ? getUser( _authorId ) : null,
|
|
41
|
-
authors: getUsers(
|
|
53
|
+
authors: getUsers( AUTHORS_QUERY ),
|
|
42
54
|
};
|
|
43
55
|
},
|
|
44
56
|
[ postType, postId ]
|
|
@@ -65,34 +77,46 @@ function PostAuthorEdit( {
|
|
|
65
77
|
} ),
|
|
66
78
|
} );
|
|
67
79
|
|
|
80
|
+
const authorOptions = authors?.length
|
|
81
|
+
? authors.map( ( { id, name } ) => {
|
|
82
|
+
return {
|
|
83
|
+
value: id,
|
|
84
|
+
label: name,
|
|
85
|
+
};
|
|
86
|
+
} )
|
|
87
|
+
: [];
|
|
88
|
+
|
|
89
|
+
const handleSelect = ( nextAuthorId ) => {
|
|
90
|
+
editEntityRecord( 'postType', postType, postId, {
|
|
91
|
+
author: nextAuthorId,
|
|
92
|
+
} );
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const showCombobox = authorOptions.length >= minimumUsersForCombobox;
|
|
96
|
+
|
|
68
97
|
return (
|
|
69
98
|
<>
|
|
70
99
|
<InspectorControls>
|
|
71
100
|
<PanelBody title={ __( 'Settings' ) }>
|
|
72
101
|
{ !! postId &&
|
|
73
102
|
! isDescendentOfQueryLoop &&
|
|
74
|
-
|
|
103
|
+
authorOptions.length &&
|
|
104
|
+
( ( showCombobox && (
|
|
105
|
+
<ComboboxControl
|
|
106
|
+
label={ __( 'Author' ) }
|
|
107
|
+
options={ authorOptions }
|
|
108
|
+
value={ authorId }
|
|
109
|
+
onChange={ handleSelect }
|
|
110
|
+
allowReset={ false }
|
|
111
|
+
/>
|
|
112
|
+
) ) || (
|
|
75
113
|
<SelectControl
|
|
76
114
|
label={ __( 'Author' ) }
|
|
77
115
|
value={ authorId }
|
|
78
|
-
options={
|
|
79
|
-
|
|
80
|
-
value: id,
|
|
81
|
-
label: name,
|
|
82
|
-
};
|
|
83
|
-
} ) }
|
|
84
|
-
onChange={ ( nextAuthorId ) => {
|
|
85
|
-
editEntityRecord(
|
|
86
|
-
'postType',
|
|
87
|
-
postType,
|
|
88
|
-
postId,
|
|
89
|
-
{
|
|
90
|
-
author: nextAuthorId,
|
|
91
|
-
}
|
|
92
|
-
);
|
|
93
|
-
} }
|
|
116
|
+
options={ authorOptions }
|
|
117
|
+
onChange={ handleSelect }
|
|
94
118
|
/>
|
|
95
|
-
) }
|
|
119
|
+
) ) }
|
|
96
120
|
<ToggleControl
|
|
97
121
|
label={ __( 'Show avatar' ) }
|
|
98
122
|
checked={ showAvatar }
|
package/src/query/editor.scss
CHANGED
|
@@ -18,7 +18,7 @@ $pagination-margin: 0.5em;
|
|
|
18
18
|
// which is important when it's the only block displayed
|
|
19
19
|
// and the block has a "space-between" justification.
|
|
20
20
|
&.is-content-justification-space-between {
|
|
21
|
-
> .wp-block-query-pagination-next:last-
|
|
21
|
+
> .wp-block-query-pagination-next:last-of-type {
|
|
22
22
|
margin-inline-start: auto;
|
|
23
23
|
}
|
|
24
24
|
> .wp-block-query-pagination-previous:first-child {
|
package/src/read-more/index.php
CHANGED
|
@@ -19,15 +19,22 @@ function render_block_core_read_more( $attributes, $content, $block ) {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
$post_ID = $block->context['postId'];
|
|
22
|
+
$post_title = get_the_title( $post_ID );
|
|
23
|
+
$screen_reader_text = sprintf(
|
|
24
|
+
/* translators: %s is either the post title or post ID to describe the link for screen readers. */
|
|
25
|
+
__( ': %s' ),
|
|
26
|
+
'' !== $post_title ? $post_title : __( 'untitled post ' ) . $post_ID
|
|
27
|
+
);
|
|
22
28
|
$justify_class_name = empty( $attributes['justifyContent'] ) ? '' : "is-justified-{$attributes['justifyContent']}";
|
|
23
29
|
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $justify_class_name ) );
|
|
24
30
|
$more_text = ! empty( $attributes['content'] ) ? wp_kses_post( $attributes['content'] ) : __( 'Read more' );
|
|
25
31
|
return sprintf(
|
|
26
|
-
'<a %1s href="%2s" target="%3s">%4s</a>',
|
|
32
|
+
'<a %1s href="%2s" target="%3s">%4s<span class="screen-reader-text">%5s</span></a>',
|
|
27
33
|
$wrapper_attributes,
|
|
28
34
|
get_the_permalink( $post_ID ),
|
|
29
35
|
esc_attr( $attributes['linkTarget'] ),
|
|
30
|
-
$more_text
|
|
36
|
+
$more_text,
|
|
37
|
+
$screen_reader_text
|
|
31
38
|
);
|
|
32
39
|
}
|
|
33
40
|
|
|
@@ -28,10 +28,10 @@ afterAll( () => {
|
|
|
28
28
|
|
|
29
29
|
describe( 'Shortcode block', () => {
|
|
30
30
|
it( 'inserts block', async () => {
|
|
31
|
-
const {
|
|
31
|
+
const { getByLabelText, getByTestId, getByText } =
|
|
32
32
|
await initializeEditor();
|
|
33
33
|
|
|
34
|
-
fireEvent.press(
|
|
34
|
+
fireEvent.press( getByLabelText( 'Add block' ) );
|
|
35
35
|
|
|
36
36
|
const blockList = getByTestId( 'InserterUI-Blocks' );
|
|
37
37
|
// onScroll event used to force the FlatList to render all items
|
|
@@ -45,17 +45,17 @@ describe( 'Shortcode block', () => {
|
|
|
45
45
|
|
|
46
46
|
fireEvent.press( await waitFor( () => getByText( 'Shortcode' ) ) );
|
|
47
47
|
|
|
48
|
-
expect(
|
|
48
|
+
expect( getByLabelText( /Shortcode Block\. Row 1/ ) ).toBeVisible();
|
|
49
49
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
50
50
|
} );
|
|
51
51
|
|
|
52
52
|
it( 'edits content', async () => {
|
|
53
|
-
const {
|
|
53
|
+
const { getByLabelText, getByPlaceholderText } = await initializeEditor(
|
|
54
54
|
{
|
|
55
55
|
initialHtml: '<!-- wp:shortcode /-->',
|
|
56
56
|
}
|
|
57
57
|
);
|
|
58
|
-
const shortcodeBlock =
|
|
58
|
+
const shortcodeBlock = getByLabelText( /Shortcode Block\. Row 1/ );
|
|
59
59
|
fireEvent.press( shortcodeBlock );
|
|
60
60
|
|
|
61
61
|
const textField = getByPlaceholderText( 'Add a shortcode…' );
|
package/src/site-logo/edit.js
CHANGED
|
@@ -394,7 +394,7 @@ export default function LogoEdit( {
|
|
|
394
394
|
return {
|
|
395
395
|
siteLogoId: _siteLogoId,
|
|
396
396
|
canUserEdit: _canUserEdit,
|
|
397
|
-
url: siteData?.
|
|
397
|
+
url: siteData?.home,
|
|
398
398
|
mediaItemData: mediaItem,
|
|
399
399
|
isRequestingMediaItem: _isRequestingMediaItem,
|
|
400
400
|
siteIconId: _siteIconId,
|
|
@@ -33,7 +33,7 @@ describe( '<SocialLinkEdit/>', () => {
|
|
|
33
33
|
|
|
34
34
|
// Act
|
|
35
35
|
fireEvent.press(
|
|
36
|
-
await waitFor( () => subject.
|
|
36
|
+
await waitFor( () => subject.getByLabelText( 'Add block' ) )
|
|
37
37
|
);
|
|
38
38
|
fireEvent.changeText(
|
|
39
39
|
await waitFor( () =>
|
|
@@ -43,13 +43,13 @@ describe( '<SocialLinkEdit/>', () => {
|
|
|
43
43
|
);
|
|
44
44
|
fireEvent.press(
|
|
45
45
|
await waitFor( () =>
|
|
46
|
-
subject.
|
|
46
|
+
subject.getByLabelText( 'Social Icons block' )
|
|
47
47
|
)
|
|
48
48
|
);
|
|
49
49
|
fireEvent(
|
|
50
50
|
await waitFor( () =>
|
|
51
51
|
within(
|
|
52
|
-
subject.
|
|
52
|
+
subject.getByLabelText( /Social Icons Block. Row 1/ )
|
|
53
53
|
).getByTestId( 'block-list-wrapper' )
|
|
54
54
|
),
|
|
55
55
|
'layout',
|
|
@@ -59,22 +59,22 @@ describe( '<SocialLinkEdit/>', () => {
|
|
|
59
59
|
// Assert
|
|
60
60
|
expect(
|
|
61
61
|
await waitFor( () =>
|
|
62
|
-
subject.
|
|
62
|
+
subject.getByLabelText( /WordPress social icon/ )
|
|
63
63
|
)
|
|
64
64
|
).toBeDefined();
|
|
65
65
|
expect(
|
|
66
66
|
await waitFor( () =>
|
|
67
|
-
subject.
|
|
67
|
+
subject.getByLabelText( /Facebook social icon/ )
|
|
68
68
|
)
|
|
69
69
|
).toBeDefined();
|
|
70
70
|
expect(
|
|
71
71
|
await waitFor( () =>
|
|
72
|
-
subject.
|
|
72
|
+
subject.getByLabelText( /Twitter social icon/ )
|
|
73
73
|
)
|
|
74
74
|
).toBeDefined();
|
|
75
75
|
expect(
|
|
76
76
|
await waitFor( () =>
|
|
77
|
-
subject.
|
|
77
|
+
subject.getByLabelText( /Instagram social icon/ )
|
|
78
78
|
)
|
|
79
79
|
).toBeDefined();
|
|
80
80
|
} );
|
|
@@ -90,7 +90,7 @@ describe( '<SocialLinkEdit/>', () => {
|
|
|
90
90
|
|
|
91
91
|
// Act
|
|
92
92
|
fireEvent.press(
|
|
93
|
-
await waitFor( () => subject.
|
|
93
|
+
await waitFor( () => subject.getByLabelText( 'Add block' ) )
|
|
94
94
|
);
|
|
95
95
|
fireEvent.changeText(
|
|
96
96
|
await waitFor( () =>
|
|
@@ -100,13 +100,13 @@ describe( '<SocialLinkEdit/>', () => {
|
|
|
100
100
|
);
|
|
101
101
|
fireEvent.press(
|
|
102
102
|
await waitFor( () =>
|
|
103
|
-
subject.
|
|
103
|
+
subject.getByLabelText( 'Social Icons block' )
|
|
104
104
|
)
|
|
105
105
|
);
|
|
106
106
|
fireEvent(
|
|
107
107
|
await waitFor( () =>
|
|
108
108
|
within(
|
|
109
|
-
subject.
|
|
109
|
+
subject.getByLabelText( /Social Icons Block. Row 1/ )
|
|
110
110
|
).getByTestId( 'block-list-wrapper' )
|
|
111
111
|
),
|
|
112
112
|
'layout',
|
|
@@ -88,7 +88,7 @@ describe( 'Social links block', () => {
|
|
|
88
88
|
|
|
89
89
|
// Check there's only one active social link
|
|
90
90
|
const socialLinks =
|
|
91
|
-
within( socialLinksBlock ).
|
|
91
|
+
within( socialLinksBlock ).getAllByLabelText( / social icon/ );
|
|
92
92
|
expect( socialLinks.length ).toBe( 1 );
|
|
93
93
|
|
|
94
94
|
// Check the WordPress link is shown when unselected
|
|
@@ -153,7 +153,7 @@ describe( 'Social links block', () => {
|
|
|
153
153
|
|
|
154
154
|
it( 'shows the ghost placeholder when no icon is active', async () => {
|
|
155
155
|
const screen = await initializeEditor();
|
|
156
|
-
const {
|
|
156
|
+
const { getByLabelText } = screen;
|
|
157
157
|
|
|
158
158
|
// Add block
|
|
159
159
|
await addBlock( screen, 'Social Icons' );
|
|
@@ -178,11 +178,11 @@ describe( 'Social links block', () => {
|
|
|
178
178
|
fireEvent.press( firstLinkBlock );
|
|
179
179
|
|
|
180
180
|
// Open block actions menu
|
|
181
|
-
const blockActionsButton =
|
|
181
|
+
const blockActionsButton = getByLabelText( /Open Block Actions Menu/ );
|
|
182
182
|
fireEvent.press( blockActionsButton );
|
|
183
183
|
|
|
184
184
|
// Delete the social link
|
|
185
|
-
const deleteButton =
|
|
185
|
+
const deleteButton = getByLabelText( /Remove block/ );
|
|
186
186
|
fireEvent.press( deleteButton );
|
|
187
187
|
|
|
188
188
|
// Add Paragraph block
|
|
@@ -28,10 +28,10 @@ afterAll( () => {
|
|
|
28
28
|
|
|
29
29
|
describe( 'Spacer block', () => {
|
|
30
30
|
it( 'inserts block', async () => {
|
|
31
|
-
const {
|
|
31
|
+
const { getByLabelText, getByTestId, getByText } =
|
|
32
32
|
await initializeEditor();
|
|
33
33
|
|
|
34
|
-
fireEvent.press(
|
|
34
|
+
fireEvent.press( getByLabelText( 'Add block' ) );
|
|
35
35
|
|
|
36
36
|
const blockList = getByTestId( 'InserterUI-Blocks' );
|
|
37
37
|
// onScroll event used to force the FlatList to render all items
|
|
@@ -45,7 +45,7 @@ describe( 'Spacer block', () => {
|
|
|
45
45
|
|
|
46
46
|
fireEvent.press( await waitFor( () => getByText( 'Spacer' ) ) );
|
|
47
47
|
|
|
48
|
-
expect(
|
|
48
|
+
expect( getByLabelText( /Spacer Block\. Row 1/ ) ).toBeVisible();
|
|
49
49
|
expect( getEditorHtml() ).toMatchSnapshot();
|
|
50
50
|
} );
|
|
51
51
|
|
|
@@ -53,17 +53,17 @@ describe( 'Spacer block', () => {
|
|
|
53
53
|
const initialHtml = `<!-- wp:spacer -->
|
|
54
54
|
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
55
55
|
<!-- /wp:spacer -->`;
|
|
56
|
-
const {
|
|
56
|
+
const { getByLabelText, getByDisplayValue, getByTestId, getByText } =
|
|
57
57
|
await initializeEditor( {
|
|
58
58
|
initialHtml,
|
|
59
59
|
} );
|
|
60
60
|
|
|
61
61
|
// Select Spacer block
|
|
62
|
-
const spacerBlock =
|
|
62
|
+
const spacerBlock = getByLabelText( /Spacer Block\. Row 1/ );
|
|
63
63
|
fireEvent.press( spacerBlock );
|
|
64
64
|
|
|
65
65
|
// Open block settings
|
|
66
|
-
fireEvent.press(
|
|
66
|
+
fireEvent.press( getByLabelText( 'Open Settings' ) );
|
|
67
67
|
await waitFor(
|
|
68
68
|
() => getByTestId( 'block-settings-modal' ).props.isVisible
|
|
69
69
|
);
|
|
@@ -80,17 +80,17 @@ describe( 'Spacer block', () => {
|
|
|
80
80
|
const initialHtml = `<!-- wp:spacer -->
|
|
81
81
|
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
82
82
|
<!-- /wp:spacer -->`;
|
|
83
|
-
const {
|
|
83
|
+
const { getByLabelText, getByDisplayValue, getByTestId, getByText } =
|
|
84
84
|
await initializeEditor( {
|
|
85
85
|
initialHtml,
|
|
86
86
|
} );
|
|
87
87
|
|
|
88
88
|
// Select Spacer block
|
|
89
|
-
const spacerBlock =
|
|
89
|
+
const spacerBlock = getByLabelText( /Spacer Block\. Row 1/ );
|
|
90
90
|
fireEvent.press( spacerBlock );
|
|
91
91
|
|
|
92
92
|
// Open block settings
|
|
93
|
-
fireEvent.press(
|
|
93
|
+
fireEvent.press( getByLabelText( 'Open Settings' ) );
|
|
94
94
|
await waitFor(
|
|
95
95
|
() => getByTestId( 'block-settings-modal' ).props.isVisible
|
|
96
96
|
);
|
|
@@ -111,23 +111,23 @@ describe( 'Spacer block', () => {
|
|
|
111
111
|
const initialHtml = `<!-- wp:spacer -->
|
|
112
112
|
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
113
113
|
<!-- /wp:spacer -->`;
|
|
114
|
-
const {
|
|
114
|
+
const { getByLabelText, getByTestId } = await initializeEditor( {
|
|
115
115
|
initialHtml,
|
|
116
116
|
} );
|
|
117
117
|
|
|
118
118
|
// Select Spacer block
|
|
119
|
-
const spacerBlock =
|
|
119
|
+
const spacerBlock = getByLabelText( /Spacer Block\. Row 1/ );
|
|
120
120
|
fireEvent.press( spacerBlock );
|
|
121
121
|
|
|
122
122
|
// Open block settings
|
|
123
|
-
fireEvent.press(
|
|
123
|
+
fireEvent.press( getByLabelText( 'Open Settings' ) );
|
|
124
124
|
await waitFor(
|
|
125
125
|
() => getByTestId( 'block-settings-modal' ).props.isVisible
|
|
126
126
|
);
|
|
127
127
|
|
|
128
128
|
// Increment height
|
|
129
129
|
fireEvent(
|
|
130
|
-
|
|
130
|
+
getByLabelText( /Height\. Value is 100 Pixels \(px\)/ ),
|
|
131
131
|
'accessibilityAction',
|
|
132
132
|
{
|
|
133
133
|
nativeEvent: { actionName: 'increment' },
|
|
@@ -141,23 +141,23 @@ describe( 'Spacer block', () => {
|
|
|
141
141
|
const initialHtml = `<!-- wp:spacer -->
|
|
142
142
|
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
143
143
|
<!-- /wp:spacer -->`;
|
|
144
|
-
const {
|
|
144
|
+
const { getByLabelText, getByTestId } = await initializeEditor( {
|
|
145
145
|
initialHtml,
|
|
146
146
|
} );
|
|
147
147
|
|
|
148
148
|
// Select Spacer block
|
|
149
|
-
const spacerBlock =
|
|
149
|
+
const spacerBlock = getByLabelText( /Spacer Block\. Row 1/ );
|
|
150
150
|
fireEvent.press( spacerBlock );
|
|
151
151
|
|
|
152
152
|
// Open block settings
|
|
153
|
-
fireEvent.press(
|
|
153
|
+
fireEvent.press( getByLabelText( 'Open Settings' ) );
|
|
154
154
|
await waitFor(
|
|
155
155
|
() => getByTestId( 'block-settings-modal' ).props.isVisible
|
|
156
156
|
);
|
|
157
157
|
|
|
158
158
|
// Increment height
|
|
159
159
|
fireEvent(
|
|
160
|
-
|
|
160
|
+
getByLabelText( /Height\. Value is 100 Pixels \(px\)/ ),
|
|
161
161
|
'accessibilityAction',
|
|
162
162
|
{
|
|
163
163
|
nativeEvent: { actionName: 'decrement' },
|
package/src/table/editor.scss
CHANGED
package/src/table/style.scss
CHANGED
package/src/table/theme.scss
CHANGED
|
@@ -193,6 +193,11 @@ function build_template_part_block_instance_variations() {
|
|
|
193
193
|
if ( wp_installing() ) {
|
|
194
194
|
return array();
|
|
195
195
|
}
|
|
196
|
+
|
|
197
|
+
if ( ! current_theme_supports( 'block-templates' ) && ! current_theme_supports( 'block-template-parts' ) ) {
|
|
198
|
+
return array();
|
|
199
|
+
}
|
|
200
|
+
|
|
196
201
|
$variations = array();
|
|
197
202
|
$template_parts = get_block_templates(
|
|
198
203
|
array(
|
|
@@ -40,6 +40,10 @@ export function enhanceTemplatePartVariations( settings, name ) {
|
|
|
40
40
|
'wp_template_part',
|
|
41
41
|
`${ theme }//${ slug }`
|
|
42
42
|
);
|
|
43
|
+
|
|
44
|
+
if ( entity?.slug ) {
|
|
45
|
+
return entity.slug === variationAttributes.slug;
|
|
46
|
+
}
|
|
43
47
|
return entity?.area === variationAttributes.area;
|
|
44
48
|
};
|
|
45
49
|
|