Add first try of Webapp Component Test

Add `ìd` to the SocialMedia data
This commit is contained in:
Wolfgang Huß 2019-05-04 10:13:40 +02:00
parent 3294cffa88
commit 2af9b853a1
2 changed files with 9 additions and 2 deletions

View File

@ -71,6 +71,12 @@ describe('my-social-media.vue', () => {
const socialMediaLink = wrapper.find('a').attributes().href
expect(socialMediaLink).toBe(socialMediaUrl)
})
it('displays a trash sympol after a social media', () => {
wrapper = Wrapper()
iconName = wrapper.find('.ds-icon').attributes().name
expect(iconName).toBe('trash')
})
})
describe('currentUser does not have a social media account linked', () => {

View File

@ -28,6 +28,7 @@
class="layout-leave-active"
/>
<a
name="delete"
@click="handleDeleteSocialMedia(link)"
>
<ds-icon name="trash"/>
@ -74,13 +75,13 @@ export default {
socialMediaLinks() {
const { socialMedia = [] } = this.currentUser
return socialMedia.map(socialMedia => {
const { url } = socialMedia
const { id, url } = socialMedia
const matches = url.match(
/^(?:https?:\/\/)?(?:[^@\n])?(?:www\.)?([^:\/\n?]+)/g
)
const [domain] = matches || []
const favicon = domain ? `${domain}/favicon.ico` : null
return { url, favicon }
return { id, url, favicon }
})
}
},