mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge pull request #2577 from gradido/2560-style-and-design-send-link
refactor(frontend): link send result style
This commit is contained in:
commit
d7c970063f
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -437,7 +437,7 @@ jobs:
|
|||||||
report_name: Coverage Frontend
|
report_name: Coverage Frontend
|
||||||
type: lcov
|
type: lcov
|
||||||
result_path: ./coverage/lcov.info
|
result_path: ./coverage/lcov.info
|
||||||
min_coverage: 92
|
min_coverage: 93
|
||||||
token: ${{ github.token }}
|
token: ${{ github.token }}
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|||||||
@ -1,17 +1,31 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="clipboard-copy">
|
<div class="clipboard-copy">
|
||||||
<div v-if="canCopyLink" size="lg" class="mb-5">
|
<div v-if="canCopyLink" class="mb-5">
|
||||||
<div class="d-flex">
|
<div>
|
||||||
<div>
|
<label>{{ $t('gdd_per_link.copy-link') }}</label>
|
||||||
<label>{{ $t('gdd_per_link.copy-link') }}</label>
|
<div
|
||||||
<div class="pointer text-center bg-secondary gradido-border-radius p-4" @click="copyLink">
|
class="pointer text-center bg-secondary gradido-border-radius p-3"
|
||||||
{{ link }}
|
@click="copyLink"
|
||||||
|
data-test="copyLink"
|
||||||
|
>
|
||||||
|
{{ link }}
|
||||||
|
<div>
|
||||||
|
<b-button class="p-4">
|
||||||
|
<b-icon icon="link45deg"></b-icon>
|
||||||
|
</b-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-5">
|
</div>
|
||||||
<label>{{ $t('gdd_per_link.copy-link-with-text') }}</label>
|
<div class="mt-5">
|
||||||
|
<label>{{ $t('gdd_per_link.copy-link-with-text') }}</label>
|
||||||
|
<div
|
||||||
|
class="pointer text-center bg-secondary gradido-border-radius p-3"
|
||||||
|
data-test="copyLinkWithText"
|
||||||
|
@click="copyLinkWithText"
|
||||||
|
>
|
||||||
|
{{ linkText }}
|
||||||
<div>
|
<div>
|
||||||
<b-button @click="copyLinkWithText" class="p-4">
|
<b-button class="p-4">
|
||||||
<b-icon icon="link45deg"></b-icon>
|
<b-icon icon="link45deg"></b-icon>
|
||||||
</b-button>
|
</b-button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -10,6 +10,12 @@ const mocks = {
|
|||||||
$tc: jest.fn((tc) => tc),
|
$tc: jest.fn((tc) => tc),
|
||||||
$t: jest.fn((t) => t),
|
$t: jest.fn((t) => t),
|
||||||
$d: jest.fn((d) => d),
|
$d: jest.fn((d) => d),
|
||||||
|
$store: {
|
||||||
|
state: {
|
||||||
|
firstName: 'Bibi',
|
||||||
|
lastName: 'Bloxberg',
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const propsData = {
|
const propsData = {
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
:memo="memo"
|
:memo="memo"
|
||||||
:validUntil="validUntil"
|
:validUntil="validUntil"
|
||||||
></clipboard-copy>
|
></clipboard-copy>
|
||||||
|
<label>{{ $t('qrCode') }}</label>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<div><figure-qr-code :link="link" /></div>
|
<div><figure-qr-code :link="link" /></div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@ -17,6 +17,12 @@ const mocks = {
|
|||||||
$apollo: {
|
$apollo: {
|
||||||
query: apolloQueryMock,
|
query: apolloQueryMock,
|
||||||
},
|
},
|
||||||
|
$store: {
|
||||||
|
state: {
|
||||||
|
firstName: 'Bibi',
|
||||||
|
lastName: 'Bloxberg',
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const propsData = {
|
const propsData = {
|
||||||
@ -102,10 +108,10 @@ describe('TransactionLinkSummary', () => {
|
|||||||
|
|
||||||
describe('click on transaction links', () => {
|
describe('click on transaction links', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
wrapper.find('div.transaction-slot-link').trigger('click')
|
wrapper.find('div.row').trigger('click')
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('calls the API to get the list transaction links', () => {
|
it('calls the API to get the list transaction links', () => {
|
||||||
expect(apolloQueryMock).toBeCalledWith({
|
expect(apolloQueryMock).toBeCalledWith({
|
||||||
query: listTransactionLinks,
|
query: listTransactionLinks,
|
||||||
variables: {
|
variables: {
|
||||||
@ -115,14 +121,14 @@ describe('TransactionLinkSummary', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('has four transactionLinks', () => {
|
it('has four transactionLinks', () => {
|
||||||
expect(wrapper.vm.transactionLinks).toHaveLength(4)
|
expect(wrapper.vm.transactionLinks).toHaveLength(4)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('close transaction link details', () => {
|
describe('close transaction link details', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.clearAllMocks()
|
jest.clearAllMocks()
|
||||||
wrapper.find('div.transaction-slot-link').trigger('click')
|
wrapper.find('div.row').trigger('click')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('does not call the API', () => {
|
it('does not call the API', () => {
|
||||||
@ -136,10 +142,10 @@ describe('TransactionLinkSummary', () => {
|
|||||||
describe('reopen transaction link details', () => {
|
describe('reopen transaction link details', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.clearAllMocks()
|
jest.clearAllMocks()
|
||||||
wrapper.find('div.transaction-slot-link').trigger('click')
|
wrapper.find('div.row').trigger('click')
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('calls the API to get the list transaction links', () => {
|
it('calls the API to get the list transaction links', () => {
|
||||||
expect(apolloQueryMock).toBeCalledWith({
|
expect(apolloQueryMock).toBeCalledWith({
|
||||||
query: listTransactionLinks,
|
query: listTransactionLinks,
|
||||||
variables: {
|
variables: {
|
||||||
@ -149,7 +155,7 @@ describe('TransactionLinkSummary', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('has four transactionLinks', () => {
|
it('has four transactionLinks', () => {
|
||||||
expect(wrapper.vm.transactionLinks).toHaveLength(4)
|
expect(wrapper.vm.transactionLinks).toHaveLength(4)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -215,7 +221,7 @@ describe('TransactionLinkSummary', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('has eight transactionLinks', () => {
|
it('has eight transactionLinks', () => {
|
||||||
expect(wrapper.vm.transactionLinks).toHaveLength(4)
|
expect(wrapper.vm.transactionLinks).toHaveLength(8)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('loads more transaction links', () => {
|
it('loads more transaction links', () => {
|
||||||
@ -230,19 +236,19 @@ describe('TransactionLinkSummary', () => {
|
|||||||
|
|
||||||
describe('close transaction link list', () => {
|
describe('close transaction link list', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
wrapper.find('div.transaction-slot-link').trigger('click')
|
wrapper.find('div.row').trigger('click')
|
||||||
})
|
})
|
||||||
describe('reopen transaction link list', () => {
|
describe('reopen transaction link list', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
jest.clearAllMocks()
|
jest.clearAllMocks()
|
||||||
wrapper.find('div.transaction-slot-link').trigger('click')
|
wrapper.find('div.row').trigger('click')
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('calls the API once', () => {
|
it('calls the API once', () => {
|
||||||
expect(apolloQueryMock).toBeCalledTimes(1)
|
expect(apolloQueryMock).toBeCalledTimes(1)
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('calls the API with current page one', () => {
|
it('calls the API with current page one', () => {
|
||||||
expect(apolloQueryMock).toBeCalledWith({
|
expect(apolloQueryMock).toBeCalledWith({
|
||||||
query: listTransactionLinks,
|
query: listTransactionLinks,
|
||||||
variables: {
|
variables: {
|
||||||
@ -289,10 +295,10 @@ describe('TransactionLinkSummary', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe.skip('loads transaction links with error', () => {
|
describe('loads transaction links with error', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
apolloQueryMock.mockRejectedValue({ message: 'OUCH!' })
|
apolloQueryMock.mockRejectedValue({ message: 'OUCH!' })
|
||||||
wrapper.find('div.transaction-slot-link').trigger('click')
|
wrapper.find('div.row').trigger('click')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('toasts an error message', () => {
|
it('toasts an error message', () => {
|
||||||
|
|||||||
@ -24,15 +24,7 @@ export const copyLinks = {
|
|||||||
},
|
},
|
||||||
copyLinkWithText() {
|
copyLinkWithText() {
|
||||||
navigator.clipboard
|
navigator.clipboard
|
||||||
.writeText(
|
.writeText(this.linkText)
|
||||||
`${this.link}
|
|
||||||
${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${this.amount} Gradido.
|
|
||||||
"${this.memo}"
|
|
||||||
${this.$t('gdd_per_link.credit-your-gradido')} ${this.$t('gdd_per_link.validUntilDate', {
|
|
||||||
date: this.$d(new Date(this.validUntil), 'short'),
|
|
||||||
})}
|
|
||||||
${this.$t('gdd_per_link.link-hint')}`,
|
|
||||||
)
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.toastSuccess(this.$t('gdd_per_link.link-and-text-copied'))
|
this.toastSuccess(this.$t('gdd_per_link.link-and-text-copied'))
|
||||||
})
|
})
|
||||||
@ -42,4 +34,15 @@ ${this.$t('gdd_per_link.link-hint')}`,
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
linkText() {
|
||||||
|
return `${this.link}
|
||||||
|
${this.$store.state.firstName} ${this.$t('transaction-link.send_you')} ${this.amount} Gradido.
|
||||||
|
"${this.memo}"
|
||||||
|
${this.$t('gdd_per_link.credit-your-gradido')} ${this.$t('gdd_per_link.validUntilDate', {
|
||||||
|
date: this.$d(new Date(this.validUntil), 'short'),
|
||||||
|
})}
|
||||||
|
${this.$t('gdd_per_link.link-hint')}`
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -254,7 +254,7 @@ describe('Send', () => {
|
|||||||
describe('copy link with success', () => {
|
describe('copy link with success', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
navigatorClipboardMock.mockResolvedValue()
|
navigatorClipboardMock.mockResolvedValue()
|
||||||
await wrapper.find('.pointer').trigger('click')
|
await wrapper.find('div[data-test="copyLink"]').trigger('click')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should call clipboard.writeText', () => {
|
it('should call clipboard.writeText', () => {
|
||||||
@ -270,7 +270,7 @@ describe('Send', () => {
|
|||||||
describe('copy link with error', () => {
|
describe('copy link with error', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
navigatorClipboardMock.mockRejectedValue()
|
navigatorClipboardMock.mockRejectedValue()
|
||||||
await wrapper.find('.clipboard-copy').find('.btn-secondary').trigger('click')
|
await wrapper.find('div[data-test="copyLink"]').trigger('click')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('toasts error message', () => {
|
it('toasts error message', () => {
|
||||||
@ -292,7 +292,7 @@ describe('Send', () => {
|
|||||||
describe('copy link and text with success', () => {
|
describe('copy link and text with success', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
navigatorClipboardMock.mockResolvedValue()
|
navigatorClipboardMock.mockResolvedValue()
|
||||||
await wrapper.findAll('button').at(0).trigger('click')
|
await wrapper.find('div[data-test="copyLinkWithText"]').trigger('click')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should call clipboard.writeText', () => {
|
it('should call clipboard.writeText', () => {
|
||||||
@ -312,7 +312,7 @@ describe('Send', () => {
|
|||||||
describe('copy link and text with error', () => {
|
describe('copy link and text with error', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
navigatorClipboardMock.mockRejectedValue()
|
navigatorClipboardMock.mockRejectedValue()
|
||||||
await wrapper.findAll('button').at(0).trigger('click')
|
await wrapper.find('div[data-test="copyLinkWithText"]').trigger('click')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('toasts error message', () => {
|
it('toasts error message', () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user