WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/20/2014 12:28:57 AM (6 years ago)
Author:
wonderboymusic
Message:

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.

File:
1 edited

Legend:

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

    r25785 r29252  
    7070        $this->assertFalse( strpos( $contents, 'sourceMappingURL' ), 'Presence of sourceMappingURL' );
    7171    }
     72
     73    /**
     74     * @ticket 28404
     75     */
     76    function test_wp_script_is_dep_enqueued() {
     77        wp_enqueue_script( 'jquery-ui-accordion' );
     78
     79        $this->assertTrue( wp_script_is( 'jquery', 'enqueued' ) );
     80        $this->assertFalse( wp_script_is( 'underscore', 'enqueued' ) );
     81
     82        unset( $GLOBALS['wp_scripts'] );
     83    }
    7284}
Note: See TracChangeset for help on using the changeset viewer.