Allow saving form also when list selection with lists is present
[MAILPOET-2828]
This commit is contained in:
committed by
Veljko V
parent
bef9267593
commit
201c1c7656
@@ -21,6 +21,16 @@ const submitBlock = {
|
||||
},
|
||||
};
|
||||
|
||||
const segmentsBlock = {
|
||||
clientId: 'segments',
|
||||
isValid: true,
|
||||
innerBlocks: [],
|
||||
name: 'mailpoet-form/segment-select',
|
||||
attributes: {
|
||||
values: [],
|
||||
},
|
||||
};
|
||||
|
||||
const columns = {
|
||||
clientId: 'columns-1',
|
||||
name: 'core/columns',
|
||||
@@ -71,11 +81,24 @@ describe('Form validator', () => {
|
||||
segments: [],
|
||||
},
|
||||
};
|
||||
const blocks = [emailBlock, submitBlock];
|
||||
const blocks = [emailBlock, submitBlock, segmentsBlock];
|
||||
const result = validate(formData, blocks);
|
||||
expect(result).to.contain('missing-lists');
|
||||
});
|
||||
|
||||
it('Should not return error for when segments block with lists is present', () => {
|
||||
const filledSegmentsBlock = { ...segmentsBlock };
|
||||
filledSegmentsBlock.attributes.values = [{ id: 1, name: 'cool people' }];
|
||||
const formData = {
|
||||
settings: {
|
||||
segments: [],
|
||||
},
|
||||
};
|
||||
const blocks = [emailBlock, submitBlock, filledSegmentsBlock];
|
||||
const result = validate(formData, blocks);
|
||||
expect(result).to.be.empty;
|
||||
});
|
||||
|
||||
it('Should return error for missing email', () => {
|
||||
const formData = {
|
||||
settings: {
|
||||
|
Reference in New Issue
Block a user