diff --git a/includes/apple-exporter/components/class-image.php b/includes/apple-exporter/components/class-image.php
index e0071dfc..8696d683 100644
--- a/includes/apple-exporter/components/class-image.php
+++ b/includes/apple-exporter/components/class-image.php
@@ -256,10 +256,7 @@ protected function build( $html ) {
$caption_regex = $is_cover_block ? '#
?\n(.*)#m' : '#(.*?)#ms';
if ( preg_match( $caption_regex, $html, $matches ) ) {
$caption = trim( $matches[1] );
- $values['#caption#'] = ! $is_cover_block ? $caption : [
- 'text' => $caption,
- 'format' => 'html',
- ];
+ $values['#caption#'] = $caption;
$values['#caption_text#'] = $caption;
$values = $this->group_component( $values['#caption#'], $values );
$spec_name = 'json-with-caption';
diff --git a/tests/apple-exporter/components/test-class-image.php b/tests/apple-exporter/components/test-class-image.php
index 178f99e7..c0e1fd6d 100644
--- a/tests/apple-exporter/components/test-class-image.php
+++ b/tests/apple-exporter/components/test-class-image.php
@@ -59,6 +59,64 @@ public function test_component_role() {
$this->assertEquals( 'image', $json['components'][1]['components'][3]['role'] );
}
+ /**
+ * Tests the process of transforming a Cover block into an image.
+ */
+ public function test_transform_cover() {
+ $featured_image = $this->get_new_attachment();
+ $image_id = $this->get_new_attachment();
+ $image_url = wp_get_attachment_image_url( $image_id, 'full' );
+ $post_content = <<
+
+
+HTML;
+ $post_id = self::factory()->post->create( [ 'post_content' => $post_content ] );
+ update_post_meta( $post_id, '_thumbnail_id', $featured_image );
+ $json = $this->get_json_for_post( $post_id );
+ $this->assertEquals(
+ [
+ 'role' => 'container',
+ 'components' => [
+ [
+ 'role' => 'photo',
+ 'URL' => $image_url,
+ 'layout' => 'full-width-image-with-caption',
+ 'caption' => [
+ 'format' => 'html',
+ 'text' => 'Testing cover block.
',
+ 'textStyle' => [
+ 'fontName' => 'AvenirNext-Italic',
+ ],
+ ],
+ ],
+ [
+ 'role' => 'caption',
+ 'text' => 'Testing cover block.
',
+ 'format' => 'html',
+ 'textStyle' => [
+ 'textAlignment' => 'left',
+ 'fontName' => 'AvenirNext-Italic',
+ 'fontSize' => 16,
+ 'tracking' => 0,
+ 'lineHeight' => 24,
+ 'textColor' => '#4f4f4f',
+ ],
+ 'layout' => [
+ 'margin' => [
+ 'bottom' => 25,
+ ],
+ ],
+ ],
+ ],
+ 'layout' => [],
+ ],
+ $json['components'][1]['components'][3]
+ );
+ }
+
/**
* Test Image component matching and JSON
* output with HTML markup for an image.