-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e9fb97e
commit efa6484
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
}) | ||
}) |