Skip to content

Commit

Permalink
GH-28 Tests for the bug
Browse files Browse the repository at this point in the history
  • Loading branch information
amivanoff committed Sep 24, 2021
1 parent b5cbcd6 commit 483c69c
Show file tree
Hide file tree
Showing 4 changed files with 687 additions and 529 deletions.
1 change: 0 additions & 1 deletion stories/AntdCardCell.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ export const Full: Story<{}> = () => {

const client = new SparqlClientImpl('https://rdf4j.agentlab.ru/rdf4j-server');
const rootStore = createUiModelFromState('mktp', client, rootModelInitialState, additionalColls);
console.log('rootStore', rootStore);
const store: any = asReduxStore(rootStore);
// eslint-disable-next-line @typescript-eslint/no-var-requires
connectReduxDevtools(require('remotedev'), rootStore);
Expand Down
89 changes: 53 additions & 36 deletions stories/TreeTableFormMktp.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* SPDX-License-Identifier: GPL-3.0-only
********************************************************************************/
import { cloneDeep } from 'lodash-es';
import moment from 'moment';
import React from 'react';
import { Story, Meta } from '@storybook/react';
Expand Down Expand Up @@ -35,6 +36,43 @@ import {
import { viewKindCollConstr, viewDescrCollConstr } from '../src/models/ViewCollConstrs';
import { createUiModelFromState } from '../src/models/MstViewDescr';

export default {
title: 'Several Controls/Tree-Table-Form',
component: Form,
argTypes: {
backgroundColor: { control: 'color' },
},
} as Meta;

const Template: Story = (args: any) => {
const antdRenderers: RendererRegistryEntry[] = [
...antdControlRenderers,
...antdLayoutRenderers,
...antdDataControlRenderers,
...tableRenderers,
];

//const client = new SparqlClientImpl('https://rdf4j.agentlab.ru/rdf4j-server');
//const rootStore = createUiModelFromState('mktp', client, rootModelInitialState, additionalColls);
const client = new SparqlClientImpl(
'https://rdf4j.agentlab.ru/rdf4j-server',
'https://rdf4j.agentlab.ru/rdf4j-server/repositories/mktp/namespaces',
);
const rootStore = createUiModelFromState('mktp-fed', client, rootModelInitialState, args.additionalColls);
const store: any = asReduxStore(rootStore);
// eslint-disable-next-line @typescript-eslint/no-var-requires
connectReduxDevtools(require('remotedev'), rootStore);
return (
<div style={{ height: 'calc(100vh - 32px)' }}>
<Provider store={store}>
<MstContextProvider store={rootStore} renderers={antdRenderers} cells={antdCells}>
<Form viewDescrId={args.viewDescrId} viewDescrCollId={args.viewDescrCollId} />
</MstContextProvider>
</Provider>
</div>
);
};

const viewKinds = [
{
'@id': 'mktp:TreeTableFormMktpCategoriesViewKind',
Expand Down Expand Up @@ -118,13 +156,13 @@ const viewKinds = [
width: '100%',
height: '100%',
},
height: 'all-empty-space',
//width: 'all-empty-space',
defaultSize: {
'mktp:MarketplacesTabs': '17%',
'mktp:CategoryCardsTable': '43%',
'mktp:CategoryCardForm': '43%',
},
height: 'all-empty-space',
//width: 'all-empty-space',
},
elements: [
{
Expand Down Expand Up @@ -426,39 +464,18 @@ const additionalColls: CollState[] = [
},
];

export default {
title: 'Several Controls/Tree-Table-Form',
component: Form,
argTypes: {
backgroundColor: { control: 'color' },
},
} as Meta;

export const MktpCategories: Story<{}> = () => {
const antdRenderers: RendererRegistryEntry[] = [
...antdControlRenderers,
...antdLayoutRenderers,
...antdDataControlRenderers,
...tableRenderers,
];
export const MktpCategories100Percent = Template.bind({});
MktpCategories100Percent.args = {
additionalColls,
viewDescrId: viewDescrs[0]['@id'],
viewDescrCollId: viewDescrCollConstr['@id'],
};

//const client = new SparqlClientImpl('https://rdf4j.agentlab.ru/rdf4j-server');
//const rootStore = createUiModelFromState('mktp', client, rootModelInitialState, additionalColls);
const client = new SparqlClientImpl(
'https://rdf4j.agentlab.ru/rdf4j-server',
'https://rdf4j.agentlab.ru/rdf4j-server/repositories/mktp/namespaces',
);
const rootStore = createUiModelFromState('mktp-fed', client, rootModelInitialState, additionalColls);
const store: any = asReduxStore(rootStore);
// eslint-disable-next-line @typescript-eslint/no-var-requires
connectReduxDevtools(require('remotedev'), rootStore);
return (
<div style={{ height: 'calc(100vh - 32px)' }}>
<Provider store={store}>
<MstContextProvider store={rootStore} renderers={antdRenderers} cells={antdCells}>
<Form viewDescrId={viewDescrs[0]['@id']} viewDescrCollId={viewDescrCollConstr['@id']} />
</MstContextProvider>
</Provider>
</div>
);
export const MktpCategories50Percent = Template.bind({});
const additionalColls50 = cloneDeep(additionalColls);
additionalColls50[0].data[0].elements[0].options.style.height = '50%';
MktpCategories50Percent.args = {
additionalColls: additionalColls50,
viewDescrId: viewDescrs[0]['@id'],
viewDescrCollId: viewDescrCollConstr['@id'],
};
Loading

0 comments on commit 483c69c

Please sign in to comment.