Last active
August 29, 2015 13:56
-
-
Save matgargano/8853478 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function __construct() { | |
add_action( 'admin_print_scripts-widgets.php', function(){ | |
if (is_admin()){ //test fails b/c the admin_print_scripts-widget.php is not aware that is_admin() is true... | |
wp_enqueue_style( 'spw-admin', plugins_url( 'css/' . 'spw-admin.min.css', dirname( __FILE__ ) ), false, 1 ); | |
wp_enqueue_script( 'spw-admin', plugins_url( 'javascripts/' . 'spw-admin.min.js', dirname( __FILE__ ) ), array( 'jquery' ), 1, true ); | |
} | |
} ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function testSpwScriptsLoaded() { | |
$this->assertFalse( wp_script_is( 'spw-admin' ) ); | |
do_action( 'admin_print_scripts-widgets.php' ); | |
$this->assertTrue( wp_script_is( 'spw-admin' ) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment