@wordpress/block-library 7.14.2 → 7.15.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 (193) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/avatar/index.js +1 -1
  3. package/build/block/edit.native.js +1 -1
  4. package/build/block/edit.native.js.map +1 -1
  5. package/build/buttons/edit.native.js +1 -3
  6. package/build/buttons/edit.native.js.map +1 -1
  7. package/build/calendar/index.js +9 -0
  8. package/build/calendar/index.js.map +1 -1
  9. package/build/code/index.js +1 -1
  10. package/build/code/index.js.map +1 -1
  11. package/build/comments/edit/comments-legacy.js +1 -1
  12. package/build/comments/edit/comments-legacy.js.map +1 -1
  13. package/build/comments-pagination-next/index.js +1 -1
  14. package/build/comments-pagination-numbers/index.js +1 -1
  15. package/build/comments-pagination-previous/index.js +1 -1
  16. package/build/comments-title/edit.js +1 -1
  17. package/build/comments-title/edit.js.map +1 -1
  18. package/build/cover/edit/use-cover-is-dark.js +10 -7
  19. package/build/cover/edit/use-cover-is-dark.js.map +1 -1
  20. package/build/cover/index.js +9 -2
  21. package/build/cover/index.js.map +1 -1
  22. package/build/embed/deprecated.js +12 -6
  23. package/build/embed/deprecated.js.map +1 -1
  24. package/build/embed/index.js +12 -6
  25. package/build/embed/index.js.map +1 -1
  26. package/build/embed/transforms.js +12 -6
  27. package/build/embed/transforms.js.map +1 -1
  28. package/build/embed/util.js +12 -6
  29. package/build/embed/util.js.map +1 -1
  30. package/build/embed/variations.js +1 -1
  31. package/build/embed/variations.js.map +1 -1
  32. package/build/freeform/edit.js +5 -8
  33. package/build/freeform/edit.js.map +1 -1
  34. package/build/gallery/deprecated.js +4 -4
  35. package/build/gallery/deprecated.js.map +1 -1
  36. package/build/list-item/edit.js +2 -1
  37. package/build/list-item/edit.js.map +1 -1
  38. package/build/missing/edit.js +9 -2
  39. package/build/missing/edit.js.map +1 -1
  40. package/build/more/edit.js +1 -1
  41. package/build/more/edit.js.map +1 -1
  42. package/build/navigation/menu-items-to-blocks.js +16 -6
  43. package/build/navigation/menu-items-to-blocks.js.map +1 -1
  44. package/build/post-excerpt/edit.js +1 -1
  45. package/build/post-excerpt/edit.js.map +1 -1
  46. package/build/post-navigation-link/edit.js +35 -4
  47. package/build/post-navigation-link/edit.js.map +1 -1
  48. package/build/post-navigation-link/index.js +6 -1
  49. package/build/post-navigation-link/index.js.map +1 -1
  50. package/build/post-template/edit.js +13 -28
  51. package/build/post-template/edit.js.map +1 -1
  52. package/build/query/edit/inspector-controls/index.js +4 -8
  53. package/build/query/edit/inspector-controls/index.js.map +1 -1
  54. package/build/query/edit/inspector-controls/sticky-control.js +1 -1
  55. package/build/query/edit/inspector-controls/sticky-control.js.map +1 -1
  56. package/build/query/edit/query-placeholder.js +2 -2
  57. package/build/query/edit/query-placeholder.js.map +1 -1
  58. package/build/query-title/edit.js +1 -1
  59. package/build/query-title/edit.js.map +1 -1
  60. package/build/quote/transforms.js +2 -2
  61. package/build/quote/transforms.js.map +1 -1
  62. package/build/read-more/edit.js +1 -1
  63. package/build/read-more/edit.js.map +1 -1
  64. package/build/site-tagline/index.js +1 -1
  65. package/build/social-links/edit.native.js +1 -0
  66. package/build/social-links/edit.native.js.map +1 -1
  67. package/build/template-part/edit/index.js +2 -2
  68. package/build/template-part/edit/index.js.map +1 -1
  69. package/build-module/avatar/index.js +1 -1
  70. package/build-module/block/edit.native.js +1 -1
  71. package/build-module/block/edit.native.js.map +1 -1
  72. package/build-module/buttons/edit.native.js +1 -2
  73. package/build-module/buttons/edit.native.js.map +1 -1
  74. package/build-module/calendar/index.js +9 -0
  75. package/build-module/calendar/index.js.map +1 -1
  76. package/build-module/code/index.js +1 -1
  77. package/build-module/code/index.js.map +1 -1
  78. package/build-module/comments/edit/comments-legacy.js +1 -1
  79. package/build-module/comments/edit/comments-legacy.js.map +1 -1
  80. package/build-module/comments-pagination-next/index.js +1 -1
  81. package/build-module/comments-pagination-numbers/index.js +1 -1
  82. package/build-module/comments-pagination-previous/index.js +1 -1
  83. package/build-module/comments-title/edit.js +1 -1
  84. package/build-module/comments-title/edit.js.map +1 -1
  85. package/build-module/cover/edit/use-cover-is-dark.js +9 -4
  86. package/build-module/cover/edit/use-cover-is-dark.js.map +1 -1
  87. package/build-module/cover/index.js +9 -2
  88. package/build-module/cover/index.js.map +1 -1
  89. package/build-module/embed/deprecated.js +12 -6
  90. package/build-module/embed/deprecated.js.map +1 -1
  91. package/build-module/embed/index.js +12 -6
  92. package/build-module/embed/index.js.map +1 -1
  93. package/build-module/embed/transforms.js +12 -6
  94. package/build-module/embed/transforms.js.map +1 -1
  95. package/build-module/embed/util.js +12 -6
  96. package/build-module/embed/util.js.map +1 -1
  97. package/build-module/embed/variations.js +1 -1
  98. package/build-module/embed/variations.js.map +1 -1
  99. package/build-module/freeform/edit.js +3 -6
  100. package/build-module/freeform/edit.js.map +1 -1
  101. package/build-module/gallery/deprecated.js +4 -4
  102. package/build-module/gallery/deprecated.js.map +1 -1
  103. package/build-module/list-item/edit.js +2 -1
  104. package/build-module/list-item/edit.js.map +1 -1
  105. package/build-module/missing/edit.js +11 -4
  106. package/build-module/missing/edit.js.map +1 -1
  107. package/build-module/more/edit.js +1 -1
  108. package/build-module/more/edit.js.map +1 -1
  109. package/build-module/navigation/menu-items-to-blocks.js +16 -6
  110. package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
  111. package/build-module/post-excerpt/edit.js +1 -1
  112. package/build-module/post-excerpt/edit.js.map +1 -1
  113. package/build-module/post-navigation-link/edit.js +37 -6
  114. package/build-module/post-navigation-link/edit.js.map +1 -1
  115. package/build-module/post-navigation-link/index.js +6 -1
  116. package/build-module/post-navigation-link/index.js.map +1 -1
  117. package/build-module/post-template/edit.js +14 -29
  118. package/build-module/post-template/edit.js.map +1 -1
  119. package/build-module/query/edit/inspector-controls/index.js +2 -6
  120. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  121. package/build-module/query/edit/inspector-controls/sticky-control.js +1 -1
  122. package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -1
  123. package/build-module/query/edit/query-placeholder.js +2 -2
  124. package/build-module/query/edit/query-placeholder.js.map +1 -1
  125. package/build-module/query-title/edit.js +1 -1
  126. package/build-module/query-title/edit.js.map +1 -1
  127. package/build-module/quote/transforms.js +2 -2
  128. package/build-module/quote/transforms.js.map +1 -1
  129. package/build-module/read-more/edit.js +1 -1
  130. package/build-module/read-more/edit.js.map +1 -1
  131. package/build-module/site-tagline/index.js +1 -1
  132. package/build-module/social-links/edit.native.js +1 -0
  133. package/build-module/social-links/edit.native.js.map +1 -1
  134. package/build-module/template-part/edit/index.js +3 -3
  135. package/build-module/template-part/edit/index.js.map +1 -1
  136. package/build-style/calendar/style-rtl.css +21 -12
  137. package/build-style/calendar/style.css +21 -12
  138. package/build-style/post-navigation-link/style-rtl.css +90 -0
  139. package/build-style/post-navigation-link/style.css +90 -0
  140. package/build-style/style-rtl.css +36 -12
  141. package/build-style/style.css +36 -12
  142. package/package.json +29 -29
  143. package/src/avatar/block.json +1 -1
  144. package/src/block/edit.native.js +1 -1
  145. package/src/buttons/edit.native.js +1 -2
  146. package/src/buttons/test/__snapshots__/edit.native.js.snap +28 -0
  147. package/src/buttons/test/edit.native.js +170 -0
  148. package/src/calendar/block.json +9 -0
  149. package/src/calendar/index.php +22 -1
  150. package/src/calendar/style.scss +28 -15
  151. package/src/code/index.js +1 -1
  152. package/src/columns/test/__snapshots__/edit.native.js.snap +219 -0
  153. package/src/columns/test/edit.native.js +432 -0
  154. package/src/comments/edit/comments-legacy.js +1 -1
  155. package/src/comments-pagination-next/block.json +1 -1
  156. package/src/comments-pagination-numbers/block.json +1 -1
  157. package/src/comments-pagination-previous/block.json +1 -1
  158. package/src/comments-title/edit.js +1 -1
  159. package/src/cover/edit/use-cover-is-dark.js +11 -7
  160. package/src/cover/index.js +8 -1
  161. package/src/cover/test/__snapshots__/edit.native.js.snap +64 -0
  162. package/src/cover/test/edit.native.js +136 -4
  163. package/src/embed/block.json +12 -6
  164. package/src/embed/test/index.native.js +1 -2
  165. package/src/embed/variations.js +1 -1
  166. package/src/freeform/edit.js +12 -10
  167. package/src/gallery/deprecated.js +4 -4
  168. package/src/group/test/__snapshots__/edit.native.js.snap +19 -0
  169. package/src/group/test/edit.native.js +102 -0
  170. package/src/list-item/edit.js +1 -0
  171. package/src/missing/edit.js +15 -4
  172. package/src/more/edit.js +1 -1
  173. package/src/navigation/menu-items-to-blocks.js +39 -22
  174. package/src/navigation/test/menu-items-to-blocks.js +6 -0
  175. package/src/post-excerpt/edit.js +1 -1
  176. package/src/post-featured-image/index.php +11 -18
  177. package/src/post-navigation-link/block.json +6 -1
  178. package/src/post-navigation-link/edit.js +64 -3
  179. package/src/post-navigation-link/index.php +23 -0
  180. package/src/post-navigation-link/style.scss +23 -0
  181. package/src/post-template/edit.js +14 -23
  182. package/src/query/edit/inspector-controls/index.js +2 -6
  183. package/src/query/edit/inspector-controls/sticky-control.js +1 -1
  184. package/src/query/edit/query-placeholder.js +4 -1
  185. package/src/query-title/edit.js +1 -1
  186. package/src/quote/transforms.js +1 -1
  187. package/src/read-more/edit.js +1 -1
  188. package/src/site-tagline/block.json +1 -1
  189. package/src/social-links/edit.native.js +7 -1
  190. package/src/social-links/test/__snapshots__/edit.native.js.snap +57 -0
  191. package/src/social-links/test/edit.native.js +199 -0
  192. package/src/style.scss +1 -0
  193. package/src/template-part/edit/index.js +60 -58
