[Improvement] Rebuild test system (#1051)

This commit is contained in:
neverland
2018-05-12 14:04:32 +08:00
committed by GitHub
parent 360f2f40b1
commit a55eda8891
185 changed files with 4989 additions and 7950 deletions

View 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);
});