tests for ContentFooter

This commit is contained in:
Moriz Wahl 2021-03-29 16:35:54 +02:00
parent de08bfe459
commit 232d697941
2 changed files with 77 additions and 3 deletions

View File

@ -9,7 +9,7 @@ describe('ContentFooter', () => {
let mocks = {
$i18n: {
locale: () => 'en',
locale: 'en',
},
$t: jest.fn((t) => t),
}
@ -24,7 +24,81 @@ describe('ContentFooter', () => {
})
it('renders the content footer', () => {
expect(wrapper.find('footer.footer')).toBeDefined()
expect(wrapper.find('footer.footer').exists()).toBeTruthy()
})
describe('copyright', () => {
it('shows the copyright', () => {
expect(wrapper.find('div.copyright').exists()).toBeTruthy()
})
it('renders the copyright year', () => {
expect(wrapper.find('div.copyright').text()).toMatch(/©\s*2[0-9]{3,3}\s+/)
})
it('renders a link to Gradido-Akademie', () => {
expect(wrapper.find('div.copyright').find('a').text()).toEqual('Gradido-Akademie')
})
it('links to the login page when clicked on copyright', () => {
expect(wrapper.find('div.copyright').find('a').attributes('href')).toEqual('#/Login')
})
})
describe('links to gradido.net', () => {
it('has a link to the gradido.net', () => {
expect(wrapper.findAll('a.nav-link').at(0).text()).toEqual('Gradido')
})
it('links to the https://gradido.net/en when locale is en', () => {
expect(wrapper.findAll('a.nav-link').at(0).attributes('href')).toEqual(
'https://gradido.net/en',
)
})
it('has a link to the legal notice', () => {
expect(wrapper.findAll('a.nav-link').at(1).text()).toEqual('imprint')
})
it('links to the https://gradido.net/en/impressum when locale is en', () => {
expect(wrapper.findAll('a.nav-link').at(1).attributes('href')).toEqual(
'https://gradido.net/en/impressum/',
)
})
it('has a link to the privacy policy', () => {
expect(wrapper.findAll('a.nav-link').at(2).text()).toEqual('privacy_policy')
})
it('links to the https://gradido.net/en/datenschutz when locale is en', () => {
expect(wrapper.findAll('a.nav-link').at(2).attributes('href')).toEqual(
'https://gradido.net/en/datenschutz/',
)
})
describe('links are localized', () => {
beforeEach(() => {
mocks.$i18n.locale = 'de'
})
it('links to the https://gradido.net/de when locale is de', () => {
expect(wrapper.findAll('a.nav-link').at(0).attributes('href')).toEqual(
'https://gradido.net/de',
)
})
it('links to the https://gradido.net/de/impressum when locale is de', () => {
expect(wrapper.findAll('a.nav-link').at(1).attributes('href')).toEqual(
'https://gradido.net/de/impressum/',
)
})
it('links to the https://gradido.net/de/datenschutz when locale is de', () => {
expect(wrapper.findAll('a.nav-link').at(2).attributes('href')).toEqual(
'https://gradido.net/de/datenschutz/',
)
})
})
})
})
})

View File

@ -4,7 +4,7 @@
<b-col>
<div class="copyright text-center text-lg-center text-muted">
© {{ year }}
<a href="#!" to="/login" class="font-weight-bold ml-1">Gradido-Akademie</a>
<a href="#/Login" class="font-weight-bold ml-1">Gradido-Akademie</a>
</div>
</b-col>
</b-row>