Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-paginate

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-paginate - npm Package Compare versions

Comparing version 6.3.0 to 6.3.1

70

__tests__/PaginationBoxView-test.js

@@ -410,10 +410,22 @@ import React from 'react';

marginPagesDisplayed={2}
ariaLabelBuilder={(page, selected) => selected ? 'Current page' : 'Goto page ' + page } />
ariaLabelBuilder={(page, selected) =>
selected ? 'Current page' : 'Goto page ' + page
}
/>
);
expect(ReactDOM.findDOMNode(linkedPagination).querySelector('li:nth-last-child(2) a')
.getAttribute('aria-label')).toBe('Goto page 3');
expect(ReactDOM.findDOMNode(linkedPagination).querySelector('li:nth-child(2) a')
.getAttribute('aria-label')).toBe('Goto page 1');
expect(ReactDOM.findDOMNode(linkedPagination).querySelector('.selected a')
.getAttribute('aria-label')).toBe('Current page');
expect(
ReactDOM.findDOMNode(linkedPagination)
.querySelector('li:nth-last-child(2) a')
.getAttribute('aria-label')
).toBe('Goto page 3');
expect(
ReactDOM.findDOMNode(linkedPagination)
.querySelector('li:nth-child(2) a')
.getAttribute('aria-label')
).toBe('Goto page 1');
expect(
ReactDOM.findDOMNode(linkedPagination)
.querySelector('.selected a')
.getAttribute('aria-label')
).toBe('Current page');
});

@@ -428,11 +440,23 @@

marginPagesDisplayed={2}
ariaLabelBuilder={(page, selected) => selected ? 'Current page' : 'Goto page ' + page }
extraAriaContext="foobar" />
ariaLabelBuilder={(page, selected) =>
selected ? 'Current page' : 'Goto page ' + page
}
extraAriaContext="foobar"
/>
);
expect(ReactDOM.findDOMNode(linkedPagination).querySelector('li:nth-last-child(2) a')
.getAttribute('aria-label')).toBe('Goto page 3 foobar');
expect(ReactDOM.findDOMNode(linkedPagination).querySelector('li:nth-child(2) a')
.getAttribute('aria-label')).toBe('Goto page 1 foobar');
expect(ReactDOM.findDOMNode(linkedPagination).querySelector('.selected a')
.getAttribute('aria-label')).toBe('Current page');
expect(
ReactDOM.findDOMNode(linkedPagination)
.querySelector('li:nth-last-child(2) a')
.getAttribute('aria-label')
).toBe('Goto page 3 foobar');
expect(
ReactDOM.findDOMNode(linkedPagination)
.querySelector('li:nth-child(2) a')
.getAttribute('aria-label')
).toBe('Goto page 1 foobar');
expect(
ReactDOM.findDOMNode(linkedPagination)
.querySelector('.selected a')
.getAttribute('aria-label')
).toBe('Current page');
});

@@ -768,2 +792,18 @@ });

});
it('should update forcePage and hence selected page when forcePage value is changed', () => {
const node = document.createElement('div');
const pagination1 = ReactDOM.render(
<PaginationBoxView forcePage={2} />,
node
);
const pagination2 = ReactDOM.render(
<PaginationBoxView forcePage={3} />,
node
);
expect(
ReactDOM.findDOMNode(pagination2).querySelector('.selected a')
.textContent
).toBe('4');
});
});

@@ -770,0 +810,0 @@

@@ -207,6 +207,6 @@ 'use strict';

}, {
key: 'UNSAFE_componentWillReceiveProps',
value: function UNSAFE_componentWillReceiveProps(nextProps) {
if (typeof nextProps.forcePage !== 'undefined' && this.props.forcePage !== nextProps.forcePage) {
this.setState({ selected: nextProps.forcePage });
key: 'componentDidUpdate',
value: function componentDidUpdate(prevProps) {
if (typeof this.props.forcePage !== 'undefined' && this.props.forcePage !== prevProps.forcePage) {
this.setState({ selected: this.props.forcePage });
}

@@ -213,0 +213,0 @@ }

@@ -0,1 +1,5 @@

## >= 6.3.1
- Handle 'forcePage' value if set from outside (see: https://github.com/AdeleD/react-paginate/pull/272).
## >= 6.3.0

@@ -2,0 +6,0 @@

{
"name": "react-paginate",
"version": "6.3.0",
"version": "6.3.1",
"description": "A ReactJS component that creates a pagination.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

@@ -86,8 +86,8 @@ 'use strict';

UNSAFE_componentWillReceiveProps(nextProps) {
componentDidUpdate(prevProps) {
if (
typeof nextProps.forcePage !== 'undefined' &&
this.props.forcePage !== nextProps.forcePage
typeof this.props.forcePage !== 'undefined' &&
this.props.forcePage !== prevProps.forcePage
) {
this.setState({ selected: nextProps.forcePage });
this.setState({ selected: this.props.forcePage });
}

@@ -94,0 +94,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc