1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| import { mount } from '@vue/test-utils';
| import Antd from 'ant-design-vue';
| import { describe, expect, it } from 'vitest';
|
| import FieldDraftList from '../../src/components/FieldDraftList.vue';
|
| describe('FieldDraftList', () => {
| it('renders five field editors and emits draft updates', async () => {
| const wrapper = mount(FieldDraftList, { global: { plugins: [Antd] }, props: { disabled: false, errors: {}, fields: [
| { alias: '文本', tag: 'eln.field.text', type: 'text', options: [], draftValue: '', documentValue: '', currentValue: '', internalId: '1' },
| { alias: '多行', tag: 'eln.field.multi', type: 'multiline', options: [], draftValue: '', documentValue: '', currentValue: '', internalId: '2' },
| { alias: '选择', tag: 'eln.field.select', type: 'select', options: [{ display: '合格', value: 'ok' }], draftValue: '', documentValue: '', currentValue: '', internalId: '3' },
| { alias: '复选', tag: 'eln.field.check', type: 'checkbox', options: [], draftValue: false, documentValue: false, currentValue: false, internalId: '4' },
| { alias: '日期', tag: 'eln.field.date', type: 'date', options: [], draftValue: '', documentValue: '', currentValue: '', internalId: '5' },
| ] } });
| expect(wrapper.findAll('.field-row')).toHaveLength(5);
| expect(wrapper.findAll('textarea')).toHaveLength(1);
| expect(wrapper.text()).toContain('复选');
| });
| });
|
|