1
0
mirror of synced 2024-12-02 01:26:02 +03:00
select2/control/test/multi-select.unit.test.tsx
2019-06-25 15:23:14 -07:00

43 lines
1.2 KiB
TypeScript

import { h } from 'preact';
import { MultiSelect } from '../src/multi-select';
import { countries } from './countries';
import { query, shallow } from './preact-util';
const forceImportOfH = h;
describe('MultiSelect', () => {
it('renders with empty values', () => {
const tree = shallow(
<MultiSelect
itemId='id'
itemLabel='text'
valuesLabel='Selected Values'
comboboxLabel='Add Value'
values={[]}
query={query}
onChange={() => {
/* noop */
}}
/>
);
expect(tree).toMatchSnapshot();
});
it('renders with values', () => {
const tree = shallow(
<MultiSelect
itemId='id'
itemLabel='text'
valuesLabel='Selected Values'
comboboxLabel='Add Value'
values={[countries[0], countries[1]]}
query={query}
onChange={() => {
/* noop */
}}
/>
);
expect(tree).toMatchSnapshot();
});
});