Skip to content

Commit

Permalink
feat(InfiniteHits): Add class to load more button (#1787)
Browse files Browse the repository at this point in the history
  • Loading branch information
adlenafane authored and bobylito committed Dec 30, 2016
1 parent 27f67e2 commit 416febd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/react-instantsearch/src/components/InfiniteHits.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class InfiniteHits extends Component {
<ItemComponent key={hit.objectID} hit={hit} />
);
const loadMoreButton = hasMore ?
<button onClick={() => refine()}>Load more</button> :
<button disabled>Load more</button>;
<button {...cx('reset')} onClick={() => refine()}>Load more</button> :
<button {...cx('reset')} disabled>Load more</button>;

return (
<div {...cx('root')}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('Hits', () => {
/>
);
expect(mockedRefine.mock.calls.length).toBe(0);
wrapped.find('button').simulate('click');
wrapped.find('.ais-InfiniteHits__reset').simulate('click');
expect(mockedRefine.mock.calls.length).toBe(1);
});

Expand All @@ -50,6 +50,6 @@ describe('Hits', () => {
hasMore={false}
/>
);
expect(wrapped.find('button').props().disabled).toBe(true);
expect(wrapped.find('.ais-InfiniteHits__reset').props().disabled).toBe(true);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ exports[`Hits accepts a hitComponent prop 1`] = `
}
} />
<button
className="ais-InfiniteHits__reset"
disabled={true}>
Load more
</button>
Expand Down

0 comments on commit 416febd

Please sign in to comment.