This commit is contained in:
ogerly 2022-08-05 13:06:05 +02:00
parent 7fbdbb5217
commit 652124012f
5 changed files with 57 additions and 59 deletions

View File

@ -49,7 +49,7 @@ describe('Navbar', () => {
}) })
it('has ten b-nav-item in the navbar', () => { it('has ten b-nav-item in the navbar', () => {
expect(wrapper.findAll('.nav-item')).toHaveLength(11) expect(wrapper.findAll('.nav-item')).toHaveLength(12)
}) })
it('has first nav-item "amount GDD" in navbar', () => { it('has first nav-item "amount GDD" in navbar', () => {
@ -75,22 +75,26 @@ describe('Navbar', () => {
it('has first nav-item "navigation.profile" in navbar', () => { it('has first nav-item "navigation.profile" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.profile') expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.profile')
}) })
it('has first nav-item "navigation.info" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(8).text()).toEqual('navigation.info')
})
}) })
describe('navigation Navbar (user has an elopage account)', () => { describe('navigation Navbar (user has an elopage account)', () => {
it('has a link to the members area', () => { it('has a link to the members area', () => {
expect(wrapper.findAll('.nav-item').at(8).text()).toContain('navigation.members_area') expect(wrapper.findAll('.nav-item').at(9).text()).toContain('navigation.members_area')
expect(wrapper.findAll('.nav-item').at(8).find('a').attributes('href')).toBe( expect(wrapper.findAll('.nav-item').at(9).find('a').attributes('href')).toBe(
'https://elopage.com', 'https://elopage.com',
) )
}) })
it('has first nav-item "navigation.admin_area" in navbar', () => { it('has first nav-item "navigation.admin_area" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(9).text()).toEqual('navigation.admin_area') expect(wrapper.findAll('.nav-item').at(10).text()).toEqual('navigation.admin_area')
}) })
it('has first nav-item "navigation.logout" in navbar', () => { it('has first nav-item "navigation.logout" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(10).text()).toEqual('navigation.logout') expect(wrapper.findAll('.nav-item').at(11).text()).toEqual('navigation.logout')
}) })
}) })
@ -101,11 +105,11 @@ describe('Navbar', () => {
}) })
it('has first nav-item "navigation.admin_area" in navbar', () => { it('has first nav-item "navigation.admin_area" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(8).text()).toEqual('navigation.admin_area') expect(wrapper.findAll('.nav-item').at(9).text()).toEqual('navigation.admin_area')
}) })
it('has first nav-item "navigation.logout" in navbar', () => { it('has first nav-item "navigation.logout" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(9).text()).toEqual('navigation.logout') expect(wrapper.findAll('.nav-item').at(10).text()).toEqual('navigation.logout')
}) })
}) })
}) })

View File

@ -60,6 +60,10 @@
<b-icon icon="gear" aria-hidden="true"></b-icon> <b-icon icon="gear" aria-hidden="true"></b-icon>
{{ $t('navigation.profile') }} {{ $t('navigation.profile') }}
</b-nav-item> </b-nav-item>
<b-nav-item to="/info" class="mb-3">
<b-icon icon="info" aria-hidden="true"></b-icon>
{{ $t('navigation.info') }}
</b-nav-item>
<br /> <br />
<b-nav-item v-if="$store.state.hasElopage" :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> <b-icon icon="link45deg" aria-hidden="true"></b-icon>

View File

