mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
unify pagination to use currentPage, pageSize and order as values
This commit is contained in:
parent
175bffcc05
commit
69bb8b7ea7
@ -32,8 +32,8 @@ export const loginViaEmailVerificationCode = gql`
|
|||||||
`
|
`
|
||||||
|
|
||||||
export const transactionsQuery = gql`
|
export const transactionsQuery = gql`
|
||||||
query($firstPage: Int = 1, $items: Int = 25, $order: String = "DESC") {
|
query($currentPage: Int = 1, $pageSize: Int = 25, $order: String = "DESC") {
|
||||||
transactionList(firstPage: $firstPage, items: $items, order: $order) {
|
transactionList(currentPage: $currentPage, pageSize: $pageSize, order: $order) {
|
||||||
gdtSum
|
gdtSum
|
||||||
count
|
count
|
||||||
balance
|
balance
|
||||||
|
|||||||
@ -189,7 +189,7 @@ describe('DashboardLayoutGdd', () => {
|
|||||||
})
|
})
|
||||||
await wrapper
|
await wrapper
|
||||||
.findComponent({ ref: 'router-view' })
|
.findComponent({ ref: 'router-view' })
|
||||||
.vm.$emit('update-transactions', { firstPage: 2, items: 5 })
|
.vm.$emit('update-transactions', { currentPage: 2, pageSize: 5 })
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -197,8 +197,8 @@ describe('DashboardLayoutGdd', () => {
|
|||||||
expect(apolloMock).toBeCalledWith(
|
expect(apolloMock).toBeCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
variables: {
|
variables: {
|
||||||
firstPage: 2,
|
currentPage: 2,
|
||||||
items: 5,
|
pageSize: 5,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
@ -233,7 +233,7 @@ describe('DashboardLayoutGdd', () => {
|
|||||||
})
|
})
|
||||||
await wrapper
|
await wrapper
|
||||||
.findComponent({ ref: 'router-view' })
|
.findComponent({ ref: 'router-view' })
|
||||||
.vm.$emit('update-transactions', { firstPage: 2, items: 5 })
|
.vm.$emit('update-transactions', { currentPage: 2, pageSize: 5 })
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -110,8 +110,8 @@ export default {
|
|||||||
.query({
|
.query({
|
||||||
query: transactionsQuery,
|
query: transactionsQuery,
|
||||||
variables: {
|
variables: {
|
||||||
firstPage: pagination.firstPage,
|
currentPage: pagination.currentPage,
|
||||||
items: pagination.items,
|
pageSize: pagination.pageSize,
|
||||||
},
|
},
|
||||||
fetchPolicy: 'network-only',
|
fetchPolicy: 'network-only',
|
||||||
})
|
})
|
||||||
|
|||||||
@ -327,7 +327,9 @@ describe('GddTransactionList', () => {
|
|||||||
|
|
||||||
it('emits update-transactions when next button is clicked', async () => {
|
it('emits update-transactions when next button is clicked', async () => {
|
||||||
await paginationButtons.find('button.next-page').trigger('click')
|
await paginationButtons.find('button.next-page').trigger('click')
|
||||||
expect(wrapper.emitted('update-transactions')[1]).toEqual([{ firstPage: 2, items: 25 }])
|
expect(wrapper.emitted('update-transactions')[1]).toEqual([
|
||||||
|
{ currentPage: 2, pageSize: 25 },
|
||||||
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('shows text "2 / 2" when next button is clicked', async () => {
|
it('shows text "2 / 2" when next button is clicked', async () => {
|
||||||
@ -348,7 +350,9 @@ describe('GddTransactionList', () => {
|
|||||||
it('emits update-transactions when preivous button is clicked after next buton', async () => {
|
it('emits update-transactions when preivous button is clicked after next buton', async () => {
|
||||||
await paginationButtons.find('button.next-page').trigger('click')
|
await paginationButtons.find('button.next-page').trigger('click')
|
||||||
await paginationButtons.find('button.previous-page').trigger('click')
|
await paginationButtons.find('button.previous-page').trigger('click')
|
||||||
expect(wrapper.emitted('update-transactions')[2]).toEqual([{ firstPage: 1, items: 25 }])
|
expect(wrapper.emitted('update-transactions')[2]).toEqual([
|
||||||
|
{ currentPage: 1, pageSize: 25 },
|
||||||
|
])
|
||||||
expect(scrollToMock).toBeCalled()
|
expect(scrollToMock).toBeCalled()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -134,8 +134,8 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
updateTransactions() {
|
updateTransactions() {
|
||||||
this.$emit('update-transactions', {
|
this.$emit('update-transactions', {
|
||||||
firstPage: this.currentPage,
|
currentPage: this.currentPage,
|
||||||
items: this.pageSize,
|
pageSize: this.pageSize,
|
||||||
})
|
})
|
||||||
window.scrollTo(0, 0)
|
window.scrollTo(0, 0)
|
||||||
},
|
},
|
||||||
|
|||||||
@ -36,16 +36,16 @@ describe('UserProfileTransactionList', () => {
|
|||||||
|
|
||||||
it('emits update-transactions after creation', () => {
|
it('emits update-transactions after creation', () => {
|
||||||
expect(wrapper.emitted('update-transactions')).toEqual(
|
expect(wrapper.emitted('update-transactions')).toEqual(
|
||||||
expect.arrayContaining([expect.arrayContaining([{ firstPage: 1, items: 25 }])]),
|
expect.arrayContaining([expect.arrayContaining([{ currentPage: 1, pageSize: 25 }])]),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('emist update-transactions when update-transactions is called', () => {
|
it('emist update-transactions when update-transactions is called', () => {
|
||||||
wrapper
|
wrapper
|
||||||
.findComponent({ name: 'GddTransactionList' })
|
.findComponent({ name: 'GddTransactionList' })
|
||||||
.vm.$emit('update-transactions', { firstPage: 2, items: 25 })
|
.vm.$emit('update-transactions', { currentPage: 2, pageSize: 25 })
|
||||||
expect(wrapper.emitted('update-transactions')).toEqual(
|
expect(wrapper.emitted('update-transactions')).toEqual(
|
||||||
expect.arrayContaining([expect.arrayContaining([{ firstPage: 2, items: 25 }])]),
|
expect.arrayContaining([expect.arrayContaining([{ currentPage: 2, pageSize: 25 }])]),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user