Ticket #45066: 45066.8.diff
File 45066.8.diff, 6.4 KB (added by , 5 years ago) |
---|
-
src/wp-admin/includes/update-core.php
785 785 // 5.1 786 786 'wp-includes/random_compat/random_bytes_openssl.php', 787 787 'wp-includes/js/tinymce/wp-tinymce.js.gz', 788 // 5.3 789 'wp-includes/js/wp-a11y.js', // Moved to: wp-includes/js/dist/a11y.js 790 'wp-includes/js/wp-a11y.min.js', // Moved to: wp-includes/js/dist/a11y.min.js 788 791 ); 789 792 790 793 /** -
src/wp-includes/script-loader.php
879 879 ) 880 880 ); 881 881 882 $scripts->add( 'wp-a11y', "/wp-includes/js/wp-a11y$suffix.js", array( 'jquery' ), false, 1 );883 884 882 $scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 ); 885 883 886 884 $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", array(), false, 1 ); -
tests/phpunit/tests/dependencies/scripts.php
687 687 global $wp_scripts; 688 688 689 689 wp_default_scripts( $wp_scripts ); 690 wp_default_packages( $wp_scripts ); 690 691 691 692 $wp_scripts->base_url = ''; 692 693 $wp_scripts->do_concat = true; 693 694 694 695 $ver = get_bloginfo( 'version' ); 695 $expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate,wp-a11y&ver={$ver}'></script>\n"; 696 697 $expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate&ver={$ver}'></script>\n"; 696 698 $expected .= "<script type='text/javascript'>\nconsole.log(\"before\");\n</script>\n"; 697 $expected .= "<script type='text/javascript' src='http://example.com'></script>\n"; 698 $expected .= "<script type='text/javascript' src='http://example2.com'></script>\n"; 699 $expected .= "<script type='text/javascript' src='http://example.org'></script>\n"; 700 $expected .= "<script type='text/javascript' src='/wp-includes/js/dist/vendor/wp-polyfill.min.js'></script>\n"; 701 $expected .= "<script type='text/javascript'>\n"; 702 $expected .= "( 'fetch' in window ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-fetch.min.js\"></scr' + 'ipt>' );( document.contains ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-node-contains.min.js\"></scr' + 'ipt>' );( window.FormData && window.FormData.prototype.keys ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-formdata.min.js\"></scr' + 'ipt>' );( Element.prototype.matches && Element.prototype.closest ) || document.write( '<script src=\"http://example.org/wp-includes/js/dist/vendor/wp-polyfill-element-closest.min.js\"></scr' + 'ipt>' );\n"; 703 $expected .= "</script>\n"; 704 $expected .= "<script type='text/javascript' src='/wp-includes/js/dist/dom-ready.min.js'></script>\n"; 705 $expected .= "<script type='text/javascript' src='/wp-includes/js/dist/a11y.min.js'></script>\n"; 706 $expected .= "<script type='text/javascript' src='http://example2.org'></script>\n"; 699 707 $expected .= "<script type='text/javascript'>\nconsole.log(\"after\");\n</script>\n"; 700 708 701 wp_enqueue_script( 'test-example', 'http://example. com', array( 'jquery' ), null );709 wp_enqueue_script( 'test-example', 'http://example.org', array( 'jquery' ), null ); 702 710 wp_add_inline_script( 'test-example', 'console.log("before");', 'before' ); 703 wp_enqueue_script( 'test-example2', 'http://example2. com', array( 'wp-a11y' ), null );711 wp_enqueue_script( 'test-example2', 'http://example2.org', array( 'wp-a11y' ), null ); 704 712 wp_add_inline_script( 'test-example2', 'console.log("after");', 'after' ); 705 713 714 // Open a buffer to get the output of `wp_print_scripts`. 715 ob_start(); 706 716 wp_print_scripts(); 707 $print_scripts = get_echo( '_print_scripts');717 $print_scripts = ob_get_clean(); 708 718 719 // We've replaced wp-a11y.js with @wordpress/a11y package (see 45066) 720 // and `wp-polyfill` is now a dependency of the packaged wp-a11y. 721 // The packaged scipts contain various version numbers, which are 722 // not exposed, so we will remove all version args from the output. 723 $print_scripts = preg_replace( 724 '~js\?ver=([^"\']*)~', // Matches `js?ver=X.X.X` and everything to single or double quote. 725 'js', // The replacement, `js` without the version arg. 726 $print_scripts // Printed scripts. 727 ); 728 729 // Check if expected and printed scripts are equal. 709 730 $this->assertEquals( $expected, $print_scripts ); 710 731 } 711 732 … … 716 737 global $wp_scripts; 717 738 718 739 wp_default_scripts( $wp_scripts ); 740 wp_default_packages( $wp_scripts ); 719 741 720 742 $wp_scripts->base_url = ''; 721 743 $wp_scripts->do_concat = true; 722 744 723 $expected_tail = "<![endif]-->\n"; 724 $expected_tail .= "<script type='text/javascript' src='/customize-dependency.js'></script>\n"; 745 $expected_tail = "<script type='text/javascript' src='/customize-dependency.js'></script>\n"; 725 746 $expected_tail .= "<script type='text/javascript'>\n"; 726 747 $expected_tail .= "tryCustomizeDependency()\n"; 727 748 $expected_tail .= "</script>\n"; … … 730 751 wp_enqueue_script( $handle, '/customize-dependency.js', array( 'customize-controls' ), null ); 731 752 wp_add_inline_script( $handle, 'tryCustomizeDependency()' ); 732 753 754 // Open a buffer to get the output of `wp_print_scripts`. 755 ob_start(); 733 756 wp_print_scripts(); 734 $print_scripts = get_echo( '_print_scripts');757 $print_scripts = ob_get_clean(); 735 758 736 $tail = substr( $print_scripts, strrpos( $print_scripts, '<![endif]-->') );759 $tail = substr( $print_scripts, strrpos( $print_scripts, "<script type='text/javascript' src='/customize-dependency.js'>" ) ); 737 760 $this->assertEquals( $expected_tail, $tail ); 738 761 } 739 762 -
tests/qunit/index.html
24 24 }; 25 25 </script> 26 26 <script src="../../build/wp-includes/js/wp-util.js"></script> 27 <script src="../../build/wp-includes/js/ wp-a11y.js"></script>27 <script src="../../build/wp-includes/js/dist/a11y.js"></script> 28 28 <script> 29 29 window._wpMediaModelsL10n = {"settings":{"ajaxurl":"\/wp-admin\/admin-ajax.php","post":{"id":0}}}; 30 30 </script>