Changeset 53360
- Timestamp:
- 05/07/2022 02:51:54 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class.wp-scripts.php
r53283 r53360 311 311 $inline_script_tag = ''; 312 312 } 313 314 $translations_stop_concat = ! empty( $obj->textdomain ); 313 315 314 316 $translations = $this->print_translations( $handle, false ); … … 328 330 $srce = apply_filters( 'script_loader_src', $src, $handle ); 329 331 330 if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle || $translations ) ) {332 if ( $this->in_default_dir( $srce ) && ( $before_handle || $after_handle || $translations_stop_concat ) ) { 331 333 $this->do_concat = false; 332 334 -
trunk/tests/phpunit/tests/dependencies/scripts.php
r52937 r53360 1482 1482 ); 1483 1483 } 1484 1485 /** 1486 * @ticket 55628 1487 * @covers ::wp_set_script_translations 1488 */ 1489 public function test_wp_external_wp_i18n_print_order() { 1490 global $wp_scripts; 1491 1492 $wp_scripts->do_concat = true; 1493 $wp_scripts->default_dirs = array( '/default/' ); 1494 1495 // wp-i18n script in a non-default directory. 1496 wp_register_script( 'wp-i18n', '/plugins/wp-i18n.js', array(), null ); 1497 // Script in default dir that's going to be concatenated. 1498 wp_enqueue_script( 'jquery-core', '/default/jquery-core.js', array(), null ); 1499 // Script in default dir that depends on wp-i18n. 1500 wp_enqueue_script( 'common', '/default/common.js', array(), null ); 1501 wp_set_script_translations( 'common' ); 1502 1503 $print_scripts = get_echo( 1504 function() { 1505 wp_print_scripts(); 1506 _print_scripts(); 1507 } 1508 ); 1509 1510 // The non-default script should end concatenation and maintain order. 1511 $ver = get_bloginfo( 'version' ); 1512 $expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core&ver={$ver}'></script>\n"; 1513 $expected .= "<script type='text/javascript' src='/plugins/wp-i18n.js' id='wp-i18n-js'></script>\n"; 1514 $expected .= "<script type='text/javascript' src='/default/common.js' id='common-js'></script>\n"; 1515 1516 $this->assertSame( $expected, $print_scripts ); 1517 } 1484 1518 }
Note: See TracChangeset
for help on using the changeset viewer.