Skip to content

Commit

Permalink
test: add a test case for error wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
doz13189 authored and cexbrayat committed Feb 25, 2021
1 parent 38a0096 commit fae6fdc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/classes.spec.ts
Expand Up @@ -55,5 +55,18 @@ describe('classes', () => {
expect(wrapper.classes('class-a')).toBe(true)
expect(wrapper.classes('class-b')).toBe(false)
})

it('throws an error if called on an empty wrapper', () => {
const Component = defineComponent({
render() {
return h('div', { class: 'class-a' }, 'some text')
}
})

const wrapper = mount(Component)
expect(() => wrapper.find('.class-c').classes()).toThrowError(
'Cannot call classes on an empty DOMWrapper.'
)
})
})
})

0 comments on commit fae6fdc

Please sign in to comment.