You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: features/post-block.feature
+25-60Lines changed: 25 additions & 60 deletions
Original file line number
Diff line number
Diff line change
@@ -1083,9 +1083,9 @@ Feature: Manage blocks in post content
1083
1083
When I try `wp post block replace {POST_ID} core/image core/heading`
1084
1084
Then STDERR should contain:
1085
1085
"""
1086
-
No blocks of type 'core/image' found
1086
+
No blocks of type 'core/image' were found
1087
1087
"""
1088
-
And the return code should be 1
1088
+
And the return code should be 0
1089
1089
1090
1090
@require-wp-5.0
1091
1091
Scenario: Update with invalid attrs JSON
@@ -1113,7 +1113,7 @@ Feature: Manage blocks in post content
1113
1113
When I try `wp post block import {POST_ID} --file=bad-import.json`
1114
1114
Then STDERR should contain:
1115
1115
"""
1116
-
Invalid JSON
1116
+
Invalid block structure
1117
1117
"""
1118
1118
And the return code should be 1
1119
1119
@@ -1126,12 +1126,12 @@ Feature: Manage blocks in post content
1126
1126
When I run `wp post create --post_title='Page' --post_type=page --post_content='<!-- wp:heading --><h2>Page</h2><!-- /wp:heading -->' --post_status=publish --porcelain`
1127
1127
Then save STDOUT as {PAGE_ID}
1128
1128
1129
-
When I run `wp post block count --post-type=post`
1129
+
When I run `wp post block count {POST_ID} --post-type=post`
1130
1130
Then STDOUT should be a table containing rows:
1131
1131
| blockName | count | posts |
1132
1132
| core/paragraph | 1 | 1 |
1133
1133
1134
-
When I run `wp post block count --post-type=page`
1134
+
When I run `wp post block count {PAGE_ID} --post-type=page`
1135
1135
Then STDOUT should be a table containing rows:
1136
1136
| blockName | count | posts |
1137
1137
| core/heading | 1 | 1 |
@@ -1145,7 +1145,7 @@ Feature: Manage blocks in post content
1145
1145
When I run `wp post create --post_title='Draft' --post_content='<!-- wp:heading --><h2>Draft</h2><!-- /wp:heading -->' --post_status=draft --porcelain`
1146
1146
Then save STDOUT as {DRAFT_ID}
1147
1147
1148
-
When I run `wp post block count --post-status=draft`
1148
+
When I run `wp post block count {DRAFT_ID} --post-status=draft`
1149
1149
Then STDOUT should be a table containing rows:
1150
1150
| blockName | count | posts |
1151
1151
| core/heading | 1 | 1 |
@@ -1157,15 +1157,8 @@ Feature: Manage blocks in post content
1157
1157
@require-wp-5.0
1158
1158
Scenario: Post with mixed block and freeform content
When I run `wp post create --post_title='Mixed' --porcelain < mixed-content.txt`
1160
+
# Content with blocks and freeform text in between
1161
+
When I run `wp post create --post_title='Mixed' --post_content='<!-- wp:paragraph --><p>Block</p><!-- /wp:paragraph --><p>Some freeform text</p><!-- wp:heading --><h2>Title</h2><!-- /wp:heading -->' --porcelain`
1169
1162
Then save STDOUT as {POST_ID}
1170
1163
1171
1164
When I run `wp post has-blocks {POST_ID}`
@@ -1228,7 +1221,7 @@ Feature: Manage blocks in post content
1228
1221
When I run `wp post block render {POST_ID}`
1229
1222
Then STDOUT should contain:
1230
1223
"""
1231
-
<p>Inner</p>
1224
+
Inner</p>
1232
1225
"""
1233
1226
1234
1227
@require-wp-5.0
@@ -1312,20 +1305,12 @@ Feature: Manage blocks in post content
1312
1305
"""
1313
1306
1314
1307
@require-wp-5.0
1315
-
Scenario: Remove by index with whitespace between blocks
When I run `wp post create --post_title='Spaced' --porcelain < spaced-blocks.txt`
1337
+
When I run `wp post create --post_title='Three Blocks' --post_content='<!-- wp:paragraph --><p>First</p><!-- /wp:paragraph --><!-- wp:paragraph --><p>Second</p><!-- /wp:paragraph --><!-- wp:paragraph --><p>Third</p><!-- /wp:paragraph -->' --porcelain`
1361
1338
Then save STDOUT as {POST_ID}
1362
1339
1363
1340
# Indices 0 and 2 should be "First" and "Third"
@@ -1533,41 +1510,29 @@ Feature: Manage blocks in post content
1533
1510
| core/group | 2 |
1534
1511
| core/paragraph | 2 |
1535
1512
1536
-
@require-wp-5.0
1537
-
Scenario: Clone block to position before source
1538
-
Given a WP install
1539
-
When I run `wp post create --post_title='Test' --post_content='<!-- wp:paragraph --><p>First</p><!-- /wp:paragraph --><!-- wp:heading --><h2>Title</h2><!-- /wp:heading -->' --porcelain`
1540
-
Then save STDOUT as {POST_ID}
1541
-
1542
-
When I run `wp post block clone {POST_ID} 1 --position=before`
1543
-
Then STDOUT should contain:
1544
-
"""
1545
-
Success: Cloned block to index 1 in post {POST_ID}.
1546
-
"""
1547
-
1548
-
When I run `wp post block list {POST_ID} --format=count`
1549
-
Then STDOUT should be:
1550
-
"""
1551
-
3
1552
-
"""
1553
-
1554
1513
@require-wp-5.0
1555
1514
Scenario: Extract non-existent attribute
1556
1515
Given a WP install
1557
1516
When I run `wp post create --post_title='Test' --post_content='<!-- wp:paragraph --><p>Test</p><!-- /wp:paragraph -->' --porcelain`
1558
1517
Then save STDOUT as {POST_ID}
1559
1518
1560
-
When I run `wp post block extract {POST_ID} --block=core/paragraph --attr=nonexistent --format=ids`
1561
-
Then STDOUT should be empty
1519
+
When I try `wp post block extract {POST_ID} --block=core/paragraph --attr=nonexistent --format=ids`
1520
+
Then STDERR should contain:
1521
+
"""
1522
+
No values found
1523
+
"""
1562
1524
1563
1525
@require-wp-5.0
1564
1526
Scenario: Extract from non-existent block type
1565
1527
Given a WP install
1566
1528
When I run `wp post create --post_title='Test' --post_content='<!-- wp:paragraph --><p>Test</p><!-- /wp:paragraph -->' --porcelain`
1567
1529
Then save STDOUT as {POST_ID}
1568
1530
1569
-
When I run `wp post block extract {POST_ID} --block=core/image --attr=id --format=ids`
1570
-
Then STDOUT should be empty
1531
+
When I try `wp post block extract {POST_ID} --block=core/image --attr=id --format=ids`
0 commit comments