diff --git a/src/components/forms/select/RuiMenuSelect.spec.ts b/src/components/forms/select/RuiMenuSelect.spec.ts index 0ae53922..3976681a 100644 --- a/src/components/forms/select/RuiMenuSelect.spec.ts +++ b/src/components/forms/select/RuiMenuSelect.spec.ts @@ -3,11 +3,20 @@ import { type ComponentMountingOptions, mount } from '@vue/test-utils'; import RuiMenuSelect from '@/components/forms/select/RuiMenuSelect.vue'; import { options } from '@/__test__/options'; +vi.spyOn(window, 'requestAnimationFrame').mockImplementation((cb) => { + const now = Date.now(); + cb(now); + return now; +}); + function createWrapper(options?: ComponentMountingOptions>) { const opts: ComponentMountingOptions> = { ...options, global: { - stubs: ['RuiProgress'], + stubs: { + RuiProgress: true, + TransitionGroup: false, + }, }, }; return mount(RuiMenuSelect, opts); diff --git a/src/components/overlays/menu/RuiMenu.vue b/src/components/overlays/menu/RuiMenu.vue index eaef98b6..c88754eb 100644 --- a/src/components/overlays/menu/RuiMenu.vue +++ b/src/components/overlays/menu/RuiMenu.vue @@ -81,9 +81,12 @@ const { width } = useElementSize(activator); const click = ref(false); -function onLeave() { +function onLeave(event?: KeyboardEvent) { + if (!get(open)) + return; onClose(); set(click, false); + event?.stopPropagation(); } function checkClick() { @@ -142,7 +145,7 @@ const { hasError, hasSuccess } = useFormTextDetail(