wp_script_is( ..., 'enqueued' ) needs to check dependencies recursively - a single item's dependencies may only be a subset of the full dependency tree. Adds a new method on WP_Dependencies called ->recurse_deps().

Adds unit test.

Props wonderboymusic, SergeyBiryukov, mikejolley.
Fixes #28404.


git-svn-id: https://develop.svn.wordpress.org/trunk@29252 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2014-07-20 00:28:57 +00:00
parent 36e455d018
commit 77ee35c4eb
2 changed files with 41 additions and 1 deletions

View File

@@ -69,4 +69,16 @@ class Tests_Dependencies_jQuery extends WP_UnitTestCase {
$contents = trim( file_get_contents( ABSPATH . WPINC . '/js/jquery/jquery.js' ) );
$this->assertFalse( strpos( $contents, 'sourceMappingURL' ), 'Presence of sourceMappingURL' );
}
/**
* @ticket 28404
*/
function test_wp_script_is_dep_enqueued() {
wp_enqueue_script( 'jquery-ui-accordion' );
$this->assertTrue( wp_script_is( 'jquery', 'enqueued' ) );
$this->assertFalse( wp_script_is( 'underscore', 'enqueued' ) );
unset( $GLOBALS['wp_scripts'] );
}
}