test(editor): reduce flaky in turbo renderer test (#11973)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Tests**
  - Improved test resource cleanup for the viewport turbo renderer, ensuring proper teardown after each test for more reliable and isolated test execution.
  - Enhanced stability by preventing errors during cleanup when certain elements or editors are absent.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
doodlewind
2025-04-25 00:11:22 +00:00
parent aae65d231c
commit a46f1a3adf
2 changed files with 8 additions and 4 deletions

View File

@@ -129,13 +129,13 @@ export async function setupEditor(
const appElement = await createEditor(collection, mode, extensions);
return () => {
appElement.remove();
appElement?.remove();
cleanup();
};
}
export function cleanup() {
window.editor.remove();
window.editor?.remove();
delete (window as any).collection;