mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
test admin link,
correct pointer class
This commit is contained in:
parent
573d998533
commit
ab33753c8e
@ -24,6 +24,7 @@ describe('SideBar', () => {
|
||||
hasElopage: false,
|
||||
},
|
||||
commit: jest.fn(),
|
||||
dispatch: jest.fn(),
|
||||
},
|
||||
$i18n: {
|
||||
locale: 'en',
|
||||
@ -154,6 +155,33 @@ describe('SideBar', () => {
|
||||
expect(wrapper.emitted('logout')).toEqual([[]])
|
||||
})
|
||||
})
|
||||
|
||||
describe('admin-area', () => {
|
||||
it('is not visible when not an admin', () => {
|
||||
expect(wrapper.findAll('li').at(1).text()).not.toBe('admin_area')
|
||||
})
|
||||
describe('logged in as admin', () => {
|
||||
const assignLocationSpy = jest.fn()
|
||||
beforeEach(() => {
|
||||
mocks.$store.state.isAdmin = true
|
||||
mocks.$store.state.token = 'valid token'
|
||||
// const { location } = window;
|
||||
delete window.location
|
||||
window.location = {}
|
||||
Object.defineProperty(window, 'location', assignLocationSpy)
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('is visible', () => {
|
||||
expect(wrapper.findAll('li').at(1).text()).toBe('admin_area')
|
||||
})
|
||||
it.skip('opens a new window when clicked', async () => {
|
||||
wrapper.findAll('li').at(1).find('a').trigger('click')
|
||||
await wrapper.vm.$nextTick()
|
||||
expect(assignLocationSpy).toHaveBeenCalledWith('peter')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -50,14 +50,14 @@
|
||||
<li class="nav-item">
|
||||
<a :href="getElopageLink()" class="nav-link" target="_blank">
|
||||
{{ $t('members_area') }}
|
||||
<b-badge v-if="!this.$store.state.hasElopage" pill variant="danger">!</b-badge>
|
||||
<b-badge v-if="!$store.state.hasElopage" pill variant="danger">!</b-badge>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="navbar-nav ml-3" v-if="this.$store.state.isAdmin">
|
||||
<ul class="navbar-nav ml-3" v-if="$store.state.isAdmin">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link ponter" @click="admin">
|
||||
<a class="nav-link pointer" @click="admin">
|
||||
{{ $t('admin_area') }}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user