Add test for invisible pagination buttons

This commit is contained in:
Wolfgang Huß 2022-05-16 11:39:48 +02:00
parent 9f2d1c4c74
commit 6b9fbc920e
3 changed files with 39 additions and 45 deletions

View File

@ -127,7 +127,6 @@ bobsSendings.forEach((sending) => {
confirmed: true,
})
})
// Wolle: console.log('bobsSum: ', bobsSum)
export const creations: CreationInterface[] = [
{

View File

@ -407,29 +407,34 @@ describe('GddTransactionList', () => {
})
describe('pagination buttons', () => {
const createTransaction = (idx) => {
return {
amount: '3.14',
balanceDate: '2021-04-29T17:26:40+00:00',
decay: {
decay: '-477.01',
start: '2021-05-13T17:46:31.000Z',
end: '2022-04-20T06:51:25.000Z',
duration: 29509494,
},
memo: 'Kreiszahl PI',
linkedUser: {
firstName: 'Bibi',
lastName: 'Bloxberg',
},
id: idx + 1,
typeId: 'RECEIVE',
balance: '33.33',
}
}
beforeEach(async () => {
const transactionCount = 42
await wrapper.setProps({
transactions: Array.from({ length: 42 }, (_, idx) => {
return {
amount: '3.14',
balanceDate: '2021-04-29T17:26:40+00:00',
decay: {
decay: '-477.01',
start: '2021-05-13T17:46:31.000Z',
end: '2022-04-20T06:51:25.000Z',
duration: 29509494,
},
memo: 'Kreiszahl PI',
linkedUser: {
firstName: 'Bibi',
lastName: 'Bloxberg',
},
id: idx + 1,
typeId: 'RECEIVE',
balance: '33.33',
}
transactions: Array.from({ length: transactionCount }, (_, idx) => {
return createTransaction(idx)
}),
transactionCount: 42,
transactionCount,
decayStartBlock,
pageSize: 25,
showPagination: true,
@ -449,28 +454,21 @@ describe('GddTransactionList', () => {
)
})
})
})
describe.skip('show no pagination', () => {
// Wolle: beforeEach(async () => {
// await wrapper.setProps({
// transactions: [],
// transactionCount: 2,
// decayStartBlock,
// pageSize: 25,
// showPagination: false,
// })
// })
it('shows no pagination buttons', async () => {
await wrapper.setProps({
transactions: [],
transactionCount: 2,
decayStartBlock,
pageSize: 25,
showPagination: false,
describe('show no pagination', () => {
it('shows no pagination buttons', async () => {
const transactionCount = 2
await wrapper.setProps({
transactions: Array.from({ length: transactionCount }, (_, idx) => {
return createTransaction(idx)
}),
transactionCount,
decayStartBlock,
pageSize: 25,
showPagination: false,
})
expect(wrapper.find('ul.pagination').exists()).toBe(false)
})
expect(wrapper.find('ul.pagination').exists()).toBe(false)
})
})
})

View File

@ -125,10 +125,6 @@ export default {
},
computed: {
isPaginationVisible() {
// Wolle: console.log('this.showPagination: ', this.showPagination)
// console.log('this.pageSize: ', this.pageSize)
// console.log('this.transactions.length: ', this.transactions.length)
// console.log('this.transactionCount: ', this.transactionCount)
return this.showPagination && this.pageSize < this.transactionCount
},
},
@ -143,6 +139,7 @@ export default {
},
}
</script>
<style>
collaps-icon {
width: 95%;