diff --git a/tests/unit/CoreQuoteTest.php b/tests/unit/CoreQuoteTest.php index 7162a127..6024bf26 100644 --- a/tests/unit/CoreQuoteTest.php +++ b/tests/unit/CoreQuoteTest.php @@ -164,8 +164,6 @@ public function test_retrieve_core_quote_fields_and_attributes() { * - 'style' * - 'textColor' * - * @todo Use `wp_json_encode` for the 'style' attribute to improve accuracy in future tests. - * * @return void */ public function test_retrieve_core_quote_attributes() { @@ -207,6 +205,19 @@ public function test_retrieve_core_quote_attributes() { $this->assertEmpty( $block['parentClientId'], 'There should be no parentClientId' ); $this->assertNotEmpty( $block['renderedHtml'], 'The renderedHtml should be present' ); + $style = wp_json_encode( + [ + 'elements' => [ + 'heading' => [ + 'color' => [ + 'text' => 'var:preset|color|vivid-cyan-blue', + 'background' => 'var:preset|color|cyan-bluish-gray', + ], + ], + ], + ] + ); + // Verify the attributes. $this->assertEquals( [ @@ -218,8 +229,13 @@ public function test_retrieve_core_quote_attributes() { 'fontFamily' => 'body', 'fontSize' => 'small', 'gradient' => 'pale-ocean', - 'lock' => '{"move":true,"remove":true}', - 'style' => '{"elements":{"heading":{"color":{"text":"var:preset|color|vivid-cyan-blue","background":"var:preset|color|cyan-bluish-gray"}}}}', // @todo : use wp_json_encode here. + 'lock' => wp_json_encode( + [ + 'move' => true, + 'remove' => true, + ] + ), + 'style' => $style, 'textColor' => 'vivid-red', 'value' => '', ],