File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,6 +48,10 @@ const PaginationLink = (props) => {
4848 }
4949
5050 let children = props . children ;
51+ if ( children && ! children . length ) {
52+ children = null ;
53+ }
54+
5155 if ( previous || next ) {
5256 children = [
5357 < span
Original file line number Diff line number Diff line change @@ -37,6 +37,22 @@ describe('PaginationLink', () => {
3737 expect ( wrapper . find ( '.sr-only' ) . text ( ) ) . toBe ( 'Next' ) ;
3838 } ) ;
3939
40+ it ( 'should render default previous caret with children as an empty array' , ( ) => {
41+ const wrapper = shallow ( < PaginationLink previous children = { [ ] } /> ) ;
42+
43+ expect ( wrapper . prop ( 'aria-label' ) ) . toBe ( 'Previous' ) ;
44+ expect ( wrapper . find ( { 'aria-hidden' : 'true' } ) . text ( ) ) . toBe ( '\u00ab' ) ;
45+ expect ( wrapper . find ( '.sr-only' ) . text ( ) ) . toBe ( 'Previous' ) ;
46+ } ) ;
47+
48+ it ( 'should render default next caret with children as an empty array' , ( ) => {
49+ const wrapper = shallow ( < PaginationLink next children = { [ ] } /> ) ;
50+
51+ expect ( wrapper . prop ( 'aria-label' ) ) . toBe ( 'Next' ) ;
52+ expect ( wrapper . find ( { 'aria-hidden' : 'true' } ) . text ( ) ) . toBe ( '\u00bb' ) ;
53+ expect ( wrapper . find ( '.sr-only' ) . text ( ) ) . toBe ( 'Next' ) ;
54+ } ) ;
55+
4056 it ( 'should render custom aria label' , ( ) => {
4157 const wrapper = shallow ( < PaginationLink next aria-label = "Yo" /> ) ;
4258
You can’t perform that action at this time.
0 commit comments