diff --git a/Gruntfile.js b/Gruntfile.js index 41c3edd2a856..a27fc2b735a5 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -171,7 +171,6 @@ module.exports = function(grunt) { [ WORKING_DIR + 'wp-includes/js/jquery/jquery-migrate.js' ]: [ './node_modules/jquery-migrate/dist/jquery-migrate.js' ], [ WORKING_DIR + 'wp-includes/js/jquery/jquery-migrate.min.js' ]: [ './node_modules/jquery-migrate/dist/jquery-migrate.min.js' ], [ WORKING_DIR + 'wp-includes/js/jquery/jquery.form.js' ]: [ './node_modules/jquery-form/src/jquery.form.js' ], - [ WORKING_DIR + 'wp-includes/js/jquery/jquery.form.min.js' ]: [ './node_modules/jquery-form/dist/jquery.form.min.js' ], [ WORKING_DIR + 'wp-includes/js/jquery/jquery.js' ]: [ './node_modules/jquery/dist/jquery.min.js' ], [ WORKING_DIR + 'wp-includes/js/masonry.min.js' ]: [ './node_modules/masonry-layout/dist/masonry.pkgd.min.js' ], [ WORKING_DIR + 'wp-includes/js/twemoji.js' ]: [ './node_modules/twemoji/2/twemoji.js' ], @@ -720,6 +719,10 @@ module.exports = function(grunt) { src: WORKING_DIR + 'wp-includes/js/imgareaselect/jquery.imgareaselect.js', dest: WORKING_DIR + 'wp-includes/js/imgareaselect/jquery.imgareaselect.min.js' }, + jqueryform: { + src: WORKING_DIR + 'wp-includes/js/jquery/jquery.form.js', + dest: WORKING_DIR + 'wp-includes/js/jquery/jquery.form.min.js' + }, dynamic: { expand: true, cwd: WORKING_DIR, @@ -1193,6 +1196,7 @@ module.exports = function(grunt) { 'webpack:prod', 'jshint:corejs', 'uglify:imgareaselect', + 'uglify:jqueryform', 'qunit:compiled' ] ); @@ -1332,7 +1336,8 @@ module.exports = function(grunt) { 'uglify:core', 'uglify:embed', 'uglify:jqueryui', - 'uglify:imgareaselect' + 'uglify:imgareaselect', + 'uglify:jqueryform' ] ); grunt.registerTask( 'build:js', [ diff --git a/tests/phpunit/tests/dependencies/backbonejs.php b/tests/phpunit/tests/dependencies/backbonejs.php deleted file mode 100644 index 4c276ad89849..000000000000 --- a/tests/phpunit/tests/dependencies/backbonejs.php +++ /dev/null @@ -1,15 +0,0 @@ -assertFileExists( $file ); - $contents = trim( file_get_contents( $file ) ); - $this->assertFalse( strpos( $contents, 'sourceMappingURL' ), 'Presence of sourceMappingURL' ); - } -} diff --git a/tests/phpunit/tests/dependencies/jquery.php b/tests/phpunit/tests/dependencies/jquery.php index 8f8bc7e1f041..30ea876e2f5d 100644 --- a/tests/phpunit/tests/dependencies/jquery.php +++ b/tests/phpunit/tests/dependencies/jquery.php @@ -82,14 +82,6 @@ function test_dont_allow_deregister_core_scripts_in_admin() { set_current_screen( 'front' ); } - /** - * @ticket 24994 - */ - function test_exclusion_of_sourcemaps() { - $contents = trim( file_get_contents( ABSPATH . WPINC . '/js/jquery/jquery.js' ) ); - $this->assertFalse( strpos( $contents, 'sourceMappingURL' ), 'Presence of sourceMappingURL' ); - } - /** * @ticket 28404 */ diff --git a/tests/phpunit/tests/dependencies/scripts.php b/tests/phpunit/tests/dependencies/scripts.php index b1e8e6c8f80d..dd6ca40f3179 100644 --- a/tests/phpunit/tests/dependencies/scripts.php +++ b/tests/phpunit/tests/dependencies/scripts.php @@ -1341,4 +1341,16 @@ public function test_wp_enqueue_code_editor_when_simple_array_will_be_passed() { array_keys( $wp_enqueue_code_editor['htmlhint'] ) ); } + + function test_no_source_mapping() { + $all_files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( dirname( ABSPATH ) . '/build/' ) ); + $js_files = new RegexIterator( $all_files, '/\.js$/' ); + foreach( $js_files as $js_file ) { + $contents = trim( file_get_contents( $js_file ) ); + + // We allow data: URLs. + $found = preg_match( '/sourceMappingURL=((?!data:).)/', $contents ); + $this->assertSame( $found, 0, "sourceMappingURL found in $js_file" ); + } + } }