mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 18:54:24 +00:00
[Improvement] Picker: optimize render performance (#1391)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import Picker from '../';
|
||||
import PickerColumn from '../PickerColumn';
|
||||
import { mount, triggerDrag } from '../../../test/utils';
|
||||
import { mount, triggerDrag, later } from '../../../test/utils';
|
||||
|
||||
const simpleColumn = ['1990', '1991', '1992', '1993', '1994', '1995'];
|
||||
const columns = [
|
||||
@@ -101,21 +101,19 @@ test('drag simple columns', () => {
|
||||
expect(wrapper.emitted('change')[0][1]).toEqual('1992');
|
||||
});
|
||||
|
||||
test('column watch default index', () => {
|
||||
test('column watch default index', async() => {
|
||||
const disabled = { disabled: true, text: 1 };
|
||||
const wrapper = mount(PickerColumn, {
|
||||
propsData: {
|
||||
initialOptions: [disabled, ...simpleColumn],
|
||||
valueKey: 'text',
|
||||
itemHeight: 50
|
||||
}
|
||||
});
|
||||
wrapper.vm.options = [disabled, ...simpleColumn];
|
||||
|
||||
await later();
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
|
||||
wrapper.vm.options = [disabled, ...simpleColumn];
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
|
||||
wrapper.vm.options = [1, disabled, disabled, disabled];
|
||||
wrapper.vm.defaultIndex = 2;
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
Reference in New Issue
Block a user