From 39e7cfa19dc884fe9509c8017c930eedd95fced2 Mon Sep 17 00:00:00 2001 From: Pavel Dohnal Date: Tue, 17 Dec 2019 12:40:37 +0100 Subject: [PATCH] Rename customHtml to html It is not a custom field [MAILPOET-2453]# --- assets/js/src/form_editor/blocks/blocks.jsx | 4 ++-- .../js/src/form_editor/blocks/{custom_html => html}/edit.jsx | 0 .../blocks/{custom_html/custom_html.jsx => html/html.jsx} | 2 +- .../js/src/form_editor/blocks/{custom_html => html}/icon.jsx | 0 assets/js/src/form_editor/store/blocks_to_form_body.jsx | 2 +- assets/js/src/form_editor/store/form_body_to_blocks.jsx | 2 +- .../javascript/form_editor/store/blocks_to_form_body.spec.js | 2 +- .../javascript/form_editor/store/form_body_to_blocks.spec.js | 4 ++-- 8 files changed, 8 insertions(+), 8 deletions(-) rename assets/js/src/form_editor/blocks/{custom_html => html}/edit.jsx (100%) rename assets/js/src/form_editor/blocks/{custom_html/custom_html.jsx => html/html.jsx} (92%) rename assets/js/src/form_editor/blocks/{custom_html => html}/icon.jsx (100%) diff --git a/assets/js/src/form_editor/blocks/blocks.jsx b/assets/js/src/form_editor/blocks/blocks.jsx index b56994edf6..21c2f0c6bf 100644 --- a/assets/js/src/form_editor/blocks/blocks.jsx +++ b/assets/js/src/form_editor/blocks/blocks.jsx @@ -9,7 +9,7 @@ import * as submit from './submit/submit.jsx'; import * as firstName from './first_name/first_name.jsx'; import * as lastName from './last_name/last_name.jsx'; import * as segmentSelect from './segment_select/segment_select.jsx'; -import * as customHtml from './custom_html/custom_html.jsx'; +import * as html from './html/html.jsx'; import * as customText from './custom_text/custom_text.jsx'; import * as customTextArea from './custom_textarea/custom_textarea.jsx'; @@ -52,7 +52,7 @@ export default () => { registerBlockType(firstName.name, firstName.settings); registerBlockType(lastName.name, lastName.settings); registerBlockType(segmentSelect.name, segmentSelect.settings); - registerBlockType(customHtml.name, customHtml.settings); + registerBlockType(html.name, html.settings); if (Array.isArray(customFields)) { customFields.forEach(registerCustomFieldBlock); diff --git a/assets/js/src/form_editor/blocks/custom_html/edit.jsx b/assets/js/src/form_editor/blocks/html/edit.jsx similarity index 100% rename from assets/js/src/form_editor/blocks/custom_html/edit.jsx rename to assets/js/src/form_editor/blocks/html/edit.jsx diff --git a/assets/js/src/form_editor/blocks/custom_html/custom_html.jsx b/assets/js/src/form_editor/blocks/html/html.jsx similarity index 92% rename from assets/js/src/form_editor/blocks/custom_html/custom_html.jsx rename to assets/js/src/form_editor/blocks/html/html.jsx index b14cb762fe..69729a592a 100644 --- a/assets/js/src/form_editor/blocks/custom_html/custom_html.jsx +++ b/assets/js/src/form_editor/blocks/html/html.jsx @@ -2,7 +2,7 @@ import MailPoet from 'mailpoet'; import icon from './icon.jsx'; import edit from './edit.jsx'; -export const name = 'mailpoet-form/custom-html'; +export const name = 'mailpoet-form/html'; export const settings = { title: MailPoet.I18n.t('blockCustomHtml'), diff --git a/assets/js/src/form_editor/blocks/custom_html/icon.jsx b/assets/js/src/form_editor/blocks/html/icon.jsx similarity index 100% rename from assets/js/src/form_editor/blocks/custom_html/icon.jsx rename to assets/js/src/form_editor/blocks/html/icon.jsx diff --git a/assets/js/src/form_editor/store/blocks_to_form_body.jsx b/assets/js/src/form_editor/store/blocks_to_form_body.jsx index e8897b2d72..57c3c3ae5a 100644 --- a/assets/js/src/form_editor/store/blocks_to_form_body.jsx +++ b/assets/js/src/form_editor/store/blocks_to_form_body.jsx @@ -102,7 +102,7 @@ export default (blocks, customFields = []) => { static: '0', params: '', }; - case 'mailpoet-form/custom-html': + case 'mailpoet-form/html': return { ...mapped, id: 'html', diff --git a/assets/js/src/form_editor/store/form_body_to_blocks.jsx b/assets/js/src/form_editor/store/form_body_to_blocks.jsx index a1e4393f47..ba36465cec 100644 --- a/assets/js/src/form_editor/store/form_body_to_blocks.jsx +++ b/assets/js/src/form_editor/store/form_body_to_blocks.jsx @@ -101,7 +101,7 @@ export default (data, customFields = []) => { case 'html': return { ...mapped, - name: 'mailpoet-form/custom-html', + name: 'mailpoet-form/html', attributes: { content: item.params && item.params.text ? item.params.text : '', nl2br: item.params && item.params.nl2br ? !!item.params.nl2br : false, diff --git a/tests/javascript/form_editor/store/blocks_to_form_body.spec.js b/tests/javascript/form_editor/store/blocks_to_form_body.spec.js index ed16c66e96..a12d12d981 100644 --- a/tests/javascript/form_editor/store/blocks_to_form_body.spec.js +++ b/tests/javascript/form_editor/store/blocks_to_form_body.spec.js @@ -84,7 +84,7 @@ const customHtmlBlock = { clientId: 'some_random_321', isValid: true, innerBlocks: [], - name: 'mailpoet-form/custom-html', + name: 'mailpoet-form/html', attributes: { content: 'HTML content', nl2br: true, diff --git a/tests/javascript/form_editor/store/form_body_to_blocks.spec.js b/tests/javascript/form_editor/store/form_body_to_blocks.spec.js index 22363026c0..bf0027fd65 100644 --- a/tests/javascript/form_editor/store/form_body_to_blocks.spec.js +++ b/tests/javascript/form_editor/store/form_body_to_blocks.spec.js @@ -238,12 +238,12 @@ describe('Form Body To Blocks', () => { ]); checkBlockBasics(block1); expect(block1.clientId).to.be.equal('html_0'); - expect(block1.name).to.be.equal('mailpoet-form/custom-html'); + expect(block1.name).to.be.equal('mailpoet-form/html'); expect(block1.attributes.content).to.be.equal('123'); expect(block1.attributes.nl2br).to.be.true; checkBlockBasics(block2); expect(block2.clientId).to.be.equal('html_1'); - expect(block2.name).to.be.equal('mailpoet-form/custom-html'); + expect(block2.name).to.be.equal('mailpoet-form/html'); expect(block2.attributes.content).to.be.equal('nice one'); expect(block2.attributes.nl2br).to.be.false; });