@@ -0,0 +1,219 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Columns block adds a column block using the appender 1`] = `
4
+ "<!-- wp:columns -->
5
+ <div class=\\"wp-block-columns\\"><!-- wp:column -->
6
+ <div class=\\"wp-block-column\\"></div>
7
+ <!-- /wp:column -->
8
+
9
+ <!-- wp:column -->
10
+ <div class=\\"wp-block-column\\"></div>
11
+ <!-- /wp:column -->
12
+
13
+ <!-- wp:column -->
14
+ <div class=\\"wp-block-column\\"></div>
15
+ <!-- /wp:column --></div>
16
+ <!-- /wp:columns -->"
17
+ `;
18
+
19
+ exports[`Columns block changes the vertical alignment on individual Column 1`] = `
20
+ "<!-- wp:columns {\\"verticalAlignment\\":\\"top\\"} -->
21
+ <div class=\\"wp-block-columns are-vertically-aligned-top\\"><!-- wp:column {\\"verticalAlignment\\":\\"bottom\\"} -->
22
+ <div class=\\"wp-block-column is-vertically-aligned-bottom\\"></div>
23
+ <!-- /wp:column -->
24
+
25
+ <!-- wp:column {\\"verticalAlignment\\":\\"top\\"} -->
26
+ <div class=\\"wp-block-column is-vertically-aligned-top\\"></div>
27
+ <!-- /wp:column --></div>
28
+ <!-- /wp:columns -->"
29
+ `;
30
+
31
+ exports[`Columns block changes vertical alignment on Columns 1`] = `
32
+ "<!-- wp:columns {\\"verticalAlignment\\":\\"top\\"} -->
33
+ <div class=\\"wp-block-columns are-vertically-aligned-top\\"><!-- wp:column {\\"verticalAlignment\\":\\"top\\"} -->
34
+ <div class=\\"wp-block-column is-vertically-aligned-top\\"></div>
35
+ <!-- /wp:column -->
36
+
37
+ <!-- wp:column {\\"verticalAlignment\\":\\"top\\"} -->
38
+ <div class=\\"wp-block-column is-vertically-aligned-top\\"></div>
39
+ <!-- /wp:column --></div>
40
+ <!-- /wp:columns -->"
41
+ `;
42
+
43
+ exports[`Columns block inserts block 1`] = `
44
+ "<!-- wp:columns -->
45
+ <div class=\\"wp-block-columns\\"><!-- wp:column {\\"width\\":\\"50%\\"} -->
46
+ <div class=\\"wp-block-column\\" style=\\"flex-basis:50%\\"></div>
47
+ <!-- /wp:column -->
48
+
49
+ <!-- wp:column {\\"width\\":\\"50%\\"} -->
50
+ <div class=\\"wp-block-column\\" style=\\"flex-basis:50%\\"></div>
51
+ <!-- /wp:column --></div>
52
+ <!-- /wp:columns -->"
53
+ `;
54
+
55
+ exports[`Columns block removes column with the remove button 1`] = `
56
+ "<!-- wp:columns -->
57
+ <div class=\\"wp-block-columns\\"><!-- wp:column -->
58
+ <div class=\\"wp-block-column\\"></div>
59
+ <!-- /wp:column --></div>
60
+ <!-- /wp:columns -->"
61
+ `;
62
+
63
+ exports[`Columns block removes the only one left Column with the remove button 1`] = `
64
+ "<!-- wp:paragraph -->
65
+ <p></p>
66
+ <!-- /wp:paragraph -->"
67
+ `;
68
+
69
+ exports[`Columns block sets current vertical alignment on new Columns 1`] = `
70
+ "<!-- wp:columns {\\"verticalAlignment\\":\\"top\\"} -->
71
+ <div class=\\"wp-block-columns are-vertically-aligned-top\\"><!-- wp:column {\\"verticalAlignment\\":\\"top\\"} -->
72
+ <div class=\\"wp-block-column is-vertically-aligned-top\\"></div>
73
+ <!-- /wp:column -->
74
+
75
+ <!-- wp:column {\\"verticalAlignment\\":\\"top\\"} -->
76
+ <div class=\\"wp-block-column is-vertically-aligned-top\\"></div>
77
+ <!-- /wp:column -->
78
+
79
+ <!-- wp:column {\\"verticalAlignment\\":\\"top\\"} -->
80
+ <div class=\\"wp-block-column is-vertically-aligned-top\\"></div>
81
+ <!-- /wp:column --></div>
82
+ <!-- /wp:columns -->"
83
+ `;
84
+
85
+ exports[`Columns block when using columns percentage mechanism sets custom values correctly 1`] = `
86
+ "<!-- wp:columns -->
87
+ <div class=\\"wp-block-columns\\"><!-- wp:column {\\"width\\":\\"90%\\"} -->
88
+ <div class=\\"wp-block-column\\" style=\\"flex-basis:90%\\"></div>
89
+ <!-- /wp:column -->
90
+
91
+ <!-- wp:column {\\"width\\":\\"55.5%\\"} -->
92
+ <div class=\\"wp-block-column\\" style=\\"flex-basis:55.5%\\"></div>
93
+ <!-- /wp:column --></div>
94
+ <!-- /wp:columns -->"
95
+ `;
96
+
97
+ exports[`Columns block when using columns percentage mechanism updates the slider's input value 1`] = `
98
+ "<!-- wp:columns -->
99
+ <div class=\\"wp-block-columns\\"><!-- wp:column {\\"width\\":\\"55.6%\\"} -->
100
+ <div class=\\"wp-block-column\\" style=\\"flex-basis:55.6%\\"></div>
101
+ <!-- /wp:column -->
102
+
103
+ <!-- wp:column -->
104
+ <div class=\\"wp-block-column\\"></div>
105
+ <!-- /wp:column -->
106
+
107
+ <!-- wp:column -->
108
+ <div class=\\"wp-block-column\\"></div>
109
+ <!-- /wp:column --></div>
110
+ <!-- /wp:columns -->"
111
+ `;
112
+
113
+ exports[`Columns block when using the columns layout picker sets the predefined percentages for 25 / 50 / 25 block 1`] = `
114
+ "<!-- wp:columns -->
115
+ <div class=\\"wp-block-columns\\"><!-- wp:column {\\"width\\":\\"25%\\"} -->
116
+ <div class=\\"wp-block-column\\" style=\\"flex-basis:25%\\"></div>
117
+ <!-- /wp:column -->
118
+
119
+ <!-- wp:column {\\"width\\":\\"50%\\"} -->
120
+ <div class=\\"wp-block-column\\" style=\\"flex-basis:50%\\"></div>
121
+ <!-- /wp:column -->
122
+
123
+ <!-- wp:column {\\"width\\":\\"25%\\"} -->
124
+ <div class=\\"wp-block-column\\" style=\\"flex-basis:25%\\"></div>
125
+ <!-- /wp:column --></div>
126
+ <!-- /wp:columns -->"
127
+ `;
128
+
129
+ exports[`Columns block when using the columns layout picker sets the predefined percentages for 33 / 33 / 33 block 1`] = `
130
+ "<!-- wp:columns -->
131
+ <div class=\\"wp-block-columns\\"><!-- wp:column -->
132
+ <div class=\\"wp-block-column\\"></div>
133
+ <!-- /wp:column -->
134
+
135
+ <!-- wp:column -->
136
+ <div class=\\"wp-block-column\\"></div>
137
+ <!-- /wp:column -->
138
+
139
+ <!-- wp:column -->
140
+ <div class=\\"wp-block-column\\"></div>
141
+ <!-- /wp:column --></div>
142
+ <!-- /wp:columns -->"
143
+ `;
144
+
145
+ exports[`Columns block when using the columns layout picker sets the predefined percentages for 33 / 66 block 1`] = `
146
+ "<!-- wp:columns -->
147
+ <div class=\\"wp-block-columns\\"><!-- wp:column {\\"width\\":\\"33.33%\\"} -->
148
+ <div class=\\"wp-block-column\\" style=\\"flex-basis:33.33%\\"></div>
149
+ <!-- /wp:column -->
150
+
151
+ <!-- wp:column {\\"width\\":\\"66.66%\\"} -->
152
+ <div class=\\"wp-block-column\\" style=\\"flex-basis:66.66%\\"></div>
153
+ <!-- /wp:column --></div>
154
+ <!-- /wp:columns -->"
155
+ `;
156
+
157
+ exports[`Columns block when using the columns layout picker sets the predefined percentages for 50 / 50 block 1`] = `
158
+ "<!-- wp:columns -->
159
+ <div class=\\"wp-block-columns\\"><!-- wp:column -->
160
+ <div class=\\"wp-block-column\\"></div>
161
+ <!-- /wp:column -->
162
+
163
+ <!-- wp:column -->
164
+ <div class=\\"wp-block-column\\"></div>
165
+ <!-- /wp:column --></div>
166
+ <!-- /wp:columns -->"
167
+ `;
168
+
169
+ exports[`Columns block when using the columns layout picker sets the predefined percentages for 66 / 33 block 1`] = `
170
+ "<!-- wp:columns -->
171
+ <div class=\\"wp-block-columns\\"><!-- wp:column {\\"width\\":\\"66.66%\\"} -->
172
+ <div class=\\"wp-block-column\\" style=\\"flex-basis:66.66%\\"></div>
173
+ <!-- /wp:column -->
174
+
175
+ <!-- wp:column {\\"width\\":\\"33.33%\\"} -->
176
+ <div class=\\"wp-block-column\\" style=\\"flex-basis:33.33%\\"></div>
177
+ <!-- /wp:column --></div>
178
+ <!-- /wp:columns -->"
179
+ `;
180
+
181
+ exports[`Columns block when using the columns layout picker sets the predefined percentages for 100 block 1`] = `
182
+ "<!-- wp:columns -->
183
+ <div class=\\"wp-block-columns\\"><!-- wp:column -->
184
+ <div class=\\"wp-block-column\\"></div>
185
+ <!-- /wp:column --></div>
186
+ <!-- /wp:columns -->"
187
+ `;
188
+
189
+ exports[`Columns block when using the number of columns setting adds a column block when incrementing the value 1`] = `
190
+ "<!-- wp:columns -->
191
+ <div class=\\"wp-block-columns\\"><!-- wp:column -->
192
+ <div class=\\"wp-block-column\\"></div>
193
+ <!-- /wp:column -->
194
+
195
+ <!-- wp:column -->
196
+ <div class=\\"wp-block-column\\"></div>
197
+ <!-- /wp:column -->
198
+
199
+ <!-- wp:column -->
200
+ <div class=\\"wp-block-column\\"></div>
201
+ <!-- /wp:column --></div>
202
+ <!-- /wp:columns -->"
203
+ `;
204
+
205
+ exports[`Columns block when using the number of columns setting reaches the minimum limit of number of column blocks 1`] = `
206
+ "<!-- wp:columns -->
207
+ <div class=\\"wp-block-columns\\"><!-- wp:column -->
208
+ <div class=\\"wp-block-column\\"></div>
209
+ <!-- /wp:column --></div>
210
+ <!-- /wp:columns -->"
211
+ `;
212
+
213
+ exports[`Columns block when using the number of columns setting removes a column block when decrementing the value 1`] = `
214
+ "<!-- wp:columns -->
215
+ <div class=\\"wp-block-columns\\"><!-- wp:column -->
216
+ <div class=\\"wp-block-column\\"></div>
217
+ <!-- /wp:column --></div>
218
+ <!-- /wp:columns -->"
219
+ `;
@@ -0,0 +1,432 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import {
5
+ addBlock,
6
+ fireEvent,
7
+ getEditorHtml,
8
+ initializeEditor,
9
+ openBlockSettings,
10
+ within,
11
+ getBlock,
12
+ waitFor,
13
+ dismissModal,
14
+ } from 'test/helpers';
15
+
16
+ /**
17
+ * WordPress dependencies
18
+ */
19
+ import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
20
+ import { registerCoreBlocks } from '@wordpress/block-library';
21
+
22
+ const TWO_COLUMNS_BLOCK_HTML = `<!-- wp:columns -->
23
+ <div class="wp-block-columns"><!-- wp:column -->
24
+ <div class="wp-block-column"></div>
25
+ <!-- /wp:column -->
26
+ <!-- wp:column -->
27
+ <div class="wp-block-column"></div>
28
+ <!-- /wp:column --></div>
29
+ <!-- /wp:columns -->`;
30
+
31
+ beforeAll( () => {
32
+ // Register all core blocks
33
+ registerCoreBlocks();
34
+ } );
35
+
36
+ afterAll( () => {
37
+ // Clean up registered blocks
38
+ getBlockTypes().forEach( ( block ) => {
39
+ unregisterBlockType( block.name );
40
+ } );
41
+ } );
42
+
43
+ describe( 'Columns block', () => {
44
+ it( 'inserts block', async () => {
45
+ const screen = await initializeEditor();
46
+
47
+ // Add block
48
+ await addBlock( screen, 'Columns' );
49
+
50
+ // Get block
51
+ const columnsBlock = await getBlock( screen, 'Columns' );
52
+ expect( columnsBlock ).toBeVisible();
53
+ expect( getEditorHtml() ).toMatchSnapshot();
54
+ } );
55
+
56
+ it( 'adds a column block using the appender', async () => {
57
+ const screen = await initializeEditor( {
58
+ initialHtml: TWO_COLUMNS_BLOCK_HTML,
59
+ } );
60
+
61
+ // Get block
62
+ const columnsBlock = await getBlock( screen, 'Columns' );
63
+ fireEvent.press( columnsBlock );
64
+
65
+ // Add a new column
66
+ const appenderButton =
67
+ within( columnsBlock ).getByTestId( 'appender-button' );
68
+ fireEvent.press( appenderButton );
69
+
70
+ expect( getEditorHtml() ).toMatchSnapshot();
71
+ } );
72
+
73
+ describe( 'when using the number of columns setting', () => {
74
+ it( 'adds a column block when incrementing the value', async () => {
75
+ const screen = await initializeEditor( {
76
+ initialHtml: TWO_COLUMNS_BLOCK_HTML,
77
+ } );
78
+ const { getByA11yLabel } = screen;
79
+
80
+ // Get block
81
+ const columnsBlock = await getBlock( screen, 'Columns' );
82
+ fireEvent.press( columnsBlock );
83
+
84
+ // Open block settings
85
+ await openBlockSettings( screen );
86
+
87
+ // Update the number of columns by adding one
88
+ const columnsControl = getByA11yLabel( /Number of columns/ );
89
+ fireEvent( columnsControl, 'accessibilityAction', {
90
+ nativeEvent: { actionName: 'increment' },
91
+ } );
92
+
93
+ expect( getEditorHtml() ).toMatchSnapshot();
94
+ } );
95
+
96
+ it( 'removes a column block when decrementing the value', async () => {
97
+ const screen = await initializeEditor( {
98
+ initialHtml: TWO_COLUMNS_BLOCK_HTML,
99
+ } );
100
+ const { getByA11yLabel } = screen;
101
+
102
+ // Wait for the block to be created.
103
+ const columnsBlock = await getBlock( screen, 'Columns' );
104
+ fireEvent.press( columnsBlock );
105
+
106
+ // Open block settings
107
+ await openBlockSettings( screen );
108
+
109
+ // Update the number of columns by removing one
110
+ const columnsControl = getByA11yLabel( /Number of columns/ );
111
+ fireEvent( columnsControl, 'accessibilityAction', {
112
+ nativeEvent: { actionName: 'decrement' },
113
+ } );
114
+
115
+ expect( getEditorHtml() ).toMatchSnapshot();
116
+ } );
117
+
118
+ it( 'reaches the minimum limit of number of column blocks', async () => {
119
+ const screen = await initializeEditor();
120
+ const { getByA11yLabel, getByTestId } = screen;
121
+
122
+ // Add block
123
+ await addBlock( screen, 'Columns' );
124
+
125
+ // Wait for the variations modal to be visible
126
+ await waitFor(
127
+ () => getByTestId( 'block-variation-modal' ).props.isVisible
128
+ );
129
+
130
+ // Select a column variation
131
+ const blockVariationModal = getByTestId( 'block-variation-modal' );
132
+ await waitFor( () => blockVariationModal.props.isVisible );
133
+ const threeColumnLayout =
134
+ within( blockVariationModal ).getByA11yLabel(
135
+ /33 \/ 33 \/ 33 block/
136
+ );
137
+ fireEvent.press( threeColumnLayout );
138
+
139
+ // Get block
140
+ const columnsBlock = await getBlock( screen, 'Columns' );
141
+ fireEvent.press( columnsBlock );
142
+
143
+ // Open block settings
144
+ await openBlockSettings( screen );
145
+
146
+ // Update the number of columns by adding one
147
+ const columnsControl = getByA11yLabel( /Number of columns/ );
148
+ fireEvent( columnsControl, 'accessibilityAction', {
149
+ nativeEvent: { actionName: 'increment' },
150
+ } );
151
+
152
+ // Press the decrement button 5 times to remove all columns but one
153
+ for ( let index = 0; index < 5; index++ ) {
154
+ fireEvent( columnsControl, 'accessibilityAction', {
155
+ nativeEvent: { actionName: 'decrement' },
156
+ } );
157
+ }
158
+
159
+ expect( getEditorHtml() ).toMatchSnapshot();
160
+ } );
161
+ } );
162
+
163
+ it( 'removes column with the remove button', async () => {
164
+ const screen = await initializeEditor( {
165
+ initialHtml: TWO_COLUMNS_BLOCK_HTML,
166
+ } );
167
+ const { getByA11yLabel } = screen;
168
+
169
+ // Get block
170
+ const columnsBlock = await getBlock( screen, 'Columns' );
171
+ fireEvent.press( columnsBlock );
172
+
173
+ // Get the first column
174
+ const firstColumnBlock = await getBlock( screen, 'Column' );
175
+ fireEvent.press( firstColumnBlock );
176
+
177
+ // Open block actions menu
178
+ const blockActionsButton = getByA11yLabel( /Open Block Actions Menu/ );
179
+ fireEvent.press( blockActionsButton );
180
+
181
+ // Delete block
182
+ const deleteButton = getByA11yLabel( /Remove block/ );
183
+ fireEvent.press( deleteButton );
184
+
185
+ expect( getEditorHtml() ).toMatchSnapshot();
186
+ } );
187
+
188
+ it( 'removes the only one left Column with the remove button', async () => {
189
+ const screen = await initializeEditor( {
190
+ initialHtml: TWO_COLUMNS_BLOCK_HTML,
191
+ } );
192
+ const { getByA11yLabel } = screen;
193
+
194
+ // Get block
195
+ const columnsBlock = await getBlock( screen, 'Columns' );
196
+ fireEvent.press( columnsBlock );
197
+
198
+ // Get the first column
199
+ const firstColumnBlock = await getBlock( screen, 'Column' );
200
+ fireEvent.press( firstColumnBlock );
201
+
202
+ // Open block actions menu
203
+ let blockActionsButton = getByA11yLabel( /Open Block Actions Menu/ );
204
+ fireEvent.press( blockActionsButton );
205
+
206
+ // Delete block
207
+ let deleteButton = getByA11yLabel( /Remove block/ );
208
+ fireEvent.press( deleteButton );
209
+
210
+ // Get the only left column
211
+ const lastColumnBlock = await getBlock( screen, 'Column' );
212
+ fireEvent.press( lastColumnBlock );
213
+
214
+ // Open block actions menu
215
+ blockActionsButton = getByA11yLabel( /Open Block Actions Menu/ );
216
+ fireEvent.press( blockActionsButton );
217
+
218
+ // Delete block
219
+ deleteButton = getByA11yLabel( /Remove block/ );
220
+ fireEvent.press( deleteButton );
221
+
222
+ expect( getEditorHtml() ).toMatchSnapshot();
223
+ } );
224
+
225
+ it( 'changes vertical alignment on Columns', async () => {
226
+ const screen = await initializeEditor( {
227
+ initialHtml: TWO_COLUMNS_BLOCK_HTML,
228
+ } );
229
+ const { getByA11yLabel } = screen;
230
+
231
+ // Get block
232
+ const columnsBlock = await getBlock( screen, 'Columns' );
233
+ fireEvent.press( columnsBlock );
234
+
235
+ // Open vertical alignment menu
236
+ const verticalAlignmentButton = getByA11yLabel(
237
+ /Change vertical alignment/
238
+ );
239
+ fireEvent.press( verticalAlignmentButton );
240
+
241
+ // Get Align top button
242
+ const verticalTopAlignmentButton = getByA11yLabel( /Align top/ );
243
+ fireEvent.press( verticalTopAlignmentButton );
244
+
245
+ expect( getEditorHtml() ).toMatchSnapshot();
246
+ } );
247
+
248
+ it( 'changes the vertical alignment on individual Column', async () => {
249
+ const screen = await initializeEditor( {
250
+ initialHtml: TWO_COLUMNS_BLOCK_HTML,
251
+ } );
252
+ const { getByA11yLabel } = screen;
253
+
254
+ // Get block
255
+ const columnsBlock = await getBlock( screen, 'Columns' );
256
+ fireEvent.press( columnsBlock );
257
+
258
+ // Open vertical alignment menu
259
+ const verticalAlignmentButton = getByA11yLabel(
260
+ /Change vertical alignment/
261
+ );
262
+ fireEvent.press( verticalAlignmentButton );
263
+
264
+ // Get Align top button
265
+ const verticalTopAlignmentButton = getByA11yLabel( /Align top/ );
266
+ fireEvent.press( verticalTopAlignmentButton );
267
+
268
+ // Get the first column
269
+ const firstColumnBlock = await getBlock( screen, 'Column' );
270
+ fireEvent.press( firstColumnBlock );
271
+
272
+ // Open vertical alignment menu
273
+ fireEvent.press( verticalAlignmentButton );
274
+
275
+ // Get Align bottom button
276
+ const verticalBottomAlignmentButton = getByA11yLabel( /Align bottom/ );
277
+ fireEvent.press( verticalBottomAlignmentButton );
278
+
279
+ expect( getEditorHtml() ).toMatchSnapshot();
280
+ } );
281
+
282
+ it( 'sets current vertical alignment on new Columns', async () => {
283
+ const screen = await initializeEditor( {
284
+ initialHtml: TWO_COLUMNS_BLOCK_HTML,
285
+ } );
286
+ const { getByA11yLabel } = screen;
287
+
288
+ // Get block
289
+ const columnsBlock = await getBlock( screen, 'Columns' );
290
+ fireEvent.press( columnsBlock );
291
+
292
+ // Open vertical alignment menu
293
+ const verticalAlignmentButton = getByA11yLabel(
294
+ /Change vertical alignment/
295
+ );
296
+ fireEvent.press( verticalAlignmentButton );
297
+
298
+ // Get Align top button
299
+ const verticalTopAlignmentButton = getByA11yLabel( /Align top/ );
300
+ fireEvent.press( verticalTopAlignmentButton );
301
+
302
+ // Add a new column
303
+ const appenderButton =
304
+ within( columnsBlock ).getByTestId( 'appender-button' );
305
+ fireEvent.press( appenderButton );
306
+
307
+ expect( getEditorHtml() ).toMatchSnapshot();
308
+ } );
309
+
310
+ describe( 'when using columns percentage mechanism', () => {
311
+ it( "updates the slider's input value", async () => {
312
+ const screen = await initializeEditor();
313
+ const { getByA11yLabel, getByTestId } = screen;
314
+
315
+ // Add block
316
+ await addBlock( screen, 'Columns' );
317
+
318
+ // Wait for the variations modal to be visible
319
+ await waitFor(
320
+ () => getByTestId( 'block-variation-modal' ).props.isVisible
321
+ );
322
+
323
+ // Select a column variation
324
+ const blockVariationModal = getByTestId( 'block-variation-modal' );
325
+ await waitFor( () => blockVariationModal.props.isVisible );
326
+ const threeColumnLayout =
327
+ within( blockVariationModal ).getByA11yLabel(
328
+ /33 \/ 33 \/ 33 block/
329
+ );
330
+ fireEvent.press( threeColumnLayout );
331
+
332
+ // Get the first column
333
+ const firstColumnBlock = await getBlock( screen, 'Column' );
334
+ fireEvent.press( firstColumnBlock );
335
+
336
+ // Open block settings
337
+ await openBlockSettings( screen );
338
+
339
+ // Get width control
340
+ const widthControl = getByA11yLabel( /Width. Value is/ );
341
+ fireEvent.press( within( widthControl ).getByText( '33.3' ) );
342
+ const widthTextInput =
343
+ within( widthControl ).getByDisplayValue( '33.3' );
344
+ fireEvent.changeText( widthTextInput, '55.55555' );
345
+
346
+ expect( getEditorHtml() ).toMatchSnapshot();
347
+ } );
348
+
349
+ it( 'sets custom values correctly', async () => {
350
+ const screen = await initializeEditor( {
351
+ initialHtml: TWO_COLUMNS_BLOCK_HTML,
352
+ } );
353
+ const { getByA11yLabel, getByTestId } = screen;
354
+
355
+ // Get block
356
+ const columnsBlock = await getBlock( screen, 'Columns' );
357
+ fireEvent.press( columnsBlock );
358
+
359
+ // Get the first column
360
+ const firstColumnBlock = await getBlock( screen, 'Column' );
361
+ fireEvent.press( firstColumnBlock );
362
+
363
+ // Open block settings
364
+ await openBlockSettings( screen );
365
+
366
+ // Set custom width value for the first column
367
+ let widthControl = getByA11yLabel( /Width. Value is/ );
368
+ fireEvent.press( within( widthControl ).getByText( '50' ) );
369
+ let widthTextInput =
370
+ within( widthControl ).getByDisplayValue( '50' );
371
+ fireEvent.changeText( widthTextInput, '90' );
372
+
373
+ // Dismiss settings
374
+ await dismissModal( getByTestId( 'block-settings-modal' ) );
375
+
376
+ // Get the Second column
377
+ const secondColumnBlock = await getBlock( screen, 'Column', {
378
+ rowIndex: 2,
379
+ } );
380
+ fireEvent.press( secondColumnBlock );
381
+
382
+ // Open block settings
383
+ await openBlockSettings( screen );
384
+
385
+ // Set custom width value for the second column
386
+ widthControl = getByA11yLabel( /Width. Value is/ );
387
+ fireEvent.press( within( widthControl ).getByText( '50' ) );
388
+ widthTextInput = within( widthControl ).getByDisplayValue( '50' );
389
+ fireEvent.changeText( widthTextInput, '55.5' );
390
+
391
+ expect( getEditorHtml() ).toMatchSnapshot();
392
+ } );
393
+ } );
394
+
395
+ describe( 'when using the columns layout picker', () => {
396
+ const testData = [
397
+ [ '100 block' ],
398
+ [ '50 / 50 block' ],
399
+ [ '33 / 66 block' ],
400
+ [ '66 / 33 block' ],
401
+ [ '33 / 33 / 33 block' ],
402
+ [ '25 / 50 / 25 block' ],
403
+ ];
404
+
405
+ test.each( testData )(
406
+ 'sets the predefined percentages for %s',
407
+ async ( layout ) => {
408
+ const screen = await initializeEditor();
409
+ const { getByTestId } = screen;
410
+
411
+ // Add block
412
+ await addBlock( screen, 'Columns' );
413
+
414
+ // Wait for the variations modal to be visible
415
+ await waitFor(
416
+ () => getByTestId( 'block-variation-modal' ).props.isVisible
417
+ );
418
+
419
+ // Select a column variation
420
+ const blockVariationModal = getByTestId(
421
+ 'block-variation-modal'
422
+ );
423
+ await waitFor( () => blockVariationModal.props.isVisible );
424
+ const columnLayout =
425
+ within( blockVariationModal ).getByA11yLabel( layout );
426
+ fireEvent.press( columnLayout );
427
+
428
+ expect( getEditorHtml() ).toMatchSnapshot();
429
+ }
430
+ );
431
+ } );
432
+ } );
@@ -57,7 +57,7 @@ export default function CommentsLegacy( {
57
57
  <div { ...blockProps }>
58
58
  <Warning actions={ actions }>
59
59
  { __(
60
- "Comments block: You're currently using the legacy version of the block. " +
60
+ 'Comments block: Youre currently using the legacy version of the block. ' +
61
61
  'The following is just a placeholder - the final styling will likely look different. ' +
62
62
  'For a better representation and more customization options, ' +
63
63
  'switch the block to its editable mode.'
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://schemas.wp.org/trunk/block.json",
3
3
  "apiVersion": 2,
4
4
  "name": "core/comments-pagination-next",
5
- "title": "Next Page",
5
+ "title": "Comments Next Page",
6
6
  "category": "theme",
7
7
  "parent": [ "core/comments-pagination" ],
8
8
  "description": "Displays the next comment's page link.",
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://schemas.wp.org/trunk/block.json",
3
3
  "apiVersion": 2,
4
4
  "name": "core/comments-pagination-numbers",
5
- "title": "Page Numbers",
5
+ "title": "Comments Page Numbers",
6
6
  "category": "theme",
7
7
  "parent": [ "core/comments-pagination" ],
8
8
  "description": "Displays a list of page numbers for comments pagination.",
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://schemas.wp.org/trunk/block.json",
3
3
  "apiVersion": 2,
4
4
  "name": "core/comments-pagination-previous",
5
- "title": "Previous Page",
5
+ "title": "Comments Previous Page",
6
6
  "category": "theme",
7
7
  "parent": [ "core/comments-pagination" ],
8
8
  "description": "Displays the previous comment's page link.",