Build/Test Tools: update PHPUnit tests after [48323]. Disable and keep the specific jQuery Migrate dependency tests for use in WP 5.6.
See #37110. git-svn-id: https://develop.svn.wordpress.org/trunk@48324 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ca54987591
commit
1c8ebd5da6
@ -21,6 +21,11 @@ class Tests_Dependencies_jQuery extends WP_UnitTestCase {
|
|||||||
|
|
||||||
$object = $scripts->query( 'jquery', 'registered' );
|
$object = $scripts->query( 'jquery', 'registered' );
|
||||||
$this->assertInstanceOf( '_WP_Dependency', $object );
|
$this->assertInstanceOf( '_WP_Dependency', $object );
|
||||||
|
|
||||||
|
// As of 5.5 jQuery 1.12.4 is loaded without Migrate 1.4.1.
|
||||||
|
// Disable, but keep the followint test for 5.6 when jQuery would be updated to 3.5.1+ and
|
||||||
|
// the latest Migrate will be used.
|
||||||
|
/*
|
||||||
$this->assertEqualSets( $object->deps, array_keys( $jquery_scripts ) );
|
$this->assertEqualSets( $object->deps, array_keys( $jquery_scripts ) );
|
||||||
foreach ( $object->deps as $dep ) {
|
foreach ( $object->deps as $dep ) {
|
||||||
$o = $scripts->query( $dep, 'registered' );
|
$o = $scripts->query( $dep, 'registered' );
|
||||||
@ -28,6 +33,7 @@ class Tests_Dependencies_jQuery extends WP_UnitTestCase {
|
|||||||
$this->assertTrue( isset( $jquery_scripts[ $dep ] ) );
|
$this->assertTrue( isset( $jquery_scripts[ $dep ] ) );
|
||||||
$this->assertEquals( $jquery_scripts[ $dep ], $o->src );
|
$this->assertEquals( $jquery_scripts[ $dep ], $o->src );
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_presence_of_jquery_no_conflict() {
|
function test_presence_of_jquery_no_conflict() {
|
||||||
@ -113,7 +119,8 @@ class Tests_Dependencies_jQuery extends WP_UnitTestCase {
|
|||||||
$scripts->add_data( $dep, 'group', 1 );
|
$scripts->add_data( $dep, 'group', 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->expectOutputRegex( '/^(?:<script[^>]+><\/script>\\n){2}$/' );
|
// Match only one script tag fopr 5.5, revert to `{2}` for 5.6.
|
||||||
|
$this->expectOutputRegex( '/^(?:<script[^>]+><\/script>\\n)$/' );
|
||||||
|
|
||||||
$scripts->do_items( false, 0 );
|
$scripts->do_items( false, 0 );
|
||||||
$this->assertNotContains( 'jquery', $scripts->done );
|
$this->assertNotContains( 'jquery', $scripts->done );
|
||||||
@ -122,7 +129,11 @@ class Tests_Dependencies_jQuery extends WP_UnitTestCase {
|
|||||||
|
|
||||||
$scripts->do_items( false, 1 );
|
$scripts->do_items( false, 1 );
|
||||||
$this->assertContains( 'jquery', $scripts->done );
|
$this->assertContains( 'jquery', $scripts->done );
|
||||||
|
|
||||||
|
// Disable for 5.5 but keep for use in 5.6. See test_location_of_jquery() above.
|
||||||
|
/*
|
||||||
$this->assertContains( 'jquery-core', $scripts->done, 'jquery-core in footer' );
|
$this->assertContains( 'jquery-core', $scripts->done, 'jquery-core in footer' );
|
||||||
$this->assertContains( 'jquery-migrate', $scripts->done, 'jquery-migrate in footer' );
|
$this->assertContains( 'jquery-migrate', $scripts->done, 'jquery-migrate in footer' );
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -632,7 +632,7 @@ JS;
|
|||||||
$wp_scripts->do_concat = true;
|
$wp_scripts->do_concat = true;
|
||||||
|
|
||||||
$ver = get_bloginfo( 'version' );
|
$ver = get_bloginfo( 'version' );
|
||||||
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate&ver={$ver}'></script>\n";
|
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery&ver={$ver}'></script>\n";
|
||||||
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
|
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
|
||||||
$expected .= "<script type='text/javascript' id='test-example-js-after'>\nconsole.log(\"after\");\n</script>\n";
|
$expected .= "<script type='text/javascript' id='test-example-js-after'>\nconsole.log(\"after\");\n</script>\n";
|
||||||
|
|
||||||
@ -657,7 +657,7 @@ JS;
|
|||||||
$wp_scripts->do_concat = true;
|
$wp_scripts->do_concat = true;
|
||||||
|
|
||||||
$ver = get_bloginfo( 'version' );
|
$ver = get_bloginfo( 'version' );
|
||||||
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate&ver={$ver}'></script>\n";
|
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery&ver={$ver}'></script>\n";
|
||||||
$expected .= "<!--[if gte IE 9]>\n";
|
$expected .= "<!--[if gte IE 9]>\n";
|
||||||
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
|
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
|
||||||
$expected .= "<script type='text/javascript' id='test-example-js-after'>\nconsole.log(\"after\");\n</script>\n";
|
$expected .= "<script type='text/javascript' id='test-example-js-after'>\nconsole.log(\"after\");\n</script>\n";
|
||||||
@ -686,7 +686,7 @@ JS;
|
|||||||
$wp_scripts->do_concat = true;
|
$wp_scripts->do_concat = true;
|
||||||
|
|
||||||
$ver = get_bloginfo( 'version' );
|
$ver = get_bloginfo( 'version' );
|
||||||
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate&ver={$ver}'></script>\n";
|
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery&ver={$ver}'></script>\n";
|
||||||
$expected .= "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\n</script>\n";
|
$expected .= "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\n</script>\n";
|
||||||
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
|
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
|
||||||
|
|
||||||
@ -712,7 +712,7 @@ JS;
|
|||||||
$wp_scripts->do_concat = true;
|
$wp_scripts->do_concat = true;
|
||||||
|
|
||||||
$ver = get_bloginfo( 'version' );
|
$ver = get_bloginfo( 'version' );
|
||||||
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate&ver={$ver}'></script>\n";
|
$expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery&ver={$ver}'></script>\n";
|
||||||
$expected .= "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\n</script>\n";
|
$expected .= "<script type='text/javascript' id='test-example-js-before'>\nconsole.log(\"before\");\n</script>\n";
|
||||||
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
|
$expected .= "<script type='text/javascript' src='http://example.com' id='test-example-js'></script>\n";
|
||||||
$expected .= "<script type='text/javascript' src='/wp-includes/js/dist/vendor/wp-polyfill.min.js' id='wp-polyfill-js'></script>\n";
|
$expected .= "<script type='text/javascript' src='/wp-includes/js/dist/vendor/wp-polyfill.min.js' id='wp-polyfill-js'></script>\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user