From 42f174e880bfb1244a8efaeb81a8076dded26b84 Mon Sep 17 00:00:00 2001 From: Rostislav Wolny Date: Thu, 2 Jul 2020 13:10:47 +0200 Subject: [PATCH] Refactor form editor settings values in tests [MAILPOET-3005] --- .../store/blocks_to_form_body.spec.js | 18 ++++-------------- .../form_editor/store/editor_settings.ts | 19 +++++++++++++++++++ .../store/form_body_to_blocks.spec.js | 18 ++++-------------- 3 files changed, 27 insertions(+), 28 deletions(-) create mode 100644 tests/javascript/form_editor/store/editor_settings.ts 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 5bb8a50425..f75ba7d994 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 @@ -19,20 +19,10 @@ import { imageBlock, } from './block_to_form_test_data.js'; -const colorDefinitions = [{ - name: 'Black', - slug: 'black', - color: '#000000', -}, { - name: 'White', - slug: 'white', - color: '#ffffff', -}]; - -const fontSizeDefinitions = [ - { name: 'Small', size: 13, slug: 'small' }, - { name: 'Normal', size: 16, slug: 'normal' }, -]; +import { + fontSizeDefinitions, + colorDefinitions, +} from './editor_settings'; const checkBodyInputBasics = (input) => { expect(input.id).to.be.a('string'); diff --git a/tests/javascript/form_editor/store/editor_settings.ts b/tests/javascript/form_editor/store/editor_settings.ts new file mode 100644 index 0000000000..d90c81457a --- /dev/null +++ b/tests/javascript/form_editor/store/editor_settings.ts @@ -0,0 +1,19 @@ +import { + ColorDefinition, + FontSizeDefinition, +} from '../../../../assets/js/src/form_editor/store/form_data_types'; + +export const colorDefinitions: ColorDefinition[] = [{ + name: 'Black', + slug: 'black', + color: '#000000', +}, { + name: 'White', + slug: 'white', + color: '#ffffff', +}]; + +export const fontSizeDefinitions: FontSizeDefinition[] = [ + { name: 'Small', size: 13, slug: 'small' }, + { name: 'Normal', size: 16, slug: 'normal' }, +]; 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 33f1ac404d..c506b4d9f7 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 @@ -21,20 +21,10 @@ import { image, } from './form_to_block_test_data.js'; -const colorDefinitions = [{ - name: 'Black', - slug: 'black', - color: '#000000', -}, { - name: 'White', - slug: 'white', - color: '#ffffff', -}]; - -const fontSizeDefinitions = [ - { name: 'Small', size: 13, slug: 'small' }, - { name: 'Normal', size: 16, slug: 'normal' }, -]; +import { + fontSizeDefinitions, + colorDefinitions, +} from './editor_settings'; const formBodyToBlocks = formBodyToBlocksFactory(colorDefinitions, fontSizeDefinitions, []);