fix pagination for list views (#9425)

This commit is contained in:
ʈᵃᵢ
2020-04-01 09:20:17 -07:00
committed by GitHub
parent a9ff51bd61
commit 893c95521b
6 changed files with 224 additions and 148 deletions

View File

@@ -22,6 +22,7 @@ import { act } from 'react-dom/test-utils';
import { MenuItem, Pagination } from 'react-bootstrap';
import ListView from 'src/components/ListView/ListView';
import ListViewPagination from 'src/components/ListView/Pagination';
import { areArraysShallowEqual } from 'src/reduxUtils';
describe('ListView', () => {
@@ -159,10 +160,15 @@ describe('ListView', () => {
]
`);
});
it('renders pagination controls', () => {
expect(wrapper.find(Pagination).exists()).toBe(true);
expect(wrapper.find(Pagination.Prev).exists()).toBe(true);
expect(wrapper.find(Pagination.Item).exists()).toBe(true);
expect(wrapper.find(Pagination.Next).exists()).toBe(true);
});
it('calls fetchData on page change', () => {
act(() => {
wrapper.find(Pagination).prop('onSelect')(2);
wrapper.find(ListViewPagination).prop('onChange')(2);
});
wrapper.update();

View File

@@ -94,8 +94,7 @@ describe('DashboardList', () => {
`"/http//localhost/api/v1/dashboard/?q={%22order_column%22:%22changed_on%22,%22order_direction%22:%22desc%22,%22page%22:0,%22page_size%22:25}"`,
);
});
it('edits', async () => {
it('edits', () => {
expect(wrapper.find(PropertiesModal)).toHaveLength(0);
wrapper
.find('.fa-pencil')