28 lines
1.2 KiB
JavaScript
28 lines
1.2 KiB
JavaScript
|
// +----------------------------------------------------------------------
|
|||
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
// | Author: CRMEB Team <admin@crmeb.com>
|
|||
|
// +----------------------------------------------------------------------
|
|||
|
import { shallowMount } from '@vue/test-utils'
|
|||
|
import Hamburger from '@/components/hamBurger/index.vue'
|
|||
|
describe('Hamburger.vue', () => {
|
|||
|
it('toggle click', () => {
|
|||
|
const wrapper = shallowMount(Hamburger)
|
|||
|
const mockFn = jest.fn()
|
|||
|
wrapper.vm.$on('toggleClick', mockFn)
|
|||
|
wrapper.find('.hamburger').trigger('click')
|
|||
|
expect(mockFn).toBeCalled()
|
|||
|
})
|
|||
|
it('prop isActive', () => {
|
|||
|
const wrapper = shallowMount(Hamburger)
|
|||
|
wrapper.setProps({ isActive: true })
|
|||
|
expect(wrapper.contains('.is-active')).toBe(true)
|
|||
|
wrapper.setProps({ isActive: false })
|
|||
|
expect(wrapper.contains('.is-active')).toBe(false)
|
|||
|
})
|
|||
|
})
|