change object variables, pending extra, chnage text in tests

This commit is contained in:
ogerly 2022-03-17 17:58:17 +01:00
parent 6b2cd9716d
commit 4a7a4f28cf
4 changed files with 12 additions and 15 deletions

View File

@ -100,7 +100,7 @@ describe('CollapseLinksList', () => {
})
})
it('renders text in plural and shows the correct count of links, () => {
it('renders text in plural and shows the correct count of links', () => {
expect(mocks.$tc).toBeCalledWith('link-load', 1, { n: 4 })
})
})

View File

@ -13,19 +13,16 @@
<div class="mb-3">
<b-button
class="test-button-load-more"
v-if="!value.pending && transactionLinks.length < transactionLinkCount"
v-if="!pending && transactionLinks.length < transactionLinkCount"
block
variant="outline-primary"
@click="loadMoreLinks"
>
{{ buttonText }}
</b-button>
<b-icon
v-if="value.pending"
icon="three-dots"
animation="cylon"
font-scale="4"
></b-icon>
<div class="text-center">
<b-icon v-if="pending" icon="three-dots" animation="cylon" font-scale="4"></b-icon>
</div>
</div>
</div>
</div>
@ -46,6 +43,7 @@ export default {
required: true,
},
value: { type: Object, required: true },
pending: { type: Boolean, default: false },
},
methods: {
resetTransactionLinkList() {

View File

@ -60,9 +60,7 @@ describe('TransactionLink', () => {
})
it('toasts success message', () => {
expect(toastSuccessSpy).toBeCalledWith(
'gdd_per_link.link-copied' + '\n' + 'http://localhost/redeem/c00000000c000000c0000',
)
expect(toastSuccessSpy).toBeCalledWith('gdd_per_link.link-copied')
})
})

View File

@ -28,6 +28,7 @@
<b-collapse v-model="visible">
<collapse-links-list
v-model="variables"
:pending="pending"
:transactionLinkCount="transactionLinkCount"
:transactionLinks="transactionLinks"
/>
@ -74,9 +75,9 @@ export default {
transactionLinks: [],
variables: {
currentPage: 1,
pending: false,
pageSize: 5,
},
pending: false,
}
},
methods: {
@ -85,7 +86,7 @@ export default {
this.transactionLinks = []
this.variables.currentPage = 1
} else {
this.variables.pending = true
this.pending = true
this.$apollo
.query({
query: listTransactionLinks,
@ -97,11 +98,11 @@ export default {
.then((result) => {
this.transactionLinks = [...this.transactionLinks, ...result.data.listTransactionLinks]
this.$emit('update-transactions')
this.variables.pending = false
this.pending = false
})
.catch((err) => {
this.toastError(err.message)
this.variables.pending = false
this.pending = false
})
}
},