Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EuiDroppable now accepts multiple children (TypeScript) #2634

Merged
merged 1 commit into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fixed `EuiCodeEditor` custom mode file error by initializing with existing mode ([#2616](https://github.com/elastic/eui/pull/2616))
- Removed `EuiIcon` default titles ([#2632](https://github.com/elastic/eui/pull/2632))
- Fixed `EuiDroppable` not accepting multiple children when using TypeScript ([#2634](https://github.com/elastic/eui/pull/2634))

## [`17.1.1`](https://github.com/elastic/eui/tree/v17.1.1)

Expand Down
15 changes: 15 additions & 0 deletions src/components/drag_and_drop/__snapshots__/droppable.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ exports[`EuiDroppable can be given ReactElement children 1`] = `
</div>
`;

exports[`EuiDroppable can be given multiple ReactElement children 1`] = `
<div
class="euiDroppable euiDroppable--noGrow"
data-react-beautiful-dnd-droppable="3"
data-test-subj="droppable"
>
<div />
<div />
<div />
<div
class="euiDroppable__placeholder"
/>
</div>
`;

exports[`EuiDroppable is rendered 1`] = `
<div
class="euiDroppable euiDroppable--noGrow"
Expand Down
15 changes: 15 additions & 0 deletions src/components/drag_and_drop/droppable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ describe('EuiDroppable', () => {
expect(component).toMatchSnapshot();
});

test('can be given multiple ReactElement children', () => {
const handler = jest.fn();
const component = render(
<EuiDragDropContext onDragEnd={handler} {...requiredProps}>
<EuiDroppable droppableId="testDroppable">
<div />
<div />
<div />
</EuiDroppable>
</EuiDragDropContext>
);

expect(component).toMatchSnapshot();
});

describe('custom behavior', () => {
describe('cloneDraggables', () => {
const handler = jest.fn();
Expand Down
2 changes: 1 addition & 1 deletion src/components/drag_and_drop/droppable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export type EuiDroppableSpacing = keyof typeof spacingToClassNameMap;
export interface EuiDroppableProps
extends CommonProps,
Omit<DroppableProps, 'children'> {
children: ReactElement | DroppableProps['children'];
children: ReactElement | ReactElement[] | DroppableProps['children'];
className?: string;
/**
* Makes its items immutable. Dragging creates cloned items that can be dropped elsewhere.
Expand Down