天波用户运营管理后台系统
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.

Hamburger.spec.js 641B

3 yıl önce
123456789101112131415161718
  1. import { shallowMount } from '@vue/test-utils'
  2. import Hamburger from '@/components/Hamburger/index.vue'
  3. describe('Hamburger.vue', () => {
  4. it('toggle click', () => {
  5. const wrapper = shallowMount(Hamburger)
  6. const mockFn = jest.fn()
  7. wrapper.vm.$on('toggleClick', mockFn)
  8. wrapper.find('.hamburger').trigger('click')
  9. expect(mockFn).toBeCalled()
  10. })
  11. it('prop isActive', () => {
  12. const wrapper = shallowMount(Hamburger)
  13. wrapper.setProps({ isActive: true })
  14. expect(wrapper.contains('.is-active')).toBe(true)
  15. wrapper.setProps({ isActive: false })
  16. expect(wrapper.contains('.is-active')).toBe(false)
  17. })
  18. })