Make WordPress Core


Ignore:
Timestamp:
10/07/2020 04:31:53 PM (4 years ago)
Author:
azaozz
Message:

Update jQuery step two:

  • Add jquery-migrate.js v.3.3.1 to core and load it in debug mode when SCRIPT_DEBUG is true.
  • Add jquery.min.js, update jquery.js to 3.5.1 non-minified. This should help when debugging.
  • Rebuild jQuery UI 1.12.1 and add it to core.
  • Fix/adjust tests to match the above changes.

See #50564.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/dependencies/jquery.php

    r48939 r49101  
    1111        wp_default_scripts( $scripts );
    1212
    13         $jquery_scripts = array(
    14             'jquery-core' => '/wp-includes/js/jquery/jquery.js',
    15         );
    1613        if ( SCRIPT_DEBUG ) {
    17             $jquery_scripts['jquery-migrate'] = '/wp-includes/js/jquery/jquery-migrate.js';
     14            $jquery_scripts = array(
     15                'jquery-core'    => '/wp-includes/js/jquery/jquery.js',
     16                'jquery-migrate' => '/wp-includes/js/jquery/jquery-migrate.js',
     17            );
    1818        } else {
    19             $jquery_scripts['jquery-migrate'] = '/wp-includes/js/jquery/jquery-migrate.min.js';
     19            $jquery_scripts = array(
     20                'jquery-core'    => '/wp-includes/js/jquery/jquery.min.js',
     21                'jquery-migrate' => '/wp-includes/js/jquery/jquery-migrate.min.js',
     22            );
    2023        }
    2124
     
    2326        $this->assertInstanceOf( '_WP_Dependency', $object );
    2427
    25         // As of 5.5 jQuery 1.12.4 is loaded without Migrate 1.4.1.
    26         // Disable, but keep the following test for 5.6 when jQuery would be updated to 3.5.1+ and
    27         // the latest Migrate will be used.
    28         /*
     28        // The following test is disabled in WP 5.5 as jQuery 1.12.4 is loaded without jQuery Migrate 1.4.1,
     29        // and reenabled in 5.6 when jQuery 3.5.1 is loaded with jQuery Migrate 3.3.1.
    2930        $this->assertSameSets( $object->deps, array_keys( $jquery_scripts ) );
    3031        foreach ( $object->deps as $dep ) {
     
    3435            $this->assertSame( $jquery_scripts[ $dep ], $o->src );
    3536        }
    36         */
    3737    }
    3838
     
    121121
    122122        // Match only one script tag for 5.5, revert to `{2}` for 5.6.
    123         $this->expectOutputRegex( '/^(?:<script[^>]+><\/script>\\n){1}$/' );
     123        $this->expectOutputRegex( '/^(?:<script[^>]+><\/script>\\n){2}$/' );
    124124
    125125        $scripts->do_items( false, 0 );
     
    131131        $this->assertContains( 'jquery', $scripts->done );
    132132
    133         // Disable for 5.5 but keep for use in 5.6. See test_location_of_jquery() above.
    134         /*
     133        // The following test is disabled in WP 5.5 as jQuery 1.12.4 is loaded without jQuery Migrate 1.4.1,
     134        // and reenabled in 5.6 when jQuery 3.5.1 is loaded with Migrate 3.3.1.
    135135        $this->assertContains( 'jquery-core', $scripts->done, 'jquery-core in footer' );
    136136        $this->assertContains( 'jquery-migrate', $scripts->done, 'jquery-migrate in footer' );
    137         */
    138137    }
    139138}
Note: See TracChangeset for help on using the changeset viewer.