@ -33,8 +33,8 @@ describe('Sidebar', () => {
}) })
describe('navigation Navbar', () => { describe('navigation Navbar', () => {
it('has seven b-nav-item in the navbar', () => { it('has nine b-nav-item in the navbar', () => {
expect(wrapper.findAll('.nav-item')).toHaveLength(8) expect(wrapper.findAll('.nav-item')).toHaveLength(9)
}) })
describe('navigation Navbar (general elements)', () => { describe('navigation Navbar (general elements)', () => {
@ -58,21 +58,40 @@ describe('Sidebar', () => {
expect(wrapper.findAll('.nav-item').at(4).text()).toEqual('navigation.profile') expect(wrapper.findAll('.nav-item').at(4).text()).toEqual('navigation.profile')
}) })
it('has first nav-item "navigation.profile" in navbar', () => { it('has first nav-item "navigation.info" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.profile') expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('navigation.info')
}) })
}) })
describe('navigation Navbar (user has an elopage account)', () => { describe('navigation Navbar (user has an elopage account)', () => {
it('has nine b-nav-item in the navbar', () => {
expect(wrapper.findAll('.nav-item')).toHaveLength(9)
})
it('has a link to the members area', () => {
expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.members_area')
expect(wrapper.findAll('.nav-item').at(6).find('a').attributes('href')).toBe('#')
})
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('navigation Navbar (user has no elopage account)', () => {
beforeAll(() => {
mocks.$store.state.hasElopage = false
wrapper = Wrapper()
})
it('has eight b-nav-item in the navbar', () => { it('has eight b-nav-item in the navbar', () => {
expect(wrapper.findAll('.nav-item')).toHaveLength(8) 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('#')
})
it('has first nav-item "navigation.admin_area" in navbar', () => { it('has first nav-item "navigation.admin_area" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.admin_area') expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('navigation.admin_area')
}) })
@ -88,21 +107,8 @@ describe('Sidebar', () => {
wrapper = Wrapper() wrapper = Wrapper()
}) })
it('has seven b-nav-item in the navbar', () => { it('has eight b-nav-item in the navbar', () => {
expect(wrapper.findAll('.nav-item')).toHaveLength(7) expect(wrapper.findAll('.nav-item')).toHaveLength(8)
})
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 "community.community" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('community.community')
})
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('#')
}) })
it('has first nav-item "navigation.admin_area" in navbar', () => { it('has first nav-item "navigation.admin_area" in navbar', () => {
@ -113,29 +119,6 @@ describe('Sidebar', () => {
expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.logout') 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 seven 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 "community.community" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('community.community')
})
it('has first nav-item "navigation.logout" in navbar', () => {
expect(wrapper.findAll('.nav-item').at(7).text()).toEqual('navigation.logout')
})
})
}) })
}) })
}) })

View File

@ -44,10 +44,6 @@
<b-icon icon="shield-check" aria-hidden="true"></b-icon> <b-icon icon="shield-check" aria-hidden="true"></b-icon>
{{ $t('navigation.admin_area') }} {{ $t('navigation.admin_area') }}
</b-nav-item> </b-nav-item>
<b-nav-item to="/community" class="mb-3">
<b-icon icon="people" aria-hidden="true"></b-icon>
{{ $t('community.community') }}
</b-nav-item>
<b-nav-item class="mb-3" @click="$emit('logout')"> <b-nav-item class="mb-3" @click="$emit('logout')">
<b-icon icon="power" aria-hidden="true"></b-icon> <b-icon icon="power" aria-hidden="true"></b-icon>
{{ $t('navigation.logout') }} {{ $t('navigation.logout') }}

View File

@ -50,7 +50,7 @@ describe('router', () => {
}) })
it('has sixteen routes defined', () => { it('has sixteen routes defined', () => {
expect(routes).toHaveLength(17) expect(routes).toHaveLength(18)
}) })
describe('overview', () => { describe('overview', () => {
@ -119,6 +119,17 @@ describe('router', () => {
}) })
}) })
describe('info', () => {
it('requires authorization', () => {
expect(routes.find((r) => r.path === '/info').meta.requiresAuth).toBeTruthy()
})
it('loads the "InfoStatistic" page', async () => {
const component = await routes.find((r) => r.path === '/info').component()
expect(component.default.name).toBe('InfoStatistic')
})
})
describe('login', () => { describe('login', () => {
it('loads the "Login" page', async () => { it('loads the "Login" page', async () => {
const component = await routes.find((r) => r.path === '/login/:code?').component() const component = await routes.find((r) => r.path === '/login/:code?').component()