@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.
Files changed (188) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/button/deprecated.js +16 -2
  3. package/build/button/deprecated.js.map +1 -1
  4. package/build/button/edit.js +13 -7
  5. package/build/button/edit.js.map +1 -1
  6. package/build/button/index.js +4 -1
  7. package/build/button/index.js.map +1 -1
  8. package/build/button/save.js +2 -0
  9. package/build/button/save.js.map +1 -1
  10. package/build/columns/transforms.js +5 -0
  11. package/build/columns/transforms.js.map +1 -1
  12. package/build/cover/edit/index.js +3 -1
  13. package/build/cover/edit/index.js.map +1 -1
  14. package/build/gallery/v1/edit.js +4 -2
  15. package/build/gallery/v1/edit.js.map +1 -1
  16. package/build/group/edit.js +98 -45
  17. package/build/group/edit.js.map +1 -1
  18. package/build/group/index.js +3 -0
  19. package/build/group/index.js.map +1 -1
  20. package/build/group/placeholder.js +168 -0
  21. package/build/group/placeholder.js.map +1 -0
  22. package/build/group/variations.js +3 -3
  23. package/build/group/variations.js.map +1 -1
  24. package/build/latest-comments/edit.js +2 -1
  25. package/build/latest-comments/edit.js.map +1 -1
  26. package/build/latest-comments/index.js +5 -1
  27. package/build/latest-comments/index.js.map +1 -1
  28. package/build/latest-posts/deprecated.js +13 -0
  29. package/build/latest-posts/deprecated.js.map +1 -1
  30. package/build/latest-posts/index.js +13 -0
  31. package/build/latest-posts/index.js.map +1 -1
  32. package/build/list-item/edit.js +2 -1
  33. package/build/list-item/edit.js.map +1 -1
  34. package/build/navigation/edit/index.js +82 -92
  35. package/build/navigation/edit/index.js.map +1 -1
  36. package/build/navigation/edit/manage-menus-button.js +36 -0
  37. package/build/navigation/edit/manage-menus-button.js.map +1 -0
  38. package/build/navigation/edit/navigation-menu-selector.js +12 -5
  39. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  40. package/build/navigation/edit/responsive-wrapper.js +2 -6
  41. package/build/navigation/edit/responsive-wrapper.js.map +1 -1
  42. package/build/navigation/edit/unsaved-inner-blocks.js +5 -19
  43. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  44. package/build/navigation-link/edit.js +10 -1
  45. package/build/navigation-link/edit.js.map +1 -1
  46. package/build/post-author/edit.js +35 -20
  47. package/build/post-author/edit.js.map +1 -1
  48. package/build/post-content/index.js +3 -0
  49. package/build/post-content/index.js.map +1 -1
  50. package/build/site-logo/edit.js +1 -1
  51. package/build/site-logo/edit.js.map +1 -1
  52. package/build/template-part/variations.js +5 -0
  53. package/build/template-part/variations.js.map +1 -1
  54. package/build-module/button/deprecated.js +16 -2
  55. package/build-module/button/deprecated.js.map +1 -1
  56. package/build-module/button/edit.js +15 -9
  57. package/build-module/button/edit.js.map +1 -1
  58. package/build-module/button/index.js +4 -1
  59. package/build-module/button/index.js.map +1 -1
  60. package/build-module/button/save.js +2 -0
  61. package/build-module/button/save.js.map +1 -1
  62. package/build-module/columns/transforms.js +5 -0
  63. package/build-module/columns/transforms.js.map +1 -1
  64. package/build-module/cover/edit/index.js +3 -1
  65. package/build-module/cover/edit/index.js.map +1 -1
  66. package/build-module/gallery/v1/edit.js +5 -3
  67. package/build-module/gallery/v1/edit.js.map +1 -1
  68. package/build-module/group/edit.js +94 -45
  69. package/build-module/group/edit.js.map +1 -1
  70. package/build-module/group/index.js +3 -0
  71. package/build-module/group/index.js.map +1 -1
  72. package/build-module/group/placeholder.js +154 -0
  73. package/build-module/group/placeholder.js.map +1 -0
  74. package/build-module/group/variations.js +3 -3
  75. package/build-module/group/variations.js.map +1 -1
  76. package/build-module/latest-comments/edit.js +2 -1
  77. package/build-module/latest-comments/edit.js.map +1 -1
  78. package/build-module/latest-comments/index.js +5 -1
  79. package/build-module/latest-comments/index.js.map +1 -1
  80. package/build-module/latest-posts/deprecated.js +13 -0
  81. package/build-module/latest-posts/deprecated.js.map +1 -1
  82. package/build-module/latest-posts/index.js +13 -0
  83. package/build-module/latest-posts/index.js.map +1 -1
  84. package/build-module/list-item/edit.js +2 -1
  85. package/build-module/list-item/edit.js.map +1 -1
  86. package/build-module/navigation/edit/index.js +84 -94
  87. package/build-module/navigation/edit/index.js.map +1 -1
  88. package/build-module/navigation/edit/manage-menus-button.js +26 -0
  89. package/build-module/navigation/edit/manage-menus-button.js.map +1 -0
  90. package/build-module/navigation/edit/navigation-menu-selector.js +13 -6
  91. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  92. package/build-module/navigation/edit/responsive-wrapper.js +2 -6
  93. package/build-module/navigation/edit/responsive-wrapper.js.map +1 -1
  94. package/build-module/navigation/edit/unsaved-inner-blocks.js +7 -20
  95. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  96. package/build-module/navigation-link/edit.js +10 -1
  97. package/build-module/navigation-link/edit.js.map +1 -1
  98. package/build-module/post-author/edit.js +35 -21
  99. package/build-module/post-author/edit.js.map +1 -1
  100. package/build-module/post-content/index.js +3 -0
  101. package/build-module/post-content/index.js.map +1 -1
  102. package/build-module/site-logo/edit.js +1 -1
  103. package/build-module/site-logo/edit.js.map +1 -1
  104. package/build-module/template-part/variations.js +5 -0
  105. package/build-module/template-part/variations.js.map +1 -1
  106. package/build-style/editor-rtl.css +76 -1
  107. package/build-style/editor.css +76 -1
  108. package/build-style/group/editor-rtl.css +44 -0
  109. package/build-style/group/editor.css +44 -0
  110. package/build-style/latest-comments/style-rtl.css +1 -0
  111. package/build-style/latest-comments/style.css +1 -0
  112. package/build-style/latest-posts/style-rtl.css +3 -0
  113. package/build-style/latest-posts/style.css +3 -0
  114. package/build-style/navigation/editor-rtl.css +23 -0
  115. package/build-style/navigation/editor.css +23 -0
  116. package/build-style/navigation/style-rtl.css +10 -0
  117. package/build-style/navigation/style.css +10 -0
  118. package/build-style/navigation-link/editor-rtl.css +8 -1
  119. package/build-style/navigation-link/editor.css +8 -1
  120. package/build-style/query/editor-rtl.css +1 -1
  121. package/build-style/query/editor.css +1 -1
  122. package/build-style/query-pagination/style-rtl.css +1 -1
  123. package/build-style/query-pagination/style.css +1 -1
  124. package/build-style/style-rtl.css +20 -1
  125. package/build-style/style.css +20 -1
  126. package/build-style/table/editor-rtl.css +1 -0
  127. package/build-style/table/editor.css +1 -0
  128. package/build-style/table/style-rtl.css +5 -0
  129. package/build-style/table/style.css +5 -0
  130. package/build-style/table/theme-rtl.css +1 -3
  131. package/build-style/table/theme.css +1 -3
  132. package/build-style/theme-rtl.css +1 -3
  133. package/build-style/theme.css +1 -3
  134. package/package.json +28 -28
  135. package/src/avatar/index.php +1 -1
  136. package/src/block/test/edit.native.js +8 -8
  137. package/src/button/block.json +4 -1
  138. package/src/button/deprecated.js +18 -2
  139. package/src/button/edit.js +11 -9
  140. package/src/button/save.js +12 -2
  141. package/src/buttons/test/edit.native.js +19 -19
  142. package/src/columns/test/edit.native.js +32 -32
  143. package/src/columns/transforms.js +8 -0
  144. package/src/cover/edit/index.js +3 -1
  145. package/src/cover/test/edit.native.js +26 -26
  146. package/src/embed/test/index.native.js +43 -43
  147. package/src/gallery/test/index.native.js +11 -11
  148. package/src/gallery/v1/edit.js +19 -24
  149. package/src/group/block.json +3 -0
  150. package/src/group/edit.js +95 -44
  151. package/src/group/editor.scss +48 -0
  152. package/src/group/placeholder.js +187 -0
  153. package/src/group/test/edit.native.js +3 -3
  154. package/src/group/test/placeholder.js +78 -0
  155. package/src/group/variations.js +3 -3
  156. package/src/image/test/edit.native.js +17 -17
  157. package/src/latest-comments/block.json +5 -1
  158. package/src/latest-comments/edit.js +1 -0
  159. package/src/latest-comments/style.scss +3 -0
  160. package/src/latest-posts/block.json +13 -0
  161. package/src/latest-posts/style.scss +3 -0
  162. package/src/list/test/edit.native.js +36 -36
  163. package/src/list-item/edit.js +1 -0
  164. package/src/missing/test/edit-integration.native.js +5 -5
  165. package/src/navigation/edit/index.js +173 -146
  166. package/src/navigation/edit/manage-menus-button.js +21 -0
  167. package/src/navigation/edit/navigation-menu-selector.js +20 -5
  168. package/src/navigation/edit/responsive-wrapper.js +2 -10
  169. package/src/navigation/edit/unsaved-inner-blocks.js +5 -29
  170. package/src/navigation/editor.scss +25 -0
  171. package/src/navigation/style.scss +16 -0
  172. package/src/navigation-link/edit.js +8 -0
  173. package/src/navigation-link/editor.scss +8 -0
  174. package/src/post-author/edit.js +44 -20
  175. package/src/post-content/block.json +3 -0
  176. package/src/query/editor.scss +1 -1
  177. package/src/query-pagination/style.scss +1 -1
  178. package/src/read-more/index.php +9 -2
  179. package/src/shortcode/test/edit.native.js +5 -5
  180. package/src/site-logo/edit.js +1 -1
  181. package/src/social-link/test/index.native.js +10 -10
  182. package/src/social-links/test/edit.native.js +4 -4
  183. package/src/spacer/test/index.native.js +17 -17
  184. package/src/table/editor.scss +1 -0
  185. package/src/table/style.scss +7 -0
  186. package/src/table/theme.scss +1 -3
  187. package/src/template-part/index.php +5 -0
  188. package/src/template-part/variations.js +4 -0
