mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-09-21 03:01:27 -03:00
fix(tests): deflake recipe modal resource item tests by disposing modal instances
RecipeModal instances keep fire-and-forget async chains (hydration re-renders, mark-hash-invalid re-renders, 500ms reconnect/restore re-renders) and deferred DOM wiring timers alive across tests. On slow CI runners these land in the next test's window and overwrite or re-wire the shared document.body with stale content and stale instance handlers, failing a different test on every run. Add a tracked-timer helper and a dispose() teardown hook to RecipeModal: pending deferred work is cancelled, in-flight async chains become no-ops after disposal, and the global click listener is detached. The test afterEach now disposes every modal instance, making the file hermetic.
This commit is contained in:
@@ -210,7 +210,11 @@ describe('RecipeModal resource item interactions', () => {
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
createdModals.forEach(recipeModal => recipeModal.cleanupNavigationShortcuts());
|
||||
// dispose() marks each modal instance dead: pending deferred timers
|
||||
// (wiring, 500ms reconnect re-renders) are cancelled and in-flight
|
||||
// async chains become no-ops, so nothing from this test can touch the
|
||||
// DOM of the next one.
|
||||
createdModals.forEach(recipeModal => recipeModal.dispose());
|
||||
createdModals.length = 0;
|
||||
document.body.innerHTML = '';
|
||||
delete global.modalManager;
|
||||
|
||||
Reference in New Issue
Block a user