mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
test link to send with param email
This commit is contained in:
parent
ec354eafad
commit
f0132593b8
@ -0,0 +1,61 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import AmountAndNameRow from './AmountAndNameRow'
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
const mocks = {}
|
||||
|
||||
const propsData = {
|
||||
amount: '19.99',
|
||||
text: 'Some text',
|
||||
}
|
||||
|
||||
describe('AmountAndNameRow', () => {
|
||||
let wrapper
|
||||
|
||||
const Wrapper = () => {
|
||||
return mount(AmountAndNameRow, { localVue, mocks, propsData })
|
||||
}
|
||||
|
||||
describe('mount', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('renders the component', () => {
|
||||
expect(wrapper.find('div.amount-and-name-row').exists()).toBe(true)
|
||||
})
|
||||
|
||||
describe('without linked user', () => {
|
||||
it('has a span with the text', () => {
|
||||
expect(wrapper.find('div.gdd-transaction-list-item-name').text()).toBe('Some text')
|
||||
})
|
||||
|
||||
it('has no link', () => {
|
||||
expect(wrapper.find('div.gdd-transaction-list-item-name').find('a').exists()).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('with linked user', () => {
|
||||
beforeEach(async () => {
|
||||
await wrapper.setProps({
|
||||
linkedUser: { firstName: 'Bibi', lastName: 'Bloxberg', email: 'bibi@bloxberg.de' },
|
||||
})
|
||||
})
|
||||
|
||||
it('has a link with first and last name', () => {
|
||||
expect(wrapper.find('div.gdd-transaction-list-item-name').text()).toBe('Bibi Bloxberg')
|
||||
})
|
||||
|
||||
it('has a link', () => {
|
||||
expect(wrapper.find('div.gdd-transaction-list-item-name').find('a').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('links with param email', () => {
|
||||
expect(
|
||||
wrapper.find('div.gdd-transaction-list-item-name').find('a').attributes('href'),
|
||||
).toBe('/send?email=bibi@bloxberg.de')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -10,7 +10,11 @@
|
||||
</b-col>
|
||||
<b-col cols="7">
|
||||
<div class="gdd-transaction-list-item-name">
|
||||
<b-link v-if="linkedUser" :href="`/send?email=${linkedUser.email}`" @click.stop>
|
||||
<b-link
|
||||
v-if="linkedUser && linkedUser.email"
|
||||
:href="`/send?email=${linkedUser.email}`"
|
||||
@click.stop
|
||||
>
|
||||
{{ itemText }}
|
||||
</b-link>
|
||||
<span v-else>{{ itemText }}</span>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user