web: components: Moved story for FilterInput + added base test

This commit is contained in:
Alexey Safronov 2019-09-07 14:04:31 +03:00
parent 607390cba3
commit 544eb23d73
3 changed files with 26 additions and 11 deletions

View File

@ -13,14 +13,11 @@ FilterInput description
#### Usage
```js
<FilterInput
getFilterData={() => [ { key: 'filter-example', group: 'filter-example', label: 'example group', isHeader: true },
{ key: '0', group: 'filter-example', label: 'Test' }]
}
getSortData={() => [ { key: 'name', label: 'Name' },
{ key: 'surname', label: 'Surname']
onFilter={(result) => {console.log(result)}}
/>
<FilterInput
getFilterData={() => [{ key: 'filter-example', group: 'filter-example', label: 'example group', isHeader: true }, { key: '0', group: 'filter-example', label: 'Test' }]}
getSortData={() => [{ key: 'name', label: 'Name' }, { key: 'surname', label: 'Surname' }]}
onFilter={(result) => { console.log(result) }}
/>
```

View File

@ -2,10 +2,11 @@ import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { StringValue } from 'react-values';
import { withKnobs, boolean, text, select, number } from '@storybook/addon-knobs/react';
import { withKnobs, boolean, text, select } from '@storybook/addon-knobs/react';
import withReadme from 'storybook-readme/with-readme';
import Readme from '../README.md';
import { FilterInput, Button } from 'asc-web-components';
import Readme from './README.md';
import FilterInput from '.';
import Button from '../button';
import Section from '../../../.storybook/decorators/section';
const sizeOptions = ['base', 'middle', 'big', 'huge'];

View File

@ -0,0 +1,17 @@
import React from 'react';
import { mount } from 'enzyme';
import FilterInput from '.';
describe('<FilterInput />', () => {
it('renders without error', () => {
const wrapper = mount(
<FilterInput
getFilterData={() => [{ key: 'filter-example', group: 'filter-example', label: 'example group', isHeader: true }, { key: '0', group: 'filter-example', label: 'Test' }]}
getSortData={() => [{ key: 'name', label: 'Name' }, { key: 'surname', label: 'Surname' }]}
onFilter={(result) => { console.log(result) }}
/>
);
expect(wrapper).toExist();
});
});