初始化组件
const wrapper = shallowMount(Blank, { |
属性检查
const wrapper = mount(Button, { |
事件是否触发
const mockCallback = jest.fn() |
computed 验证
const wrapper: any = shallowMount(Button, { |
style 验证
const wrapper: any = shallowMount(Button, { |
多个元素的选取
list.forEach((v, i) => { |
emit 验证
const wrapper = shallowMount(CultureTabbar, { |
元素的存在性
expect( |
元素的可见性
expect(wrapper.find(".grade-wrapper-edit").isVisible()).toBe(true) |
主动触发事件
wrapper.trigger("click") |
路由触发
it("getMyConfirmed", async next => { |
图片引入
// 需要require后对比 |
主动调用 method
expect((wrapper.vm as any).cardType(p)).toBe("refuse"); |
slot 验证
const wrapper = shallowMount(Modal, { |