Skip to content

Commit

Permalink
chore: use named exports in viewer tests
Browse files Browse the repository at this point in the history
Related to #918
  • Loading branch information
Skaiir committed Jan 11, 2024
1 parent 3d7f445 commit 1b5d71d
Show file tree
Hide file tree
Showing 32 changed files with 44 additions and 47 deletions.
2 changes: 1 addition & 1 deletion packages/form-js-viewer/test/helper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import axe from 'axe-core';

import TestContainer from 'mocha-test-container-support';

import Form from '../../src/Form';
import { Form } from '../../src/Form';

let OPTIONS, FORM;

Expand Down
4 changes: 2 additions & 2 deletions packages/form-js-viewer/test/spec/Form.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {

import { spy } from 'sinon';

import customButtonModule from './custom';
import { CustomFormFieldsModule } from './custom';

import conditionSchema from './condition.json';
import conditionErrorsSchema from './condition-errors.json';
Expand Down Expand Up @@ -1063,7 +1063,7 @@ describe('Form', function() {
data,
schema: customFieldSchema,
additionalModules: [
customButtonModule
CustomFormFieldsModule
]
});

Expand Down
4 changes: 1 addition & 3 deletions packages/form-js-viewer/test/spec/core/Validator.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import EventBus from 'diagram-js/lib/core/EventBus';

import Validator from '../../../src/core/Validator';

import { Validator } from '../../../src/core/Validator';
import { FeelExpressionLanguage } from '../../../src/features/expressionLanguage';


Expand Down
2 changes: 1 addition & 1 deletion packages/form-js-viewer/test/spec/custom/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class CustomFormFields {
}
}

export default {
export const CustomFormFieldsModule = {
__init__: [ 'customFormFields' ],
customFormFields: [ 'type', CustomFormFields ]
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ConditionChecker from '../../../../src/features/expressionLanguage/ConditionChecker';
import PathRegistry from '../../../../src/core/PathRegistry';
import FormFields from '../../../../src/render/FormFields';
import { ConditionChecker } from '../../../../src/features/expressionLanguage/ConditionChecker';
import { PathRegistry } from '../../../../src/core/PathRegistry';
import { FormFields } from '../../../../src/render/FormFields';

describe('ConditionChecker', function() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import FeelExpressionLanguage from '../../../../src/features/expressionLanguage/FeelExpressionLanguage';
import { FeelExpressionLanguage } from '../../../../src/features/expressionLanguage/FeelExpressionLanguage';

describe('FeelExpressionLanguage', function() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
render
} from '@testing-library/preact/pure';

import Description from '../../../../src/render/components/Description';
import { Description } from '../../../../src/render/components/Description';

import {
createFormContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import {
classes
} from 'min-dom';

import FormField from 'src/render/components/FormField';
import { FormField } from 'src/render/components/FormField';

import Textfield from 'src/render/components/form-fields/Textfield';
import { Textfield } from 'src/render/components/form-fields/Textfield';

import UpdateFieldValidationHandler from 'src/features/viewerCommands/cmd/UpdateFieldValidationHandler';
import { UpdateFieldValidationHandler } from 'src/features/viewerCommands/cmd/UpdateFieldValidationHandler';

import { MockFormContext } from './helper';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
render
} from '@testing-library/preact/pure';

import Label from '../../../../src/render/components/Label';
import { Label } from '../../../../src/render/components/Label';

import {
createFormContainer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/preact/pure';

import Button from '../../../../../src/render/components/form-fields/Button';
import { Button } from '../../../../../src/render/components/form-fields/Button';

import {
createFormContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
render
} from '@testing-library/preact/pure';

import Checkbox from '../../../../../src/render/components/form-fields/Checkbox';
import { Checkbox } from '../../../../../src/render/components/form-fields/Checkbox';

import {
createFormContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
render
} from '@testing-library/preact/pure';

import Checklist from '../../../../../src/render/components/form-fields/Checklist';
import { Checklist } from '../../../../../src/render/components/form-fields/Checklist';

import {
createFormContainer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fireEvent, render } from '@testing-library/preact/pure';

import Datetime from '../../../../../src/render/components/form-fields/Datetime';
import { Datetime } from '../../../../../src/render/components/form-fields/Datetime';

import {
createFormContainer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Default from '../../../../../src/render/components/form-fields/Default';

import { Default } from '../../../../../src/render/components/form-fields/Default';

describe('Default', function() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render } from '@testing-library/preact/pure';
import DynamicList from '../../../../../src/render/components/form-fields/DynamicList';
import { DynamicList } from '../../../../../src/render/components/form-fields/DynamicList';
import { createFormContainer, expectNoViolations } from '../../../../TestHelper';
import { MockFormContext } from '../helper';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
render
} from '@testing-library/preact/pure';

import Group from '../../../../../src/render/components/form-fields/Group';
import { Group } from '../../../../../src/render/components/form-fields/Group';

import {
createFormContainer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/preact/pure';

import IFrame from '../../../../../src/render/components/form-fields/IFrame';
import { IFrame } from '../../../../../src/render/components/form-fields/IFrame';

import {
createFormContainer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/preact/pure';

import Image from '../../../../../src/render/components/form-fields/Image';
import { Image } from '../../../../../src/render/components/form-fields/Image';

import {
createFormContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
render
} from '@testing-library/preact/pure';

import Number from '../../../../../src/render/components/form-fields/Number';
import { Numberfield } from '../../../../../src/render/components/form-fields/Number';

import { MockFormContext } from '../helper';

Expand Down Expand Up @@ -883,7 +883,7 @@ describe('Number', function() {
it('#create', function() {

// assume
const { config } = Number;
const { config } = Numberfield;
expect(config.type).to.eql('number');
expect(config.label).to.eql('Number');
expect(config.group).to.eql('basic-input');
Expand Down Expand Up @@ -912,7 +912,7 @@ describe('Number', function() {
it('should sanitize valid number strings to numbers', function() {

// given
const { sanitizeValue } = Number.config;
const { sanitizeValue } = Numberfield.config;

// when
const sanitizedValue1 = sanitizeValue({ value: '123', formField: { serializeToString: false } });
Expand All @@ -932,7 +932,7 @@ describe('Number', function() {
it('should sanitize arrays and objects to null', function() {

// given
const { sanitizeValue } = Number.config;
const { sanitizeValue } = Numberfield.config;

// when
const sanitizedValue1 = sanitizeValue({ value: [], formField: { serializeToString: false } });
Expand All @@ -948,7 +948,7 @@ describe('Number', function() {
it('should sanitize invalid number strings to null', function() {

// given
const { sanitizeValue } = Number.config;
const { sanitizeValue } = Numberfield.config;

// when
const sanitizedValue1 = sanitizeValue({ value: 'abc', formField: { serializeToString: false } });
Expand All @@ -970,7 +970,7 @@ describe('Number', function() {
it('should sanitize booleans to null', function() {

// given
const { sanitizeValue } = Number.config;
const { sanitizeValue } = Numberfield.config;

// when
const sanitizedValue1 = sanitizeValue({ value: true, formField: { serializeToString: false } });
Expand Down Expand Up @@ -1118,7 +1118,7 @@ function createNumberField({ services, ...restOptions } = {}) {
<MockFormContext
services={ services }
options={ options }>
<Number
<Numberfield
disabled={ options.disabled }
readonly={ options.readonly }
errors={ options.errors }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
render
} from '@testing-library/preact/pure';

import Radio from '../../../../../src/render/components/form-fields/Radio';
import { Radio } from '../../../../../src/render/components/form-fields/Radio';

import {
createFormContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
screen
} from '@testing-library/preact/pure';

import Select from '../../../../../src/render/components/form-fields/Select';
import { Select } from '../../../../../src/render/components/form-fields/Select';

import {
createFormContainer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/preact/pure';

import Separator from '../../../../../src/render/components/form-fields/Separator';
import { Separator } from '../../../../../src/render/components/form-fields/Separator';

import {
createFormContainer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/preact/pure';

import Spacer from '../../../../../src/render/components/form-fields/Spacer';
import { Spacer } from '../../../../../src/render/components/form-fields/Spacer';

import {
createFormContainer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fireEvent, render } from '@testing-library/preact/pure';

import Table from '../../../../../src/render/components/form-fields/Table';
import { Table } from '../../../../../src/render/components/form-fields/Table';

import {
createFormContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
screen
} from '@testing-library/preact/pure';

import Taglist from '../../../../../src/render/components/form-fields/Taglist';
import { Taglist } from '../../../../../src/render/components/form-fields/Taglist';

import {
createFormContainer,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render } from '@testing-library/preact/pure';

import Text from '../../../../../src/render/components/form-fields/Text';
import { Text } from '../../../../../src/render/components/form-fields/Text';

import {
createFormContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
render
} from '@testing-library/preact/pure';

import Textarea from '../../../../../src/render/components/form-fields/Textarea';
import { Textarea } from '../../../../../src/render/components/form-fields/Textarea';

import {
createFormContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
render
} from '@testing-library/preact/pure';

import Textfield from '../../../../../src/render/components/form-fields/Textfield';
import { Textfield } from '../../../../../src/render/components/form-fields/Textfield';

import {
createFormContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
render
} from '@testing-library/preact/pure';

import DropdownList from '../../../../../../src/render/components/form-fields/parts/DropdownList';
import { DropdownList } from '../../../../../../src/render/components/form-fields/parts/DropdownList';

import {
createFormContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
render,
} from '@testing-library/preact/pure';

import useCleanupMultiSelectValues from '../../../../src/render/hooks/useCleanupMultiSelectValues';
import { useCleanupMultiSelectValue } from '../../../../src/render/hooks/useCleanupMultiSelectValue';

const spy = sinon.spy;
let root;
Expand Down Expand Up @@ -111,7 +111,7 @@ const noPlatformOptions = [

function TestComponent({ onChangeSpy, options, values }) {

useCleanupMultiSelectValues({
useCleanupMultiSelectValue({
field: 'foo',
loadState: 'loaded',
onChange: onChangeSpy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
render,
} from '@testing-library/preact/pure';

import useCleanupSingleSelectValue from '../../../../src/render/hooks/useCleanupSingleSelectValue';
import { useCleanupSingleSelectValue } from '../../../../src/render/hooks/useCleanupSingleSelectValue';

const spy = sinon.spy;
let root;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
cleanup
} from '@testing-library/preact/pure';

import useKeyDownAction from '../../../../src/render/hooks/useKeyDownAction';
import { useKeyDownAction } from '../../../../src/render/hooks/useKeyDownAction';

const spy = sinon.spy;
let root;
Expand Down

0 comments on commit 1b5d71d

Please sign in to comment.