Store columns text and background colors settings

[MAILPOET-2609]
This commit is contained in:
Rostislav Wolny
2020-02-18 15:24:55 +01:00
committed by Pavel Dohnal
parent c93efabc70
commit 8e71f8d3cc
5 changed files with 48 additions and 1 deletions

View File

@ -161,7 +161,6 @@ export const customHtmlBlock = {
},
};
export const nestedColumns = {
clientId: 'columns-1',
name: 'core/columns',

View File

@ -338,4 +338,19 @@ describe('Blocks to Form Body', () => {
const input = column11.body[0];
checkBodyInputBasics(input);
});
it('Should map colors for columns', () => {
const columns = { ...nestedColumns };
columns.attributes = {
textColor: 'vivid-red',
backgroundColor: 'white',
customBackgroundColor: '#ffffff',
customTextColor: '#dd0000',
};
const [mapped] = formBlocksToBody([columns]);
expect(mapped.params.text_color).to.be.equal('vivid-red');
expect(mapped.params.background_color).to.be.equal('white');
expect(mapped.params.custom_background_color).to.be.equal('#ffffff');
expect(mapped.params.custom_text_color).to.be.equal('#dd0000');
});
});

View File

@ -340,4 +340,19 @@ describe('Form Body To Blocks', () => {
const column12 = columns11.innerBlocks[1];
expect(column12.innerBlocks.length).to.be.equal(0);
});
it('Should map columns colors', () => {
const nested = { ...nestedColumns, position: '1' };
nested.params = {
text_color: 'vivid-red',
background_color: 'white',
custom_text_color: '#dd0000',
custom_background_color: '#ffffff',
};
const [block] = formBodyToBlocks([nested]);
expect(block.attributes.textColor).to.be.equal('vivid-red');
expect(block.attributes.backgroundColor).to.be.equal('white');
expect(block.attributes.customTextColor).to.be.equal('#dd0000');
expect(block.attributes.customBackgroundColor).to.be.equal('#ffffff');
});
});