- Timestamp:
- 01/31/2024 08:29:18 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/script-modules/wpScriptModules.php
r57345 r57492 12 12 * @coversDefaultClass WP_Script_Modules 13 13 */ 14 class Tests_WP_Script_Modules extends WP_UnitTestCase { 14 class Tests_Script_Modules_WpScriptModules extends WP_UnitTestCase { 15 15 16 /** 16 17 * Instance of WP_Script_Modules. … … 25 26 public function set_up() { 26 27 parent::set_up(); 28 // Set up the WP_Script_Modules instance. 27 29 $this->script_modules = new WP_Script_Modules(); 28 30 } … … 601 603 $this->assertStringStartsWith( '/dep.js', $import_map['dep'] ); 602 604 } 605 606 /** 607 * @ticket 60348 608 * 609 * @covers ::print_import_map_polyfill() 610 */ 611 public function test_wp_print_import_map_has_no_polyfill_when_no_modules_registered() { 612 $import_map_polyfill = get_echo( array( $this->script_modules, 'print_import_map' ) ); 613 614 $this->assertEquals( '', $import_map_polyfill ); 615 } 616 617 /** 618 * @ticket 60348 619 * 620 * @covers ::print_import_map_polyfill() 621 */ 622 public function test_wp_print_import_map_has_polyfill_when_modules_registered() { 623 $script_name = 'wp-polyfill-importmap'; 624 wp_register_script( $script_name, '/wp-polyfill-importmap.js' ); 625 626 $this->script_modules->enqueue( 'foo', '/foo.js', array( 'dep' ), '1.0' ); 627 $this->script_modules->register( 'dep', '/dep.js' ); 628 $import_map_polyfill = get_echo( array( $this->script_modules, 'print_import_map' ) ); 629 630 wp_deregister_script( $script_name ); 631 632 $p = new WP_HTML_Tag_Processor( $import_map_polyfill ); 633 $p->next_tag( array( 'tag' => 'SCRIPT' ) ); 634 $id = $p->get_attribute( 'id' ); 635 636 $this->assertEquals( 'wp-load-polyfill-importmap', $id ); 637 } 603 638 }
Note: See TracChangeset
for help on using the changeset viewer.