mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
change props in tests for transaction links + zaubersprüche
This commit is contained in:
parent
f5b0ef2265
commit
78a1459971
@ -19,7 +19,7 @@ const propsData = {
|
||||
createdAt: '2022-03-16T14:22:40.000Z',
|
||||
holdAvailableAmount: '5.13109484759482747111',
|
||||
id: 87,
|
||||
memo: 'asdasdaadsdd asd asdadss',
|
||||
memo: 'Eene meene Siegerpreis, vor mir steht ein Schokoeis. Hex-hex!',
|
||||
redeemedAt: null,
|
||||
validUntil: '2022-03-30T14:22:40.000Z',
|
||||
},
|
||||
@ -29,13 +29,15 @@ const propsData = {
|
||||
createdAt: '2022-03-16T14:22:40.000Z',
|
||||
holdAvailableAmount: '5.13109484759482747111',
|
||||
id: 86,
|
||||
memo: 'asdasdaadsdd asd asdadss',
|
||||
memo: 'Eene meene buntes Laub, auf dem Schrank da liegt kein Staub.',
|
||||
redeemedAt: null,
|
||||
validUntil: '2022-03-30T14:22:40.000Z',
|
||||
},
|
||||
],
|
||||
transactionLinkCount: 3,
|
||||
value: { currentPage: 1, pending: false, pageSize: 5 },
|
||||
value: 1,
|
||||
pending: false,
|
||||
pageSize: 5,
|
||||
}
|
||||
|
||||
describe('CollapseLinksList', () => {
|
||||
@ -59,9 +61,7 @@ describe('CollapseLinksList', () => {
|
||||
})
|
||||
|
||||
it('emits input', () => {
|
||||
expect(wrapper.emitted('input')).toEqual([
|
||||
[{ currentPage: 2, pageSize: 5, pending: false }],
|
||||
])
|
||||
expect(wrapper.emitted('input')).toEqual([[2]])
|
||||
})
|
||||
})
|
||||
|
||||
@ -73,9 +73,7 @@ describe('CollapseLinksList', () => {
|
||||
})
|
||||
|
||||
it('emits input ', () => {
|
||||
expect(wrapper.emitted('input')).toEqual([
|
||||
[{ currentPage: 0, pageSize: 5, pending: false }],
|
||||
])
|
||||
expect(wrapper.emitted('input')).toEqual([[0]])
|
||||
})
|
||||
})
|
||||
|
||||
@ -83,7 +81,9 @@ describe('CollapseLinksList', () => {
|
||||
describe('one more link to load', () => {
|
||||
beforeEach(async () => {
|
||||
await wrapper.setProps({
|
||||
value: { currentPage: 1, pending: false, pageSize: 5 },
|
||||
value: 1,
|
||||
pending: false,
|
||||
pageSize: 5,
|
||||
})
|
||||
})
|
||||
|
||||
@ -95,7 +95,9 @@ describe('CollapseLinksList', () => {
|
||||
describe('less than pageSize links to load', () => {
|
||||
beforeEach(async () => {
|
||||
await wrapper.setProps({
|
||||
value: { currentPage: 1, pending: false, pageSize: 5 },
|
||||
value: 1,
|
||||
pending: false,
|
||||
pageSize: 5,
|
||||
transactionLinkCount: 6,
|
||||
})
|
||||
})
|
||||
@ -108,7 +110,9 @@ describe('CollapseLinksList', () => {
|
||||
describe('more than pageSize links to load', () => {
|
||||
beforeEach(async () => {
|
||||
await wrapper.setProps({
|
||||
value: { currentPage: 1, pending: false, pageSize: 5 },
|
||||
value: 1,
|
||||
pending: false,
|
||||
pageSize: 5,
|
||||
transactionLinkCount: 16,
|
||||
})
|
||||
})
|
||||
|
||||
@ -42,23 +42,24 @@ export default {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
value: { type: Object, required: true },
|
||||
value: { type: Number, required: true },
|
||||
pageSize: { type: Number, default: 5 },
|
||||
pending: { type: Boolean, default: false },
|
||||
},
|
||||
methods: {
|
||||
resetTransactionLinkList() {
|
||||
this.$emit('input', { ...this.value, currentPage: 0 })
|
||||
this.$emit('input', 0)
|
||||
},
|
||||
loadMoreLinks() {
|
||||
this.$emit('input', { ...this.value, currentPage: this.value.currentPage + 1 })
|
||||
this.$emit('input', this.value + 1)
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
buttonText() {
|
||||
const i = this.transactionLinkCount - this.transactionLinks.length
|
||||
if (i === 1) return this.$tc('link-load', 0)
|
||||
if (i <= this.value.pageSize) return this.$tc('link-load', 1, { n: i })
|
||||
return this.$tc('link-load', 2, { n: this.value.pageSize })
|
||||
if (i <= this.pageSize) return this.$tc('link-load', 1, { n: i })
|
||||
return this.$tc('link-load', 2, { n: this.pageSize })
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -117,11 +117,9 @@ describe('TransactionLinksSummary', () => {
|
||||
beforeEach(async () => {
|
||||
jest.clearAllMocks()
|
||||
await wrapper.setData({
|
||||
variables: {
|
||||
currentPage: 0,
|
||||
pending: false,
|
||||
pageSize: 5,
|
||||
},
|
||||
currentPage: 0,
|
||||
pending: false,
|
||||
pageSize: 5,
|
||||
})
|
||||
})
|
||||
|
||||
@ -197,11 +195,9 @@ describe('TransactionLinksSummary', () => {
|
||||
},
|
||||
})
|
||||
await wrapper.setData({
|
||||
variables: {
|
||||
currentPage: 2,
|
||||
pending: false,
|
||||
pageSize: 5,
|
||||
},
|
||||
currentPage: 2,
|
||||
pending: false,
|
||||
pageSize: 5,
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@ -26,8 +26,9 @@
|
||||
|
||||
<b-collapse v-model="visible">
|
||||
<collapse-links-list
|
||||
v-model="variables"
|
||||
v-model="currentPage"
|
||||
:pending="pending"
|
||||
:pageSize="pageSize"
|
||||
:transactionLinkCount="transactionLinkCount"
|
||||
:transactionLinks="transactionLinks"
|
||||
/>
|
||||
@ -72,10 +73,8 @@ export default {
|
||||
return {
|
||||
visible: false,
|
||||
transactionLinks: [],
|
||||
variables: {
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
},
|
||||
currentPage: 1,
|
||||
pageSize: 5,
|
||||
pending: false,
|
||||
}
|
||||
},
|
||||
@ -83,7 +82,7 @@ export default {
|
||||
async updateListTransactionLinks() {
|
||||
if (this.currentPage === 0) {
|
||||
this.transactionLinks = []
|
||||
this.variables.currentPage = 1
|
||||
this.currentPage = 1
|
||||
} else {
|
||||
this.pending = true
|
||||
this.$apollo
|
||||
@ -106,11 +105,6 @@ export default {
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
currentPage() {
|
||||
return this.variables.currentPage
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
currentPage() {
|
||||
this.updateListTransactionLinks()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user