Write test for default props, searchValue

This commit is contained in:
Matt Rider 2019-02-07 16:01:58 -02:00
parent 1b013c2ac4
commit 6f70f2131c

View File

@ -17,14 +17,22 @@ describe('SearchInput.vue', () => {
})
it('defaults to an empty value', () => {
wrapper = mount(SearchInput, {
propsData: {
value: null
}
})
expect(wrapper.text()).toBe('')
wrapper = mount(SearchInput)
expect(wrapper.vm.value).toBe('')
})
it('defaults to id "nav-search"', () => {
wrapper = mount(SearchInput)
expect(wrapper.vm.id).toBe('nav-search')
})
it('changes searchValue as a user inputs a value', () => {
wrapper = mount(SearchInput)
const input = wrapper.find('#nav-search')
input.element.value = 'abc'
input.trigger('input')
expect(wrapper.vm.searchValue).toBe('abc')
})
// TODO: add similar software tests for other components
// TODO: add more test cases in this file
})