You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote three use cases for VMenu; they all work, but the third one (with activator="parent") cannot be tested in the unit test script. The other two are fine, but I really need the third solution.
Here's my code (also in VPlay):
<!-- first --><VMenuv-model="show"><template#default><divclass="menu-content">Menu Content</div></template></VMenu><VBtn@mouseenter="show = true" @mouseleave="show = false">
Open Menu
</VBtn><!-- second --><VMenu:open-on-hover="true"><template#activator="{ props }"><VBtnv-bind="props">Open Menu</VBtn></template><template#default><divclass="menu-content">Menu Content</div></template></VMenu><!-- third --><VBtn>
Open Menu
<VMenu:open-on-hover="true" activator="parent"><template#default><divclass="menu-content">Menu Content</div></template></VMenu></VBtn>
And here's my unit test:
import{mount}from'@vue/test-utils';import{VMenu,VBtn}from'vuetify/components';importPopupMenufrom'../PopupMenu.vue';import{createVuetify}from'vuetify';import{nextTick}from'vue';// Create a Vuetify instanceconstvuetify=createVuetify();describe('VMenu',()=>{it('renders menu content when open',async()=>{constwrapper=mount(PopupMenu,{global: {plugins: [vuetify],},});// Find and trigger the activator buttonawaitwrapper.findComponent(VBtn).trigger('mouseenter');// Wait for the menu to be visibleawaitnextTick();awaitnewPromise((resolve)=>setTimeout(resolve,1000));// Check if the menu content is rendered in the document body// Third solution will fail hereconstmenuContent=document.querySelector('.menu-content');expect(menuContent).not.toBeNull();expect(menuContent.textContent).toBe('Menu Content');});});
Expected Behavior
When use activator="parent", there should be some way to write the unit to verify it
Environment
Vuetify Version: 3.6.10
Vue Version: 3.4.29
Browsers: Chrome 128.0.0.0
OS: Windows 10
Steps to reproduce
I wrote three use cases for
VMenu
; they all work, but the third one (withactivator="parent"
) cannot be tested in the unit test script. The other two are fine, but I really need the third solution.Here's my code (also in VPlay):
And here's my unit test:
Expected Behavior
When use activator="parent", there should be some way to write the unit to verify it
Actual Behavior
Unit test can't pass, don't know why
Reproduction Link
https://play.vuetifyjs.com/#...
The text was updated successfully, but these errors were encountered: