Skip to content

Commit

Permalink
Merge pull request #33 from open-formulieren/issue/#32-test-formio-co…
Browse files Browse the repository at this point in the history
…mpatibility

Issue/#32 test formio compatibility
  • Loading branch information
svenvandescheur authored Jun 6, 2023
2 parents bd04ec0 + 89eb21d commit 69e9a83
Show file tree
Hide file tree
Showing 59 changed files with 1,754 additions and 1,724 deletions.
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
},
"devDependencies": {
"@babel/core": "^7.21.0",
"react-formio": "^4.3.0",
"@storybook/addon-actions": "^6.5.16",
"@storybook/addon-essentials": "^6.5.16",
"@storybook/addon-interactions": "^6.5.16",
Expand Down Expand Up @@ -84,5 +85,8 @@
"dependencies": {
"clsx": "^1.2.1",
"formik": "^2.2.9"
},
"resolutions": {
"react-formio/formiojs": "~4.13.0"
}
}
25 changes: 0 additions & 25 deletions src/components/charcount/charcount.component.tsx

This file was deleted.

32 changes: 0 additions & 32 deletions src/components/charcount/charcount.stories.mdx

This file was deleted.

27 changes: 0 additions & 27 deletions src/components/columns/columns.stories.mdx

This file was deleted.

22 changes: 0 additions & 22 deletions src/components/component/component.stories.mdx

This file was deleted.

31 changes: 0 additions & 31 deletions src/components/content/content.stories.mdx

This file was deleted.

19 changes: 0 additions & 19 deletions src/components/description/description.component.tsx

This file was deleted.

22 changes: 0 additions & 22 deletions src/components/description/description.stories.mdx

This file was deleted.

43 changes: 0 additions & 43 deletions src/components/errors/errors.component.tsx

This file was deleted.

19 changes: 0 additions & 19 deletions src/components/errors/errors.stories.mdx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import {Component} from '@components';
import {Component} from '@components/utils';
import {IComponentProps} from '@types';
import clsx from 'clsx';
import {ComponentSchema} from 'formiojs';
import React from 'react';

export interface IColumnsComponent extends ComponentSchema {
type: 'columns';
columns: IFormioColumn[];
}

export interface IColumnsProps extends IComponentProps {
Expand Down
45 changes: 45 additions & 0 deletions src/components/formio/columns/columns.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import {Columns} from '@components';
import {RenderComponent} from '@lib/renderer';
import {expect} from '@storybook/jest';
import type {ComponentStory, Meta} from '@storybook/react';
import {within} from '@storybook/testing-library';

import {FormikDecorator} from '../../../tests/utils/decorators';

const meta: Meta<typeof Columns> = {
title: 'Components / Formio / Columns',
component: Columns,
decorators: [],
parameters: {},
};
export default meta;

export const columns: ComponentStory<typeof RenderComponent> = args => (
<RenderComponent {...args} />
);
columns.args = {
component: {
key: 'foo',
type: 'columns',
columns: [
{
key: 'foo.foo',
type: 'column',
size: 9,
components: [{key: 'foo.foo.foo', type: 'content', html: 'Left column.'}],
},
{
key: 'foo.bar',
type: 'column',
size: 3,
components: [{key: 'foo.bar.bar', type: 'content', html: 'Right column.'}],
},
],
},
};
columns.play = async ({canvasElement}) => {
const canvas = within(canvasElement);
expect(await canvas.findByText('Left column.')).toBeVisible();
expect(await canvas.findByText('Right column.')).toBeVisible();
};
columns.decorators = [FormikDecorator];
File renamed without changes.
31 changes: 31 additions & 0 deletions src/components/formio/content/content.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {Content} from '@components';
import {RenderComponent} from '@lib/renderer';
import {expect} from '@storybook/jest';
import type {ComponentStory, Meta} from '@storybook/react';
import {within} from '@storybook/testing-library';

import {FormikDecorator} from '../../../tests/utils/decorators';

const meta: Meta<typeof Content> = {
title: 'Components / Formio / Content',
component: Content,
decorators: [],
parameters: {},
};
export default meta;

export const content: ComponentStory<typeof RenderComponent> = args => (
<RenderComponent {...args} />
);
content.args = {
component: {
key: 'foo',
type: 'content',
html: 'The <b>quick</b> brown fox jumps over the lazy dog.',
},
};
content.play = async ({canvasElement}) => {
const canvas = within(canvasElement);
expect(await canvas.findByText('quick')).toBeVisible();
};
content.decorators = [FormikDecorator];
File renamed without changes.
3 changes: 3 additions & 0 deletions src/components/formio/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './columns';
export * from './content';
export * from './textfield';
File renamed without changes.
Loading

0 comments on commit 69e9a83

Please sign in to comment.