Skip to content

Commit

Permalink
Merge pull request #78 from kenshoo/fix_unselect_bug
Browse files Browse the repository at this point in the history
fix unselect bug
  • Loading branch information
liorheber authored Mar 29, 2018
2 parents 7653685 + 2b7793c commit 2d973f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/destination_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const DestinationList = ({
items={selectedItems}
itemHeight={itemHeight}
height={height - 45}
onClick={id => unselectItems([id])}
onClick={(event, id) => unselectItems([id])}
renderer={selectedItemRenderer}
noItemsRenderer={noItemsRenderer}
noItemsMessage={messages.noItemsMessage}
Expand Down
5 changes: 3 additions & 2 deletions tests/components/destination_list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const custom_messages = {

const unselectItems = jest.fn().mockName("unselectItems");
const clearAll = jest.fn().mockName("clearAll");
const ID = 1;

describe("DestinationList", () => {
test("default snapshot", () => {
Expand Down Expand Up @@ -90,7 +91,7 @@ describe("DestinationList", () => {
const onClick = jest.fn();
const component = shallow(<DestinationList unselectItems={onClick} />);
const list = component.find(List).at(0);
list.simulate("click", {});
expect(onClick).toHaveBeenCalledWith([{}]);
list.simulate("click", {}, ID);
expect(onClick).toHaveBeenCalledWith([ID]);
});
});

0 comments on commit 2d973f4

Please sign in to comment.