Skip to content

Commit a48d5aa

Browse files
committed
Add test for no sourceURL when display is false
1 parent 9d9c903 commit a48d5aa

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/phpunit/tests/dependencies/scripts.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4075,4 +4075,22 @@ public function test_source_url_with_concat() {
40754075

40764076
$this->assertEqualHTML( $expected, $print_scripts );
40774077
}
4078+
4079+
/**
4080+
* Ensure that `::print_translations()` does not include the sourceURL comment when `$display` is false.
4081+
*
4082+
* @ticket 63887
4083+
* @covers ::print_translations
4084+
*/
4085+
public function test_print_translations_no_display_no_sourceurl() {
4086+
global $wp_scripts;
4087+
$this->add_html5_script_theme_support();
4088+
4089+
wp_register_script( 'wp-i18n', '/wp-includes/js/dist/wp-i18n.js', array(), null );
4090+
wp_enqueue_script( 'test-example', '/wp-includes/js/script.js', array(), null );
4091+
wp_set_script_translations( 'test-example', 'default', DIR_TESTDATA . '/languages' );
4092+
4093+
$translations_script_data = $wp_scripts->print_translations( 'test-example', false );
4094+
$this->assertStringNotContainsStringIgnoringCase( 'sourceURL=', $translations_script_data );
4095+
}
40784096
}

0 commit comments

Comments
 (0)