mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge pull request #2902 from gradido/2818-pagination-is-not-reset-when-switching-tabs
fix(admin): pagination set currentPage by switch tabs
This commit is contained in:
commit
38759981f0
@ -39,7 +39,7 @@ const mocks = {
|
|||||||
const defaultData = () => {
|
const defaultData = () => {
|
||||||
return {
|
return {
|
||||||
adminListContributions: {
|
adminListContributions: {
|
||||||
contributionCount: 2,
|
contributionCount: 30,
|
||||||
contributionList: [
|
contributionList: [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
@ -407,6 +407,44 @@ describe('CreationConfirm', () => {
|
|||||||
statusFilter: ['IN_PROGRESS', 'PENDING', 'CONFIRMED', 'DENIED', 'DELETED'],
|
statusFilter: ['IN_PROGRESS', 'PENDING', 'CONFIRMED', 'DENIED', 'DELETED'],
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('change pagination', () => {
|
||||||
|
it('has pagination buttons', () => {
|
||||||
|
expect(wrapper.findComponent({ name: 'BPagination' }).exists()).toBe(true)
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('next page', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.clearAllMocks()
|
||||||
|
wrapper.findComponent({ name: 'BPagination' }).vm.$emit('input', 2)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('calls the API again', () => {
|
||||||
|
expect(adminListContributionsMock).toBeCalledWith({
|
||||||
|
currentPage: 2,
|
||||||
|
order: 'DESC',
|
||||||
|
pageSize: 25,
|
||||||
|
statusFilter: ['IN_PROGRESS', 'PENDING', 'CONFIRMED', 'DENIED', 'DELETED'],
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('click tab "open" again', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
jest.clearAllMocks()
|
||||||
|
await wrapper.find('a[data-test="open"]').trigger('click')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('refetches contributions with proper filter and current page = 1', () => {
|
||||||
|
expect(adminListContributionsMock).toBeCalledWith({
|
||||||
|
currentPage: 1,
|
||||||
|
order: 'DESC',
|
||||||
|
pageSize: 25,
|
||||||
|
statusFilter: ['IN_PROGRESS', 'PENDING'],
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -116,6 +116,11 @@ export default {
|
|||||||
pageSize: 25,
|
pageSize: 25,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
tabIndex() {
|
||||||
|
this.currentPage = 1
|
||||||
|
},
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
deleteCreation() {
|
deleteCreation() {
|
||||||
this.$apollo
|
this.$apollo
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user