mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Write test for default props, searchValue
This commit is contained in:
parent
1b013c2ac4
commit
6f70f2131c
@ -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
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user