Changeset 57492 for trunk/tests/phpunit/tests/dependencies/scripts.php
- Timestamp:
- 01/31/2024 08:29:18 AM (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/dependencies/scripts.php
r57244 r57492 3103 3103 $this->assertEqualSets( $expected_in_footer, wp_scripts()->in_footer, 'Expected to have the same handles for in_footer.' ); 3104 3104 $this->assertEquals( $expected_groups, wp_scripts()->groups, 'Expected groups to match.' ); 3105 } 3106 3107 /** 3108 * Test that get_script_polyfill() returns the correct polyfill. 3109 * 3110 * @ticket 60348 3111 * 3112 * @covers ::wp_get_script_polyfill 3113 * 3114 * @global WP_Scripts $wp_scripts WP_Scripts instance. 3115 */ 3116 public function test_wp_get_script_polyfill() { 3117 global $wp_scripts; 3118 $script_name = 'wp-polyfill-importmap'; 3119 $test_script = 'HTMLScriptElement.supports && HTMLScriptElement.supports("importmap")'; 3120 $script_url = 'https://example.com/wp-polyfill-importmap.js'; 3121 wp_register_script( $script_name, $script_url ); 3122 3123 $polyfill = wp_get_script_polyfill( 3124 $wp_scripts, 3125 array( 3126 $test_script => $script_name, 3127 ) 3128 ); 3129 3130 wp_deregister_script( $script_name ); 3131 3132 $expected = '( ' . $test_script . ' ) || document.write( \'<script src="' . $script_url . '"></scr\' + \'ipt>\' );'; 3133 3134 $this->assertEquals( $expected, $polyfill ); 3105 3135 } 3106 3136
Note: See TracChangeset
for help on using the changeset viewer.