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, confirmed: true,
}) })
}) })
// Wolle: console.log('bobsSum: ', bobsSum)
export const creations: CreationInterface[] = [ export const creations: CreationInterface[] = [
{ {

View File

@ -407,29 +407,34 @@ describe('GddTransactionList', () => {
}) })
describe('pagination buttons', () => { 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 () => { beforeEach(async () => {
const transactionCount = 42
await wrapper.setProps({ await wrapper.setProps({
transactions: Array.from({ length: 42 }, (_, idx) => { transactions: Array.from({ length: transactionCount }, (_, idx) => {
return { return createTransaction(idx)
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',
}
}), }),
transactionCount: 42, transactionCount,
decayStartBlock, decayStartBlock,
pageSize: 25, pageSize: 25,
showPagination: true, showPagination: true,
@ -449,28 +454,21 @@ describe('GddTransactionList', () => {
) )
}) })
}) })
})
describe.skip('show no pagination', () => { describe('show no pagination', () => {
// Wolle: beforeEach(async () => { it('shows no pagination buttons', async () => {
// await wrapper.setProps({ const transactionCount = 2
// transactions: [], await wrapper.setProps({
// transactionCount: 2, transactions: Array.from({ length: transactionCount }, (_, idx) => {
// decayStartBlock, return createTransaction(idx)
// pageSize: 25, }),
// showPagination: false, transactionCount,
// }) decayStartBlock,
// }) pageSize: 25,
showPagination: false,
it('shows no pagination buttons', async () => { })
await wrapper.setProps({ expect(wrapper.find('ul.pagination').exists()).toBe(false)
transactions: [],
transactionCount: 2,
decayStartBlock,
pageSize: 25,
showPagination: false,
}) })
expect(wrapper.find('ul.pagination').exists()).toBe(false)
}) })
}) })
}) })

View File

@ -125,10 +125,6 @@ export default {
}, },
computed: { computed: {
isPaginationVisible() { 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 return this.showPagination && this.pageSize < this.transactionCount
}, },
}, },
@ -143,6 +139,7 @@ export default {
}, },
} }
</script> </script>
<style> <style>
collaps-icon { collaps-icon {
width: 95%; width: 95%;