Skip to content

Commit a7299e4

Browse files
committed
Add failing test case
1 parent 600dbef commit a7299e4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/phpunit/tests/script-modules/wpScriptModules.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1829,6 +1829,25 @@ public function test_default_script_modules() {
18291829
);
18301830
}
18311831

1832+
/**
1833+
* Tests expected priority is used when a dependent is registered but not enqueued.
1834+
*
1835+
* @ticket 64429
1836+
*/
1837+
public function test_priority_of_dependency_for_non_enqueued_dependent() {
1838+
wp_default_script_modules();
1839+
wp_register_script_module( 'not-enqueued', 'https://example.com/not-enqueued.js', array( '@wordpress/a11y' ), null, array( 'priority' => 'high' ) );
1840+
wp_enqueue_script_module( '@wordpress/a11y' );
1841+
1842+
$actual_script_modules = $this->normalize_markup_for_snapshot( get_echo( array( wp_script_modules(), 'print_enqueued_script_modules' ) ) );
1843+
$this->assertEqualHTML(
1844+
'<script type="module" src="/wp-includes/js/dist/script-modules/a11y/index.min.js" id="@wordpress/a11y-js-module" fetchpriority="low"></script>',
1845+
$actual_script_modules,
1846+
'<body>',
1847+
"Snapshot:\n$actual_script_modules"
1848+
);
1849+
}
1850+
18321851
/**
18331852
* Tests that a dependent with high priority for default script modules with a low fetch priority are printed as expected.
18341853
*

0 commit comments

Comments
 (0)