Skip to content

Commit

Permalink
test(subform): only one child: Disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Liberty-liu committed Sep 10, 2023
1 parent 5dece8c commit 42256fc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/formTypes/subform.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,19 @@ describe('Field: subform', () => {
expect([list.columns[0], newField.columns[0]]).toStrictEqual(previewWrapper.findAll('[data-field-id]').map(element => element.element.dataset.fieldId))
expect(previewWrapper.find(`[data-field-id="${newField.columns[0]}"] .el-input`).classes()).toContain('is-disabled')
})
test('Only one child: Disabled', async () => {
const newField = _.cloneDeep(field)
newField.columns[0] = newField.columns[0].id
const subForm = erGeneratorData(_.cloneDeep(erComponentsConfig.fieldsConfig[2].list[5]), true, 'en')
subForm.columns[0].options.disabled = true
const list = _.cloneDeep(subForm)
list.columns[0] = subForm.columns[0].id
subForm.columns[0].list[0].push(newField)
const data = wrapLayoutDataByLayoutType([list], [subForm.columns[0], field.columns[0]])
console.log(JSON.stringify(data, '', 2))
await previewWrapper.findComponent({ ref: 'EReditorRef' }).vm.setData(data)
expect(previewWrapper.find(utils.getTestId('SubformLayout:addButton')).exists()).toBe(false)
})
test('Only one child: has 2 default contents', async () => {
const values = ['1', '2']
const newField = _.cloneDeep(field)
Expand Down

0 comments on commit 42256fc

Please sign in to comment.