cisco-sbg-ui / atomic-react

https://atomic-react.security.cisco.com
2 stars 5 forks source link

Pagination pages incorrect when total=[7..11] #1173

Closed paulmach closed 2 years ago

paulmach commented 2 years ago

Describe the bug

There is some issue with showing the last 3 pages for the pagination when there is some overlap between what is shown in the middle. See steps to reproduce and screen shot.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Pagination Usage 2'
  2. Update the total to 10.
  3. Click "Next" 4 times, so page 5 is selected
  4. See that pages 1, 2, 3, 4, 5, 6, 7 are show, 8, 9 10 are missing

Expected behavior In this case I'd want to see all 10 pages because: we show at least the first 3, We show +-2 for the current page and we show at least the last 3 pages. So in this case it'd be: 1,2,3 - 3,4,5,6,7 - 8,9,10

It's kind of weird, but right now it's not correct.

Screenshots

Screen Shot 2022-03-21 at 8 36 24 AM

Environment (please complete the following information): yarn dev os x

extra context The issues seems to be here https://github.com/cisco-sbg-ui/atomic-react/blob/master/framework/components/APagination/APagination.js#L191,L204

I can fix, but unsure how to test, should I just make more "usage N" things and use cypress, or is there a unit test framework.