Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mfrances17 committed Jan 29, 2024
1 parent 37dc6d2 commit 48a9303
Show file tree
Hide file tree
Showing 3 changed files with 199 additions and 1,674 deletions.
Original file line number Diff line number Diff line change
@@ -1,64 +1,30 @@
import { render } from '@testing-library/react';
import { DualListSelector } from '../../DualListSelector';
import { DualListSelectorPane } from '../../DualListSelector';
import React from 'react';

describe('DualListSelector', () => {
test('basic', () => {
const { asFragment } = render(<DualListSelector availableOptions={['Option 1', 'Option 2']} id="firstTest" />);
const { asFragment } = render(<DualListSelectorPane options={['Option 1', 'Option 2']} id="firstTest" />);
expect(asFragment()).toMatchSnapshot();
});

test('with search inputs', () => {
const { asFragment } = render(
<DualListSelector availableOptions={['Option 1', 'Option 2']} id="secondTest" isSearchable />
<DualListSelectorPane options={['Option 1', 'Option 2']} id="secondTest" isSearchable />
);
expect(asFragment()).toMatchSnapshot();
});

test('with custom status', () => {
const { asFragment } = render(
<DualListSelector
availableOptions={['Option 1', 'Option 2']}
availableOptionsStatus="Test status1"
chosenOptionsStatus="Test status2"
id="thirdTest"
/>
<DualListSelectorPane options={['Option 1', 'Option 2']} status="Test status1" id="thirdTest" />
);
expect(asFragment()).toMatchSnapshot();
});

test('basic with disabled controls', () => {
const { asFragment } = render(
<DualListSelector isDisabled availableOptions={['Option 1', 'Option 2']} id="disabledTest" />
);
expect(asFragment()).toMatchSnapshot();
});

test('with tree', () => {
const { asFragment } = render(
<DualListSelector
availableOptions={[
{ id: 'O1', text: 'Opt1', defaultExpanded: true, children: [{ id: 'O3', text: 'Opt3' }] },
{ id: 'O2', text: 'Opt2' }
]}
availableOptionsStatus="Test status1"
chosenOptionsStatus="Test status2"
id="tree-test"
isTree
/>
);
expect(asFragment()).toMatchSnapshot();
});

test('with actions', () => {
const { asFragment } = render(
<DualListSelector
availableOptions={['Option 1', 'Option 2']}
chosenOptions={['Option 3', 'Option 4']}
availableOptionsActions={[<span key={1}>TestNode1</span>]}
chosenOptionsActions={[<span key={2}>TestNode2</span>]}
id="fourthTest"
/>
<DualListSelectorPane options={['Option 1', 'Option 2']} id="disabledTest" isDisabled />
);
expect(asFragment()).toMatchSnapshot();
});
Expand Down
Loading

0 comments on commit 48a9303

Please sign in to comment.