mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Fix: message for 0 connections not rendering
This commit is contained in:
parent
76def5f901
commit
09fb93fc9a
@ -75,6 +75,40 @@ describe('FollowList.vue', () => {
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('given a user without connections', () => {
|
||||||
|
;['following', 'followedBy'].forEach((type) =>
|
||||||
|
describe(`and type=${type}`, () => {
|
||||||
|
let wrapper
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
wrapper = mount(FollowList, {
|
||||||
|
store,
|
||||||
|
mocks: {
|
||||||
|
$t: jest.fn().mockReturnValue('has no connections'),
|
||||||
|
},
|
||||||
|
localVue,
|
||||||
|
propsData: {
|
||||||
|
user: {
|
||||||
|
...propsData.user,
|
||||||
|
followedByCount: 0,
|
||||||
|
followingCount: 0,
|
||||||
|
followedBy: [],
|
||||||
|
following: [],
|
||||||
|
},
|
||||||
|
type,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it('displays ne no-follower message', () => {
|
||||||
|
expect(wrapper.find('.no-connections-message').text()).toBe(
|
||||||
|
`${user.name} ${wrapper.vm.$t(`profile.network.${type}Nobody`)}`,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -84,6 +84,21 @@ const allConnectionsUser = {
|
|||||||
storiesOf('FollowList', module)
|
storiesOf('FollowList', module)
|
||||||
.addDecorator(withA11y)
|
.addDecorator(withA11y)
|
||||||
.addDecorator(helpers.layout)
|
.addDecorator(helpers.layout)
|
||||||
|
.add('without connections', () => {
|
||||||
|
const user = {
|
||||||
|
...sevenConnectionsUser,
|
||||||
|
followedBy: [],
|
||||||
|
followedByCount: 0,
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
components: { FollowList },
|
||||||
|
store: helpers.store,
|
||||||
|
data() {
|
||||||
|
return { user }
|
||||||
|
},
|
||||||
|
template: `<follow-list :user="user" type="followedBy" />`,
|
||||||
|
}
|
||||||
|
})
|
||||||
.add('with up to 7 connections', () => {
|
.add('with up to 7 connections', () => {
|
||||||
const user = sevenConnectionsUser
|
const user = sevenConnectionsUser
|
||||||
return {
|
return {
|
||||||
@ -94,7 +109,6 @@ storiesOf('FollowList', module)
|
|||||||
user,
|
user,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
template: `<follow-list :user="user" type="followedBy" />`,
|
template: `<follow-list :user="user" type="followedBy" />`,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -109,7 +123,6 @@ storiesOf('FollowList', module)
|
|||||||
user,
|
user,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
template: `<follow-list :user="user" type="followedBy" />`,
|
template: `<follow-list :user="user" type="followedBy" />`,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<base-card style="position: relative; height: 424px;">
|
<base-card style="position: relative; max-height: 424px;">
|
||||||
<ds-space v-if="this.connections && this.connections.length" margin="x-small">
|
<ds-space v-if="this.connections && this.connections.length" margin="x-small">
|
||||||
<ds-text tag="h5" color="soft">
|
<ds-text tag="h5" color="soft">
|
||||||
{{ userName | truncate(15) }} {{ $t(`profile.network.${type}`) }}
|
{{ userName | truncate(15) }} {{ $t(`profile.network.${type}`) }}
|
||||||
</ds-text>
|
</ds-text>
|
||||||
</ds-space>
|
</ds-space>
|
||||||
|
<template v-else>
|
||||||
|
<p class="no-connections-message">{{ userName }} {{ $t(`profile.network.${type}Nobody`) }}</p>
|
||||||
|
</template>
|
||||||
<ds-space v-if="this.connections && this.connections.length > 7" margin="x-small">
|
<ds-space v-if="this.connections && this.connections.length > 7" margin="x-small">
|
||||||
<ds-input
|
<ds-input
|
||||||
ref="filter"
|
ref="filter"
|
||||||
@ -45,11 +48,6 @@
|
|||||||
</ds-space>
|
</ds-space>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
|
||||||
<p style="text-align: center; opacity: 0.5;">
|
|
||||||
{{ userName }} {{ $t(`profile.network.${type}Nobody`) }}
|
|
||||||
</p>
|
|
||||||
</template>
|
|
||||||
</base-card>
|
</base-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -133,6 +131,10 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
.no-connections-message {
|
||||||
|
text-align: center;
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
.overflow-container {
|
.overflow-container {
|
||||||
max-height: 300px;
|
max-height: 300px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user