Skip to content

Commit

Permalink
feat(component): add test to check if onRowDrop is called
Browse files Browse the repository at this point in the history
  • Loading branch information
animesh1987 committed Jan 12, 2021
1 parent 2a85714 commit f04ffcf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 394 deletions.
14 changes: 5 additions & 9 deletions packages/big-design/src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const InternalTable = <T extends TableItem>(props: TableProps<T>): React.ReactEl
);

const renderDroppableItems = () => (
<Droppable droppableId="bd-droppable">
<Droppable droppableId={`${uniqueTableId}-bd-droppable`}>
{(provided) => (
<Body withFirstRowBorder={headerless} ref={provided.innerRef} {...provided.droppableProps}>
{items.map((item: T, index) => {
Expand Down Expand Up @@ -205,13 +205,6 @@ const InternalTable = <T extends TableItem>(props: TableProps<T>): React.ReactEl
return null;
};

const renderWithDragDropContext = () => (
<DragDropContext onDragEnd={onDragEnd}>
{renderHeaders()}
{renderItems()}
</DragDropContext>
);

return (
<>
{shouldRenderActions() && (
Expand All @@ -229,7 +222,10 @@ const InternalTable = <T extends TableItem>(props: TableProps<T>): React.ReactEl
)}
<StyledTable {...rest} id={tableIdRef.current}>
{onRowDrop ? (
renderWithDragDropContext()
<DragDropContext onDragEnd={onDragEnd}>
{renderHeaders()}
{renderItems()}
</DragDropContext>
) : (
<>
{renderHeaders()}
Expand Down
Loading

0 comments on commit f04ffcf

Please sign in to comment.