зеркало из https://github.com/mozilla/treeherder.git
Bug 1720839 - Fix pagination to show all pages when nr of pages < 5 (#7214)
This commit is contained in:
Родитель
1545bf6ccc
Коммит
f5a4e8b8ae
|
@ -333,6 +333,11 @@ test('page parameter updates with value 2 when clicking on the second page', asy
|
|||
findAllByLabelText('pagination-button-2'),
|
||||
);
|
||||
fireEvent.click(secondPage[0]);
|
||||
|
||||
const firstPage = await waitFor(() =>
|
||||
findAllByLabelText('pagination-button-1'),
|
||||
);
|
||||
expect(firstPage[0]).toBeInTheDocument();
|
||||
expect(mockUpdateParams).toHaveBeenLastCalledWith({ page: 2 });
|
||||
});
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ export default class CompareTableControls extends React.Component {
|
|||
|
||||
getCurrentPages = () => {
|
||||
const { page, totalPagesList } = this.state;
|
||||
if (totalPagesList.length === 5 || !totalPagesList.length) {
|
||||
if (totalPagesList.length <= 5 || !totalPagesList.length) {
|
||||
return totalPagesList;
|
||||
}
|
||||
return totalPagesList.slice(page - 1, page + 4);
|
||||
|
|
Загрузка…
Ссылка в новой задаче