Skip to content
Snippets Groups Projects

Dashboard

Merged Birthe Emilie Christiansen requested to merge Dashboard into development
5 files
+ 208
0
Compare changes
  • Side-by-side
  • Inline
Files
5
+ 43
0
import { mount } from '@vue/test-utils'
import { describe, it, expect } from 'vitest'
import NavBar from '@/components/NavBar.vue'
describe('NavBar', () => {
it('rendedrs without crashing', () => {
const wrapper = mount(NavBar, {
global: {
stubs: ['RouterLink']
}
})
expect(wrapper.exists()).toBe(true)
})
it ('toggles navOpen on click', async () => {
const wrapper = mount(NavBar, {
global: {
stubs: ['RouterLink']
}
})
const button = wrapper.find('button')
await button.trigger('click')
expect(wrapper.vm.navOpen).toBe(true)
await button.trigger('click')
expect(wrapper.vm.navOpen).toBe(false)
})
it('updates isMobileMenu on window resize', async () => {
const wrapper = mount(NavBar, {
global: {
stubs: ['RouterLink']
}
})
global.innerWidth = 500
global.dispatchEvent(new Event('resize'))
await wrapper.vm.$nextTick()
expect(wrapper.vm.isMobileMenu).toBe(true)
global.innerWidth = 800
global.dispatchEvent(new Event('resize'))
await wrapper.vm.$nextTick()
expect(wrapper.vm.isMobileMenu).toBe(false)
})
})
\ No newline at end of file
Loading