test(editor): Stabilize N8nPopover trigger clicks in unit tests (no-changelog) (#33978)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Charlie Kolb 2026-07-10 13:19:20 +02:00 committed by GitHub
parent b69cf1a54e
commit 56dd2bfb15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -47,8 +47,15 @@ vi.mock('reka-ui', async (importOriginal) => {
const context = inject<{ isOpen: { value: boolean }; setOpen: (v: boolean) => void }>(
POPOVER_OPEN_KEY,
);
// Capture phase avoids Vue's "event fired before listener attached" guard
// (`e._vts <= invoker.attached`), which flakily skips a bubble-phase onClick
// when a test renders and clicks within the same millisecond.
return () =>
h('div', { onClick: () => context?.setOpen(!context.isOpen.value) }, slots.default?.());
h(
'div',
{ onClickCapture: () => context?.setOpen(!context.isOpen.value) },
slots.default?.(),
);
},
}),
PopoverPortal: defineComponent({