Skip to content

Commit

Permalink
Update remaining tests with inner markup.
Browse files Browse the repository at this point in the history
  • Loading branch information
jffng committed Sep 11, 2024
1 parent 9f43b73 commit b80e4eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions tests/CbtThemeLocale/escapeTextContentOfBlocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ public function data_test_escape_text_content_of_blocks() {
<!-- /wp:verse -->',
'expected_markup' =>
'<!-- wp:verse {"style":{"layout":{"selfStretch":"fit","flexSize":null}}} -->
<pre class="wp-block-verse"><?php esc_html_e(\'Ya somos el olvido que seremos.<br>El polvo elemental que nos ignora<br>y que fue el rojo Adán y que es ahora<br>todos los hombres, y que no veremos.\', \'test-locale-theme\');?></pre>
<!-- /wp:verse -->',
<pre class="wp-block-verse"><?php
/* Translators: %s are html tags */
echo sprintf( esc_html__( \'%sYa somos el olvido que seremos.%sEl polvo elemental que nos ignora%sque fue el rojo Adán y que es ahora%stodos los hombres, y que no veremos.%s\', \'test-locale-theme\' ), \'<br>\', \'<br>\', \'<br>\', \'<br>\', \'<br>\' ); ?></pre>
<!-- /wp:verse -->',
),

'button' => array(
Expand Down
4 changes: 2 additions & 2 deletions tests/test-theme-templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function test_properly_encode_html_markup() {
<!-- /wp:paragraph -->';
$escaped_template = CBT_Theme_Templates::escape_text_in_template( $template );

$this->assertStringContainsString( "<?php esc_html_e('<strong>Bold</strong> text has feelings &lt;&gt; TOO', '');?>", $escaped_template->content );
$this->assertStringContainsString( "<?php\n/* Translators: %s are html tags */\necho sprintf( esc_html__( '%sBold%s text has feelings &lt;&gt; TOO', '' ), '<strong>', '</strong>' ); ?>", $escaped_template->content );
}

public function test_empty_alt_text_is_not_localized() {
Expand Down Expand Up @@ -262,7 +262,7 @@ public function test_localize_verse() {
<pre class="wp-block-verse">Here is some <strong>verse</strong> to localize</pre>
<!-- /wp:verse -->';
$new_template = CBT_Theme_Templates::escape_text_in_template( $template );
$this->assertStringContainsString( "<?php esc_html_e('Here is some <strong>verse</strong> to localize', '');?>", $new_template->content );
$this->assertStringContainsString( "<?php\n/* Translators: %s are html tags */\necho sprintf( esc_html__( 'Here is some %sverse%s to localize', '' ), '<strong>', '</strong>' ); ?>", $new_template->content );
}

public function test_localize_table() {
Expand Down

0 comments on commit b80e4eb

Please sign in to comment.