当激活器被触发时,v-menu在内部使用一个转换来显示给定的元素。我们只是想测试一下菜单元素在激活器点击后是否显示出来。
在我们的设置中,我们使用Vue test Utils进行组件测试,并执行以下操作:
const wrapper = createWrapper(...)
expect(wrapper.contains('.my-class')).toBe(false) // the Element is not there in the beginning
clickTheTriggerElement(wrapper) // trigger v-menu to show