diff --git a/assets/js/src/form_editor/blocks/divider/divider.ts b/assets/js/src/form_editor/blocks/divider/divider.ts index 7d240ac029..1e61c8ade6 100644 --- a/assets/js/src/form_editor/blocks/divider/divider.ts +++ b/assets/js/src/form_editor/blocks/divider/divider.ts @@ -1,37 +1,7 @@ import MailPoet from 'mailpoet'; import icon from './icon.jsx'; import edit from './edit'; - -export enum Types { - Divider = 'divider', - Spacer = 'spacer', -} - -export enum Style { - Solid = 'solid', - Dashed = 'dashed', - Dotted = 'dotted', -} - -export interface Attributes { - className: string, - height: number; - type: Types; - style: Style; - dividerHeight: number; - dividerWidth: number; - color: string; -} - -export const defaultAttributes = { - className: undefined, - height: 1, - type: Types.Divider, - style: Style.Solid, - dividerHeight: 1, - dividerWidth: 100, - color: 'black', -}; +import { defaultAttributes } from './divider_types'; export const name = 'mailpoet-form/divider'; diff --git a/assets/js/src/form_editor/blocks/divider/divider_types.ts b/assets/js/src/form_editor/blocks/divider/divider_types.ts new file mode 100644 index 0000000000..6d11bdd1e3 --- /dev/null +++ b/assets/js/src/form_editor/blocks/divider/divider_types.ts @@ -0,0 +1,30 @@ +export enum Types { + Divider = 'divider', + Spacer = 'spacer', +} + +export enum Style { + Solid = 'solid', + Dashed = 'dashed', + Dotted = 'dotted', +} + +export interface Attributes { + className: string, + height: number; + type: Types; + style: Style; + dividerHeight: number; + dividerWidth: number; + color: string; +} + +export const defaultAttributes = { + className: undefined, + height: 1, + type: Types.Divider, + style: Style.Solid, + dividerHeight: 1, + dividerWidth: 100, + color: 'black', +}; diff --git a/assets/js/src/form_editor/blocks/divider/edit.tsx b/assets/js/src/form_editor/blocks/divider/edit.tsx index 2701efc834..f43a9316c3 100644 --- a/assets/js/src/form_editor/blocks/divider/edit.tsx +++ b/assets/js/src/form_editor/blocks/divider/edit.tsx @@ -10,11 +10,7 @@ import { SelectControl, ToggleControl, } from '@wordpress/components'; -import { - Attributes, - Style, - Types, -} from './divider'; +import { Attributes, Style, Types } from './divider_types'; type Props = { attributes: Attributes, 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 a806d846ed..e51e7b5fc1 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 @@ -2,7 +2,7 @@ import { has } from 'lodash'; import asNum from './server_value_as_num'; import formatCustomFieldBlockName from '../blocks/format_custom_field_block_name.jsx'; -import { defaultAttributes as dividerDefaultAttributes } from '../blocks/divider/divider'; +import { defaultAttributes as dividerDefaultAttributes } from '../blocks/divider/divider_types'; const generateId = () => (`${Math.random().toString()}-${Date.now()}`); diff --git a/package.json b/package.json index ac25fc3d55..1eb5a3dd95 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "autoprefixer": "postcss assets/dist/css/*.css --use autoprefixer --no-map --replace", "scss": "node-sass assets/css/src/ --output assets/dist/css/ --output-style compact", "stylelint": "stylelint --fix", - "test": "mocha --require tests/javascript/babel_register.js tests/javascript/**/*.spec.js", + "test": "env NODE_PATH=$NODE_PATH:./assets/js/src mocha --require tests/javascript/babel_register.js tests/javascript/**/*.spec.js", "check-types": "tsc --noEmit", "storybook": "start-storybook -s ./ -p 8083", "build-storybook": "build-storybook"