mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Add first try of Webapp Component Test
Add `ìd` to the SocialMedia data
This commit is contained in:
parent
3294cffa88
commit
2af9b853a1
@ -71,6 +71,12 @@ describe('my-social-media.vue', () => {
|
|||||||
const socialMediaLink = wrapper.find('a').attributes().href
|
const socialMediaLink = wrapper.find('a').attributes().href
|
||||||
expect(socialMediaLink).toBe(socialMediaUrl)
|
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', () => {
|
describe('currentUser does not have a social media account linked', () => {
|
||||||
|
|||||||
@ -28,6 +28,7 @@
|
|||||||
class="layout-leave-active"
|
class="layout-leave-active"
|
||||||
/>
|
/>
|
||||||
<a
|
<a
|
||||||
|
name="delete"
|
||||||
@click="handleDeleteSocialMedia(link)"
|
@click="handleDeleteSocialMedia(link)"
|
||||||
>
|
>
|
||||||
<ds-icon name="trash"/>
|
<ds-icon name="trash"/>
|
||||||
@ -74,13 +75,13 @@ export default {
|
|||||||
socialMediaLinks() {
|
socialMediaLinks() {
|
||||||
const { socialMedia = [] } = this.currentUser
|
const { socialMedia = [] } = this.currentUser
|
||||||
return socialMedia.map(socialMedia => {
|
return socialMedia.map(socialMedia => {
|
||||||
const { url } = socialMedia
|
const { id, url } = socialMedia
|
||||||
const matches = url.match(
|
const matches = url.match(
|
||||||
/^(?:https?:\/\/)?(?:[^@\n])?(?:www\.)?([^:\/\n?]+)/g
|
/^(?:https?:\/\/)?(?:[^@\n])?(?:www\.)?([^:\/\n?]+)/g
|
||||||
)
|
)
|
||||||
const [domain] = matches || []
|
const [domain] = matches || []
|
||||||
const favicon = domain ? `${domain}/favicon.ico` : null
|
const favicon = domain ? `${domain}/favicon.ico` : null
|
||||||
return { url, favicon }
|
return { id, url, favicon }
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user