remove the member area entry from sidebar menu and adjust the unit tests accordingly

This commit is contained in:
mahula 2022-07-27 22:16:53 +02:00
parent 7fdba919ca
commit 67453c8a27
2 changed files with 31 additions and 7 deletions

View File

@ -31,11 +31,7 @@ describe('Sidebar', () => {
expect(wrapper.find('div#component-sidebar').exists()).toBeTruthy()
})
describe('navigation Navbar', () => {
it('has seven b-nav-item in the navbar', () => {
expect(wrapper.findAll('.nav-item')).toHaveLength(8)
})
describe('navigation Navbar (general elements)', () => {
it('has first nav-item "navigation.overview" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(0).text()).toEqual('navigation.overview')
})
@ -55,7 +51,12 @@ describe('Sidebar', () => {
it('has first nav-item "navigation.profile" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(4).text()).toEqual('navigation.profile')
})
})
// ----
describe('navigation Navbar (user has an elopage account)', () => {
it('has seven b-nav-item in the navbar', () => {
expect(wrapper.findAll('.nav-item')).toHaveLength(8)
})
it('has a link to the members area', () => {
expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.members_area')
expect(wrapper.findAll('.nav-item').at(5).find('a').attributes('href')).toBe('#')
@ -69,5 +70,20 @@ describe('Sidebar', () => {
expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.logout')
})
})
describe('navigation Navbar (user has no elopage account)', () => {
beforeAll(() => {
mocks.$store.state.hasElopage = false
wrapper = Wrapper()
})
it('has six b-nav-item in the navbar', () => {
expect(wrapper.findAll('.nav-item')).toHaveLength(7)
})
it('has first nav-item "navigation.admin_area" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.admin_area')
})
it('has first nav-item "navigation.logout" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.logout')
})
})
})
})

View File

@ -27,9 +27,17 @@
</b-nav>
<hr />
<b-nav vertical class="w-100">
<b-nav-item v-if="$store.state.hasElopage" class="mb-3" :href="elopageUri" target="_blank">
<b-nav-item
v-if="$store.state.hasElopage"
class="mb-3"
:href="elopageUri"
target="_blank"
>
<b-icon icon="link45deg" aria-hidden="true"></b-icon>
{{ $t('navigation.members_area') }}
<b-badge v-if="!$store.state.hasElopage" pill variant="danger">
{{ $t('math.exclaim') }}
</b-badge>
</b-nav-item>
<b-nav-item class="mb-3" v-if="$store.state.isAdmin" @click="$emit('admin')">
<b-icon icon="shield-check" aria-hidden="true"></b-icon>