Skip to content

Commit

Permalink
test(transfer): add test (tusen-ai#925)
Browse files Browse the repository at this point in the history
  • Loading branch information
XieZongChen authored and rhengles committed Aug 31, 2021
1 parent 73a81d0 commit ef2d0c3
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/transfer/tests/Transfer.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,39 @@
import { mount } from '@vue/test-utils'
import { sleep } from 'seemly'
import { NTransfer } from '../index'

describe('n-transfer', () => {
it('should work with import on demand', () => {
mount(NTransfer)
})

it('should work with `disabled` prop', () => {
const wrapper = mount(NTransfer, { props: { disabled: true } })
expect(wrapper.find('.n-transfer').attributes('class')).toContain(
'n-transfer--disabled'
)
})

it('should work with `filterable` prop', () => {
const wrapper = mount(NTransfer, { props: { filterable: true } })
expect(wrapper.find('.n-transfer').attributes('class')).toContain(
'n-transfer--filterable'
)
})

it('should work with `filter` prop', async () => {
const options = [
{
label: 'test1',
value: 'test1'
}
]
const onFilter = jest.fn()
const wrapper = mount(NTransfer, {
props: { filterable: true, filter: onFilter, options: options }
})
await wrapper.find('input').setValue('1')
await sleep(300)
expect(onFilter).toHaveBeenCalled()
})
})

0 comments on commit ef2d0c3

Please sign in to comment.