Skip to content

Commit

Permalink
Patch test_add_block_source_comments for Gutenberg 5.7 update
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed May 14, 2019
1 parent f887c26 commit 85b1f35
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/validation/test-class-amp-validation-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ public function get_block_data() {
'latest_posts' => array(
'<!-- wp:latest-posts {"postsToShow":1,"categories":""} /-->',
sprintf(
'<!--amp-source-stack {"block_name":"core\/latest-posts","post_id":{{post_id}},"block_content_index":0,"block_attrs":{"postsToShow":1,"categories":""},"type":"%1$s","name":"%2$s","function":"%3$s"}--><ul class="wp-block-latest-posts"><li><a href="{{url}}">{{title}}</a></li></ul><!--/amp-source-stack {"block_name":"core\/latest-posts","post_id":{{post_id}},"block_attrs":{"postsToShow":1,"categories":""},"type":"%1$s","name":"%2$s","function":"%3$s"}-->',
'<!--amp-source-stack {"block_name":"core\/latest-posts","post_id":{{post_id}},"block_content_index":0,"block_attrs":{"postsToShow":1,"categories":""},"type":"%1$s","name":"%2$s","function":"%3$s"}--><ul class="wp-block-latest-posts wp-block-latest-posts__list"><li><a href="{{url}}">{{title}}</a></li></ul><!--/amp-source-stack {"block_name":"core\/latest-posts","post_id":{{post_id}},"block_attrs":{"postsToShow":1,"categories":""},"type":"%1$s","name":"%2$s","function":"%3$s"}-->',
$is_gutenberg ? 'plugin' : 'core',
$is_gutenberg ? 'gutenberg' : 'wp-includes',
$latest_posts_block->render_callback
Expand Down Expand Up @@ -788,6 +788,14 @@ public function test_add_block_source_comments( $content, $expected, $query ) {
),
$expected
);

// Temporary patch to support running unit tests in Gutenberg<5.7.0.
$expected = str_replace(
'class="wp-block-latest-posts"',
'class="wp-block-latest-posts wp-block-latest-posts__list"',
$expected
);

$this->assertEquals(
preg_replace( '/(?<=>)\s+(?=<)/', '', str_replace( '%d', $post->ID, $expected ) ),
preg_replace( '/(?<=>)\s+(?=<)/', '', $rendered_block )
Expand Down

0 comments on commit 85b1f35

Please sign in to comment.