mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
Add tests for search-form.vue
This commit is contained in:
parent
566145678a
commit
395fd8cb27
1 changed files with 21 additions and 0 deletions
|
@ -0,0 +1,21 @@
|
|||
import Component from '@/components/site-header/search-form.vue'
|
||||
import { event } from '@/utils'
|
||||
|
||||
describe('components/site-header/search-form', () => {
|
||||
it('renders properly', () => {
|
||||
shallow(Component).contains('[type=search]').should.be.true
|
||||
})
|
||||
|
||||
it('emits an event to filter', async done => {
|
||||
const emitStub = sinon.stub(event, 'emit')
|
||||
const wrapper = shallow(Component)
|
||||
const input = wrapper.find('[type=search]')
|
||||
input.element.value = 'foo'
|
||||
input.trigger('input')
|
||||
setTimeout(() => {
|
||||
emitStub.calledWith('filter:changed', 'foo').should.be.true
|
||||
emitStub.restore()
|
||||
done()
|
||||
}, 200)
|
||||
})
|
||||
})
|
Loading…
Reference in a new issue