0👍
Open your browser console, then check style.display
for the Bootstrap-Vue Modal, the value is none when hide(), the value is block !important when show().
so change expect(modal.style.display).toBe('')
to expect(modal.style.display).toBe('block !important')
or
I don’t know Karma, probably exists one usage like expect(modal.style.display).toBe((item)=>{return item!=='none'})
0👍
it('check modal method', () => {
const fm = new Vue(Index).$mount()
const modal = fm.$el.querySelector('.modal')
expect(modal.style.display).toBe('none')
modal.toggleModal()
fm.$nextTick(() => {
expect(modal.style.display).toBe('')
})
})
Source:stackexchange.com