mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 18:14:13 +00:00
[Improvement] Rebuild test system (#1051)
This commit is contained in:
27
packages/tree-select/test/index.spec.js
Normal file
27
packages/tree-select/test/index.spec.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import TreeSelect from '../';
|
||||
import demoTest from '../../../test/demo-test';
|
||||
import { mount } from '@vue/test-utils';
|
||||
|
||||
demoTest(TreeSelect);
|
||||
|
||||
test('empty list', () => {
|
||||
expect(mount(TreeSelect).html()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('select item', () => {
|
||||
const item = {
|
||||
text: 'city1',
|
||||
id: 1
|
||||
};
|
||||
const wrapper = mount(TreeSelect, {
|
||||
propsData: {
|
||||
items: [{
|
||||
text: 'group1',
|
||||
children: [item]
|
||||
}]
|
||||
}
|
||||
});
|
||||
|
||||
wrapper.find('.van-tree-select__item').trigger('click');
|
||||
expect(wrapper.emitted('itemclick')[0][0]).toEqual(item);
|
||||
});
|
Reference in New Issue
Block a user