@@ -78,14 +78,14 @@ describe( 'Reusable block', () => {
78
78
  return Promise.resolve( response );
79
79
  } );
80
80
 
81
- const { getByA11yLabel, getByTestId, getByText } =
81
+ const { getByLabelText, getByTestId, getByText } =
82
82
  await initializeEditor( {
83
83
  initialHtml: '',
84
84
  capabilities: { reusableBlock: true },
85
85
  } );
86
86
 
87
87
  // Open the inserter menu.
88
- fireEvent.press( await waitFor( () => getByA11yLabel( 'Add block' ) ) );
88
+ fireEvent.press( await waitFor( () => getByLabelText( 'Add block' ) ) );
89
89
 
90
90
  // Navigate to reusable tab.
91
91
  const reusableSegment = await waitFor( () => getByText( 'Reusable' ) );
@@ -116,7 +116,7 @@ describe( 'Reusable block', () => {
116
116
 
117
117
  // Get the reusable block.
118
118
  const reusableBlock = await waitFor( () =>
119
- getByA11yLabel( /Reusable block Block\. Row 1/ )
119
+ getByLabelText( /Reusable block Block\. Row 1/ )
120
120
  );
121
121
 
122
122
  expect( reusableBlock ).toBeDefined();
@@ -128,12 +128,12 @@ describe( 'Reusable block', () => {
128
128
  const id = 3;
129
129
  const initialHtml = `<!-- wp:block {"ref":${ id }} /-->`;
130
130
 
131
- const { getByA11yLabel } = await initializeEditor( {
131
+ const { getByLabelText } = await initializeEditor( {
132
132
  initialHtml,
133
133
  } );
134
134
 
135
135
  const reusableBlock = await waitFor( () =>
136
- getByA11yLabel( /Reusable block Block\. Row 1/ )
136
+ getByLabelText( /Reusable block Block\. Row 1/ )
137
137
  );
138
138
 
139
139
  const blockDeleted = await waitFor( () =>
@@ -163,12 +163,12 @@ describe( 'Reusable block', () => {
163
163
  return Promise.resolve( response );
164
164
  } );
165
165
 
166
- const { getByA11yLabel } = await initializeEditor( {
166
+ const { getByLabelText } = await initializeEditor( {
167
167
  initialHtml,
168
168
  } );
169
169
 
170
170
  const reusableBlock = await waitFor( () =>
171
- getByA11yLabel( /Reusable block Block\. Row 1/ )
171
+ getByLabelText( /Reusable block Block\. Row 1/ )
172
172
  );
173
173
 
174
174
  const innerBlockListWrapper = await waitFor( () =>
@@ -186,7 +186,7 @@ describe( 'Reusable block', () => {
186
186
  } );
187
187
 
188
188
  const headingInnerBlock = await waitFor( () =>
189
- within( reusableBlock ).getByA11yLabel(
189
+ within( reusableBlock ).getByLabelText(
190
190
  'Heading Block. Row 1. Level 2. First Reusable block'
191
191
  )
192
192
  );
@@ -9,6 +9,9 @@
9
9
  "keywords": [ "link" ],
10
10
  "textdomain": "default",
11
11
  "attributes": {
12
+ "textAlign": {
13
+ "type": "string"
14
+ },
12
15
  "url": {
13
16
  "type": "string",
14
17
  "source": "attribute",
@@ -56,7 +59,7 @@
56
59
  },
57
60
  "supports": {
58
61
  "anchor": true,
59
- "align": true,
62
+ "align": false,
60
63
  "alignWide": false,
61
64
  "color": {
62
65
  "__experimentalSkipSerialization": true,
@@ -51,6 +51,20 @@ const migrateBorderRadius = ( attributes ) => {
51
51
  };
52
52
  };
53
53
 
54
+ function migrateAlign( attributes ) {
55
+ if ( ! attributes.align ) {
56
+ return attributes;
57
+ }
58
+ const { align, ...otherAttributes } = attributes;
59
+ return {
60
+ ...otherAttributes,
61
+ className: classnames(
62
+ otherAttributes.className,
63
+ `align${ attributes.align }`
64
+ ),
65
+ };
66
+ }
67
+
54
68
  const migrateCustomColorsAndGradients = ( attributes ) => {
55
69
  if (
56
70
  ! attributes.customTextColor &&
@@ -780,10 +794,12 @@ const deprecated = [
780
794
  isEligible: ( attributes ) =>
781
795
  !! attributes.customTextColor ||
782
796
  !! attributes.customBackgroundColor ||
783
- !! attributes.customGradient,
797
+ !! attributes.customGradient ||
798
+ !! attributes.align,
784
799
  migrate: compose(
785
800
  migrateBorderRadius,
786
- migrateCustomColorsAndGradients
801
+ migrateCustomColorsAndGradients,
802
+ migrateAlign
787
803
  ),
788
804
  save( { attributes } ) {
789
805
  const {
@@ -7,7 +7,7 @@ import classnames from 'classnames';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { __ } from '@wordpress/i18n';
10
- import { useCallback, useEffect, useState, useRef } from '@wordpress/element';
10
+ import { useEffect, useState, useRef } from '@wordpress/element';
11
11
  import {
12
12
  Button,
13
13
  ButtonGroup,
@@ -17,6 +17,7 @@ import {
17
17
  Popover,
18
18
  } from '@wordpress/components';
19
19
  import {
20
+ AlignmentControl,
20
21
  BlockControls,
21
22
  InspectorControls,
22
23
  RichText,
@@ -76,14 +77,8 @@ function ButtonEdit( props ) {
76
77
  onReplace,
77
78
  mergeBlocks,
78
79
  } = props;
79
- const { linkTarget, placeholder, rel, style, text, url, width } =
80
+ const { textAlign, linkTarget, placeholder, rel, style, text, url, width } =
80
81
  attributes;
81
- const onSetLinkRel = useCallback(
82
- ( value ) => {
83
- setAttributes( { rel: value } );
84
- },
85
- [ setAttributes ]
86
- );
87
82
 
88
83
  function onToggleOpenInNewTab( value ) {
89
84
  const newLinkTarget = value ? '_blank' : undefined;
@@ -176,6 +171,7 @@ function ButtonEdit( props ) {
176
171
  colorProps.className,
177
172
  borderProps.className,
178
173
  {
174
+ [ `has-text-align-${ textAlign }` ]: textAlign,
179
175
  // For backwards compatibility add style that isn't
180
176
  // provided via block support.
181
177
  'no-border-radius': style?.border?.radius === 0,
@@ -199,6 +195,12 @@ function ButtonEdit( props ) {
199
195
  />
200
196
  </div>
201
197
  <BlockControls group="block">
198
+ <AlignmentControl
199
+ value={ textAlign }
200
+ onChange={ ( nextAlign ) => {
201
+ setAttributes( { textAlign: nextAlign } );
202
+ } }
203
+ />
202
204
  { ! isURLSet && (
203
205
  <ToolbarButton
204
206
  name="link"
@@ -262,7 +264,7 @@ function ButtonEdit( props ) {
262
264
  <TextControl
263
265
  label={ __( 'Link rel' ) }
264
266
  value={ rel || '' }
265
- onChange={ onSetLinkRel }
267
+ onChange={ ( newRel ) => setAttributes( { rel: newRel } ) }
266
268
  />
267
269
  </InspectorControls>
268
270
  </>
@@ -16,8 +16,17 @@ import {
16
16
  } from '@wordpress/block-editor';
17
17
 
18
18
  export default function save( { attributes, className } ) {
19
- const { fontSize, linkTarget, rel, style, text, title, url, width } =
20
- attributes;
19
+ const {
20
+ textAlign,
21
+ fontSize,
22
+ linkTarget,
23
+ rel,
24
+ style,
25
+ text,
26
+ title,
27
+ url,
28
+ width,
29
+ } = attributes;
21
30
 
22
31
  if ( ! text ) {
23
32
  return null;
@@ -31,6 +40,7 @@ export default function save( { attributes, className } ) {
31
40
  colorProps.className,
32
41
  borderProps.className,
33
42
  {
43
+ [ `has-text-align-${ textAlign }` ]: textAlign,
34
44
  // For backwards compatibility add style that isn't provided via
35
45
  // block support.
36
46
  'no-border-radius': style?.border?.radius === 0,
@@ -50,12 +50,12 @@ describe( 'Buttons block', () => {
50
50
  <div class="wp-block-button"><a class="wp-block-button__link wp-element-button" style="border-radius:5px" >Hello</a></div>
51
51
  <!-- /wp:button --></div>
52
52
  <!-- /wp:buttons -->`;
53
- const { getByA11yLabel } = await initializeEditor( {
53
+ const { getByLabelText } = await initializeEditor( {
54
54
  initialHtml,
55
55
  } );
56
56
 
57
57
  const buttonsBlock = await waitFor( () =>
58
- getByA11yLabel( /Buttons Block\. Row 1/ )
58
+ getByLabelText( /Buttons Block\. Row 1/ )
59
59
  );
60
60
  fireEvent.press( buttonsBlock );
61
61
 
@@ -73,17 +73,17 @@ describe( 'Buttons block', () => {
73
73
  } );
74
74
 
75
75
  const buttonInnerBlock = await waitFor( () =>
76
- within( buttonsBlock ).getByA11yLabel( /Button Block\. Row 1/ )
76
+ within( buttonsBlock ).getByLabelText( /Button Block\. Row 1/ )
77
77
  );
78
78
  fireEvent.press( buttonInnerBlock );
79
79
 
80
80
  const settingsButton = await waitFor( () =>
81
- getByA11yLabel( 'Open Settings' )
81
+ getByLabelText( 'Open Settings' )
82
82
  );
83
83
  fireEvent.press( settingsButton );
84
84
 
85
85
  const radiusStepper = await waitFor( () =>
86
- getByA11yLabel( /Border Radius/ )
86
+ getByLabelText( /Border Radius/ )
87
87
  );
88
88
 
89
89
  const incrementButton = await waitFor( () =>
@@ -98,7 +98,7 @@ describe( 'Buttons block', () => {
98
98
  const screen = await initializeEditor( {
99
99
  initialHtml: BUTTONS_HTML,
100
100
  } );
101
- const { getByA11yLabel } = screen;
101
+ const { getByLabelText } = screen;
102
102
 
103
103
  // Get block
104
104
  const buttonsBlock = await getBlock( screen, 'Buttons' );
@@ -126,13 +126,13 @@ describe( 'Buttons block', () => {
126
126
 
127
127
  // Check for new button
128
128
  const secondButtonBlock = await waitFor( () =>
129
- within( buttonsBlock ).getByA11yLabel( /Button Block\. Row 2/ )
129
+ within( buttonsBlock ).getByLabelText( /Button Block\. Row 2/ )
130
130
  );
131
131
  expect( secondButtonBlock ).toBeVisible();
132
132
 
133
133
  // Add a Paragraph block using the empty placeholder at the bottom
134
134
  const paragraphPlaceholder = await waitFor( () =>
135
- getByA11yLabel( 'Add paragraph block' )
135
+ getByLabelText( 'Add paragraph block' )
136
136
  );
137
137
  fireEvent.press( paragraphPlaceholder );
138
138
 
@@ -149,9 +149,9 @@ describe( 'Buttons block', () => {
149
149
  initialHtml: BUTTONS_HTML,
150
150
  } );
151
151
  const {
152
- getByA11yLabel,
152
+ getByLabelText,
153
153
  getByTestId,
154
- queryAllByA11yLabel,
154
+ queryAllByLabelText,
155
155
  getByText,
156
156
  } = screen;
157
157
 
@@ -176,7 +176,7 @@ describe( 'Buttons block', () => {
176
176
  fireEvent.press( buttonBlock );
177
177
 
178
178
  // Open the block inserter
179
- fireEvent.press( getByA11yLabel( 'Add block' ) );
179
+ fireEvent.press( getByLabelText( 'Add block' ) );
180
180
 
181
181
  const blockList = getByTestId( 'InserterUI-Blocks' );
182
182
  // onScroll event used to force the FlatList to render all items
@@ -190,7 +190,7 @@ describe( 'Buttons block', () => {
190
190
 
191
191
  // Check the Add block here placeholder is not visible
192
192
  const addBlockHerePlaceholders =
193
- queryAllByA11yLabel( 'ADD BLOCK HERE' );
193
+ queryAllByLabelText( 'ADD BLOCK HERE' );
194
194
  expect( addBlockHerePlaceholders.length ).toBe( 0 );
195
195
 
196
196
  // Add a new Button block
@@ -201,7 +201,7 @@ describe( 'Buttons block', () => {
201
201
  rowIndex: 2,
202
202
  } );
203
203
  const secondButtonInput =
204
- within( secondButtonBlock ).getByA11yLabel(
204
+ within( secondButtonBlock ).getByLabelText(
205
205
  'Text input. Empty'
206
206
  );
207
207
  changeTextOfRichText( secondButtonInput, 'Hello!' );
@@ -214,7 +214,7 @@ describe( 'Buttons block', () => {
214
214
  const screen = await initializeEditor( {
215
215
  initialHtml: BUTTONS_HTML,
216
216
  } );
217
- const { getByA11yLabel } = screen;
217
+ const { getByLabelText } = screen;
218
218
 
219
219
  // Get block
220
220
  const buttonsBlock = await getBlock( screen, 'Buttons' );
@@ -236,13 +236,13 @@ describe( 'Buttons block', () => {
236
236
  fireEvent.press( buttonBlock );
237
237
 
238
238
  // Open block actions menu
239
- const blockActionsButton = getByA11yLabel(
239
+ const blockActionsButton = getByLabelText(
240
240
  /Open Block Actions Menu/
241
241
  );
242
242
  fireEvent.press( blockActionsButton );
243
243
 
244
244
  // Delete block
245
- const deleteButton = getByA11yLabel( /Remove block/ );
245
+ const deleteButton = getByLabelText( /Remove block/ );
246
246
  fireEvent.press( deleteButton );
247
247
 
248
248
  expect( getEditorHtml() ).toMatchSnapshot();
@@ -260,17 +260,17 @@ describe( 'Buttons block', () => {
260
260
  const initialHtml = `<!-- wp:buttons -->
261
261
  <div class="wp-block-buttons"><!-- wp:button /--></div>
262
262
  <!-- /wp:buttons -->`;
263
- const { getByA11yLabel, getByText } = await initializeEditor( {
263
+ const { getByLabelText, getByText } = await initializeEditor( {
264
264
  initialHtml,
265
265
  } );
266
266
 
267
267
  const block = await waitFor( () =>
268
- getByA11yLabel( /Buttons Block\. Row 1/ )
268
+ getByLabelText( /Buttons Block\. Row 1/ )
269
269
  );
270
270
  fireEvent.press( block );
271
271
 
272
272
  fireEvent.press(
273
- getByA11yLabel( 'Change items justification' )
273
+ getByLabelText( 'Change items justification' )
274
274
  );
275
275
 
276
276
  // Select alignment option.
@@ -75,7 +75,7 @@ describe( 'Columns block', () => {
75
75
  const screen = await initializeEditor( {
76
76
  initialHtml: TWO_COLUMNS_BLOCK_HTML,
77
77
  } );
78
- const { getByA11yLabel } = screen;
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 = getByA11yLabel( /Number of columns/ );
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 { getByA11yLabel } = screen;
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 = getByA11yLabel( /Number of columns/ );
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 { getByA11yLabel, getByTestId } = screen;
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 ).getByA11yLabel(
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 = getByA11yLabel( /Number of columns/ );
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 { getByA11yLabel } = screen;
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 = getByA11yLabel( /Open Block Actions Menu/ );
178
+ const blockActionsButton = getByLabelText( /Open Block Actions Menu/ );
179
179
  fireEvent.press( blockActionsButton );
180
180
 
181
181
  // Delete block
182
- const deleteButton = getByA11yLabel( /Remove block/ );
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 { getByA11yLabel } = screen;
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 = getByA11yLabel( /Open Block Actions Menu/ );
203
+ let blockActionsButton = getByLabelText( /Open Block Actions Menu/ );
204
204
  fireEvent.press( blockActionsButton );
205
205
 
206
206
  // Delete block
207
- let deleteButton = getByA11yLabel( /Remove block/ );
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 = getByA11yLabel( /Open Block Actions Menu/ );
215
+ blockActionsButton = getByLabelText( /Open Block Actions Menu/ );
216
216
  fireEvent.press( blockActionsButton );
217
217
 
218
218
  // Delete block
219
- deleteButton = getByA11yLabel( /Remove block/ );
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 { getByA11yLabel } = screen;
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 = getByA11yLabel(
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 = getByA11yLabel( /Align top/ );
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 { getByA11yLabel } = screen;
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 = getByA11yLabel(
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 = getByA11yLabel( /Align top/ );
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 = getByA11yLabel( /Align bottom/ );
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 { getByA11yLabel } = screen;
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 = getByA11yLabel(
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 = getByA11yLabel( /Align top/ );
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 { getByA11yLabel, getByTestId } = screen;
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 ).getByA11yLabel(
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 = getByA11yLabel( /Width. Value is/ );
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 { getByA11yLabel, getByTestId } = screen;
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 = getByA11yLabel( /Width. Value is/ );
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 = getByA11yLabel( /Width. Value is/ );
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 ).getByA11yLabel( layout );
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;
@@ -188,7 +188,9 @@ function CoverEdit( {
188
188
  className: 'wp-block-cover__inner-container',
189
189
  },
190
190
  {
191
- template: innerBlocksTemplate,
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,