You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
641 B
19 lines
641 B
5 years ago
|
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)
|
||
|
})
|
||
|
})
|