diff --git a/components/SearchInput.spec.js b/components/SearchInput.spec.js index 1c22cec1d..7d34dca30 100644 --- a/components/SearchInput.spec.js +++ b/components/SearchInput.spec.js @@ -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 })