Skip to content

Commit c090ea7

Browse files
fabiobTheSharpieOne
authored andcommitted
fix(PaginationLink): handle empty children array correctly (#511) (#604)
1 parent 8b4d7fe commit c090ea7

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/PaginationLink.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const PaginationLink = (props) => {
4848
}
4949

5050
let children = props.children;
51-
if (children && !children.length) {
51+
if (children && Array.isArray(children) && children.length === 0) {
5252
children = null;
5353
}
5454

src/__tests__/PaginationLink.spec.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,15 @@ describe('PaginationLink', () => {
6060
expect(wrapper.find('.sr-only').text()).toBe('Yo');
6161
});
6262

63-
it('should render custom caret', () => {
63+
it('should render custom caret specified as a string', () => {
6464
const wrapper = shallow(<PaginationLink next>Yo</PaginationLink>);
6565

6666
expect(wrapper.find({ 'aria-hidden': 'true' }).text()).toBe('Yo');
6767
});
68+
69+
it('should render custom caret specified as a component', () => {
70+
const wrapper = shallow(<PaginationLink next><span>Yo</span></PaginationLink>);
71+
72+
expect(wrapper.find({ 'aria-hidden': 'true' }).text()).toBe('Yo');
73+
});
6874
});

0 commit comments

Comments
 (0)