WordPress.org

Make WordPress Core

Ticket #16024: 16024.unit-test.2.diff

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

    diff --git tests/phpunit/tests/dependencies/scripts.php tests/phpunit/tests/dependencies/scripts.php
    index 3f4e724..783cf00 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                // Enqueue & add conditional comments
     94                wp_enqueue_script( 'twentytwelve-html5', 'example.com', array(), '1.0' );
     95                wp_script_add_data( 'twentytwelve-html5', 'conditional', 'lt IE 9' );
     96                $expected = "<!--[if lt IE 9]>\n<script type='text/javascript' src='http://example.com?ver=1.0'></script>\n<![endif]-->\n";
     97
     98                // Go!
     99                $this->assertEquals( $expected, get_echo( 'wp_print_scripts' ) );
     100
     101                // No scripts left to print
     102                $this->assertEquals( '', get_echo( 'wp_print_scripts' ) );
     103        }
    87104}