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

This commit is contained in:
mahula 2022-07-27 21:50:02 +02:00
parent 2c07ec98ab
commit a01c5a4b3f
2 changed files with 17 additions and 7 deletions

View File

@ -17,7 +17,7 @@ const mocks = {
$t: jest.fn((t) => t),
$store: {
state: {
hasElopage: false,
hasElopage: true,
isAdmin: true,
},
},
@ -39,7 +39,7 @@ describe('Navbar', () => {
expect(wrapper.find('div.component-navbar').exists()).toBeTruthy()
})
describe('navigation Navbar', () => {
describe('navigation Navbar (general elements)', () => {
it('has .navbar-brand in the navbar', () => {
expect(wrapper.find('.navbar-brand').exists()).toBeTruthy()
})
@ -66,7 +66,8 @@ describe('Navbar', () => {
it('has first nav-item "navigation.profile" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.profile')
})
})
describe('navigation Navbar (user has an elopage account)', () => {
it('has a link to the members area', () => {
expect(wrapper.findAll('.nav-item').at(7).text()).toContain('navigation.members_area')
expect(wrapper.findAll('.nav-item').at(7).find('a').attributes('href')).toBe(
@ -81,6 +82,18 @@ describe('Navbar', () => {
expect(wrapper.findAll('.nav-item').at(9).text()).toEqual('navigation.logout')
})
})
describe('navigation Navbar (user has no elopage account)', () => {
beforeAll(() => {
mocks.$store.state.hasElopage = false
wrapper = Wrapper()
})
it('has first nav-item "navigation.admin_area" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.admin_area')
})
it('has first nav-item "navigation.logout" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(8).text()).toEqual('navigation.logout')
})
})
})
describe('check watch visible true', () => {
beforeEach(async () => {

View File

@ -57,12 +57,9 @@
{{ $t('navigation.profile') }}
</b-nav-item>
<br />
<b-nav-item :href="elopageUri" class="mb-3" target="_blank">
<b-nav-item v-if="$store.state.hasElopage" :href="elopageUri" class="mb-3" 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>