diff --git a/js/blocks/loader/attributes.js b/js/blocks/loader/attributes.js index 6ab6ccaae..eefc499d9 100644 --- a/js/blocks/loader/attributes.js +++ b/js/blocks/loader/attributes.js @@ -1,7 +1,7 @@ /** * Gets the attributes for a block, based on given fields. * - * @param {Object} fields The fields to get the attributes from. + * @param {Object} fields The fields to get the attributes from. * @return {Object} attributes The attributes for the fields. */ const getBlockAttributes = ( fields ) => { diff --git a/php/post-types/class-block-post.php b/php/post-types/class-block-post.php index 12b06b69a..8156529fa 100644 --- a/php/post-types/class-block-post.php +++ b/php/post-types/class-block-post.php @@ -338,7 +338,7 @@ public function add_meta_boxes() { 'default' ); - if ( isset( $post->post_name ) && ! empty( $post->post_name ) ) { + if ( ! empty( $post->post_name ) ) { $locations = block_lab()->get_template_locations( $post->post_name ); $template = block_lab()->locate_template( $locations, '', true ); diff --git a/tests/php/integration/fixtures/repeater-all-fields.php b/tests/php/integration/fixtures/repeater-all-fields.php index 4020deb0b..182260bce 100644 --- a/tests/php/integration/fixtures/repeater-all-fields.php +++ b/tests/php/integration/fixtures/repeater-all-fields.php @@ -29,8 +29,14 @@ diff --git a/tests/php/integration/test-repeater-template-output.php b/tests/php/integration/test-repeater-template-output.php index 210f2ceb3..f965e0156 100644 --- a/tests/php/integration/test-repeater-template-output.php +++ b/tests/php/integration/test-repeater-template-output.php @@ -181,6 +181,14 @@ public function get_block_config() { * This has a repeater with 2 rows, and tests every possible field. * It sets mock block attributes, like those that would be saved from a block. * Then, it loads the mock template in the theme's blocks/ directory and asserts the values. + * + * @covers \block_rows() + * @covers \block_row() + * @covers \reset_block_row() + * @covers \block_row_field() + * @covers \block_row_value() + * @covers \block_row_index() + * @covers \block_row_count() */ public function test_repeater_template() { $block = new Blocks\Block(); @@ -189,12 +197,32 @@ public function test_repeater_template() { $actual_template = str_replace( array( "\t", "\n" ), '', $rendered_template ); $rows = $this->attributes[ self::REPEATER_FIELD_NAME ]['rows']; + $this->assertContains( + sprintf( + 'block_row_count() returns %d', + count( $rows ) + ), + $actual_template + ); + // The 'className' should be present. $this->assertContains( sprintf( '