Ticket #36392: 36392.2.patch
File 36392.2.patch, 2.6 KB (added by , 9 years ago) |
---|
-
src/wp-includes/class.wp-scripts.php
363 363 $tag = apply_filters( 'script_loader_tag', $tag, $handle, $src ); 364 364 365 365 if ( $this->do_concat ) { 366 if ( $ after_handle ) {366 if ( $before_handle ) { 367 367 $this->print_html_before .= $tag; 368 368 } else { 369 369 $this->print_html .= $tag; -
tests/phpunit/tests/dependencies/scripts.php
481 481 $print_scripts = get_echo( '_print_scripts' ); 482 482 483 483 $ver = get_bloginfo( 'version' ); 484 $expected = "<script type='text/javascript' src='/directory/two.js?ver={$ver}'></script>\n"; 484 $expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5B%5D=one,four&ver={$ver}'></script>\n"; 485 $expected .= "<script type='text/javascript' src='/directory/two.js?ver={$ver}'></script>\n"; 485 486 $expected .= "<script type='text/javascript'>\nconsole.log(\"after two\");\n</script>\n"; 486 487 $expected .= "<script type='text/javascript' src='/directory/three.js?ver={$ver}'></script>\n"; 487 488 $expected .= "<script type='text/javascript'>\nconsole.log(\"after three\");\n</script>\n"; 488 $expected .= "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5B%5D=one,four&ver={$ver}'></script>\n";489 489 490 490 $this->assertEquals( $expected, $print_scripts ); 491 491 } … … 520 520 $this->assertEquals( '', $wp_scripts->print_html ); 521 521 } 522 522 523 /** 524 * @ticket 36392 525 */ 526 public function test_wp_add_inline_script_concat_with_core_dependency() { 527 global $wp_scripts; 528 529 wp_default_scripts( $wp_scripts ); 530 531 $wp_scripts->base_url = ''; 532 $wp_scripts->do_concat = true; 533 534 $ver = get_bloginfo( 'version' ); 535 $expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate&ver={$ver}'></script>\n"; 536 $expected .= "<script type='text/javascript' src='http://example.com'></script>\n"; 537 $expected .= "<script type='text/javascript'>\nconsole.log(\"after\");\n</script>\n"; 538 539 wp_enqueue_script( 'test-example', 'http://example.com', array( 'jquery' ), null ); 540 wp_add_inline_script( 'test-example', 'console.log("after");' ); 541 542 wp_print_scripts(); 543 $print_scripts = get_echo( '_print_scripts' ); 544 545 $this->assertEquals( $expected, $print_scripts ); 546 } 523 547 }