WordPress.org

Make WordPress Core

Ticket #16024: 16024.unit-test.diff

File 16024.unit-test.diff, 1002 bytes (added by valendesigns, 4 years ago)
  • tests/phpunit/tests/dependencies/scripts.php

    diff --git tests/phpunit/tests/dependencies/scripts.php tests/phpunit/tests/dependencies/scripts.php
    index 3f4e724..18bdec3 100644
    class Tests_Dependencies_Scripts extends WP_UnitTestCase { 
    8484                // Cleanup
    8585                $wp_scripts->base_url = $base_url_backup;
    8686        }
     87
     88        /**
     89         * Test Conditional Comments
     90         * @ticket 10624
     91         */
     92        function test_wp_script_add_data() {
     93                global $wp_scripts;
     94
     95                // Enqueue & add conditional comments
     96                wp_enqueue_script( 'twentytwelve-html5', 'example.com', array(), '1.0' );
     97                $wp_scripts->add_data( 'twentytwelve-html5', 'conditional', 'lt IE 9' );
     98                $expected = "<!--[if lt IE 9]>\n<script type='text/javascript' src='http://example.com?ver=1.0'></script>\n<![endif]-->\n";
     99
     100                // Go!
     101                $this->assertEquals( $expected, get_echo( 'wp_print_scripts' ) );
     102
     103                // No scripts left to print
     104                $this->assertEquals( '', get_echo( 'wp_print_scripts' ) );
     105        }
    87106}