diff --git a/__tests__/PaginationBoxView-test.js b/__tests__/PaginationBoxView-test.js index 659c3624..d6d60c75 100755 --- a/__tests__/PaginationBoxView-test.js +++ b/__tests__/PaginationBoxView-test.js @@ -790,6 +790,32 @@ describe('Test custom props', () => { }); }); + describe('activeStyle', () => { + it('should use activeStyle prop when defined', () => { + const pagination = ReactTestUtils.renderIntoDocument( + + ); + + const pageItem = ReactDOM.findDOMNode(pagination).querySelector( + 'li:nth-child(3) a' + ); + ReactTestUtils.Simulate.click(pageItem); + + expect( + ReactDOM.findDOMNode(pagination).querySelector( + 'li:nth-child(3) a' + ).style + ).toHaveProperty('background-color', 'red'); + expect( + ReactDOM.findDOMNode(pagination).querySelector( + 'li:nth-child(3) a' + ).style + ).toHaveProperty('color', 'rgb(255, 255, 255)'); + }); + }); + describe('pageClassName/activeClassName', () => { it('should use the pageClassName prop when defined', () => { const pagination = ReactTestUtils.renderIntoDocument( diff --git a/react_components/PageView.js b/react_components/PageView.js index aff18669..2efa10de 100755 --- a/react_components/PageView.js +++ b/react_components/PageView.js @@ -6,6 +6,7 @@ import PropTypes from 'prop-types'; const PageView = props => { let pageClassName = props.pageClassName; let pageLinkClassName = props.pageLinkClassName; + let pageLinkStyle = props.pageLinkStyle; const onClick = props.onClick; const href = props.href; @@ -35,6 +36,8 @@ const PageView = props => { } else { pageLinkClassName = props.activeLinkClassName; } + + pageLinkStyle = props.activeStyle; } return ( @@ -43,6 +46,7 @@ const PageView = props => { onClick={onClick} role="button" className={pageLinkClassName} + style={pageLinkStyle} href={href} tabIndex="0" aria-label={ariaLabel} @@ -60,6 +64,7 @@ PageView.propTypes = { selected: PropTypes.bool.isRequired, pageClassName: PropTypes.string, pageLinkClassName: PropTypes.string, + activeStyle: PropTypes.object, activeClassName: PropTypes.string, activeLinkClassName: PropTypes.string, extraAriaContext: PropTypes.string, diff --git a/react_components/PaginationBoxView.js b/react_components/PaginationBoxView.js index 10a68916..cc9afb7d 100755 --- a/react_components/PaginationBoxView.js +++ b/react_components/PaginationBoxView.js @@ -22,6 +22,7 @@ export default class PaginationBoxView extends Component { pageClassName: PropTypes.string, pageLinkClassName: PropTypes.string, activeClassName: PropTypes.string, + activeStyle: PropTypes.object, activeLinkClassName: PropTypes.string, previousClassName: PropTypes.string, nextClassName: PropTypes.string, @@ -39,6 +40,7 @@ export default class PaginationBoxView extends Component { pageRangeDisplayed: 2, marginPagesDisplayed: 3, activeClassName: 'selected', + activeStyle: {}, previousClassName: 'previous', nextClassName: 'next', previousLabel: 'Previous', @@ -192,6 +194,7 @@ export default class PaginationBoxView extends Component { pageClassName, pageLinkClassName, activeClassName, + activeStyle, activeLinkClassName, extraAriaContext, } = this.props; @@ -204,6 +207,7 @@ export default class PaginationBoxView extends Component { pageClassName={pageClassName} pageLinkClassName={pageLinkClassName} activeClassName={activeClassName} + activeStyle={activeStyle} activeLinkClassName={activeLinkClassName} extraAriaContext={extraAriaContext} href={this.hrefBuilder(index)}