1
0
mirror of synced 2024-11-29 16:16:02 +03:00
select2/control/test/multi-select.unit.test.tsx

43 lines
1.2 KiB
TypeScript
Raw Normal View History

2019-06-26 01:23:14 +03:00
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();
});
});