mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
more tests for Navbar.vue, yarn lint --fix
This commit is contained in:
parent
a9b922505d
commit
ea1352d571
@ -6,6 +6,7 @@ const localVue = global.localVue
|
||||
const propsData = {
|
||||
balance: 1234,
|
||||
visible: false,
|
||||
elopageUri: 'https://elopage.com',
|
||||
}
|
||||
|
||||
const mocks = {
|
||||
@ -15,7 +16,7 @@ const mocks = {
|
||||
$t: jest.fn((t) => t),
|
||||
$store: {
|
||||
state: {
|
||||
hasElopage: true,
|
||||
hasElopage: false,
|
||||
isAdmin: true,
|
||||
},
|
||||
},
|
||||
@ -37,45 +38,47 @@ describe('Navbar', () => {
|
||||
expect(wrapper.find('div.component-navbar').exists()).toBeTruthy()
|
||||
})
|
||||
|
||||
describe('navigation Navbar', () => {
|
||||
it('has .navbar-brand in the navbar', () => {
|
||||
expect(wrapper.find('.navbar-brand').exists()).toBeTruthy()
|
||||
})
|
||||
it('has b-navbar-toggle in the navbar', () => {
|
||||
expect(wrapper.find('.navbar-toggler').exists()).toBeTruthy()
|
||||
})
|
||||
it('has ten b-nav-item in the navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item')).toHaveLength(10)
|
||||
})
|
||||
describe('navigation Navbar', () => {
|
||||
it('has .navbar-brand in the navbar', () => {
|
||||
expect(wrapper.find('.navbar-brand').exists()).toBeTruthy()
|
||||
})
|
||||
it('has b-navbar-toggle in the navbar', () => {
|
||||
expect(wrapper.find('.navbar-toggler').exists()).toBeTruthy()
|
||||
})
|
||||
it('has ten b-nav-item in the navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item')).toHaveLength(10)
|
||||
})
|
||||
|
||||
it('has first nav-item "amount GDD" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(1).text()).toEqual('1234 GDD')
|
||||
})
|
||||
it('has first nav-item "amount GDD" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(1).text()).toEqual('1234 GDD')
|
||||
})
|
||||
|
||||
it('has first nav-item "overview" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(3).text()).toEqual('overview')
|
||||
})
|
||||
it('has first nav-item "send" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(4).text()).toEqual('send')
|
||||
})
|
||||
it('has first nav-item "transactions" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('transactions')
|
||||
})
|
||||
it('has first nav-item "my-profil" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('site.navbar.my-profil')
|
||||
})
|
||||
it('has first nav-item "overview" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(3).text()).toEqual('overview')
|
||||
})
|
||||
it('has first nav-item "send" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(4).text()).toEqual('send')
|
||||
})
|
||||
it('has first nav-item "transactions" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('transactions')
|
||||
})
|
||||
it('has first nav-item "my-profil" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('site.navbar.my-profil')
|
||||
})
|
||||
|
||||
it('has a link to the members area', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(7).text()).toContain('members_area')
|
||||
expect(wrapper.findAll('.nav-item').at(7).find('a').attributes('href')).toBe('#')
|
||||
})
|
||||
it('has a link to the members area', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(7).text()).toContain('members_area')
|
||||
expect(wrapper.findAll('.nav-item').at(7).find('a').attributes('href')).toBe(
|
||||
'https://elopage.com',
|
||||
)
|
||||
})
|
||||
|
||||
it('has first nav-item "admin_area" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(8).text()).toEqual('admin_area')
|
||||
it('has first nav-item "admin_area" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(8).text()).toEqual('admin_area')
|
||||
})
|
||||
it('has first nav-item "logout" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(9).text()).toEqual('logout')
|
||||
})
|
||||
})
|
||||
it('has first nav-item "logout" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(9).text()).toEqual('logout')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -107,6 +107,5 @@ export default {
|
||||
}
|
||||
.b-collaps-gradido li :hover {
|
||||
background-color: #e9e7e7f5;
|
||||
font-size: larger;
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -31,35 +31,35 @@ 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(7)
|
||||
})
|
||||
describe('navigation Navbar', () => {
|
||||
it('has seven b-nav-item in the navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item')).toHaveLength(7)
|
||||
})
|
||||
|
||||
it('has first nav-item "overview" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(0).text()).toEqual('overview')
|
||||
})
|
||||
it('has first nav-item "overview" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(0).text()).toEqual('overview')
|
||||
})
|
||||
|
||||
it('has first nav-item "send" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(1).text()).toEqual('send')
|
||||
})
|
||||
it('has first nav-item "send" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(1).text()).toEqual('send')
|
||||
})
|
||||
|
||||
it('has first nav-item "transactions" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(2).text()).toEqual('transactions')
|
||||
it('has first nav-item "transactions" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(2).text()).toEqual('transactions')
|
||||
})
|
||||
it('has first nav-item "my-profil" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(3).text()).toEqual('site.navbar.my-profil')
|
||||
})
|
||||
it('has a link to the members area', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(4).text()).toContain('members_area')
|
||||
expect(wrapper.findAll('.nav-item').at(4).find('a').attributes('href')).toBe('#')
|
||||
})
|
||||
it('has first nav-item "admin_area" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('admin_area')
|
||||
})
|
||||
it('has first nav-item "logout" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('logout')
|
||||
})
|
||||
})
|
||||
it('has first nav-item "my-profil" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(3).text()).toEqual('site.navbar.my-profil')
|
||||
})
|
||||
it('has a link to the members area', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(4).text()).toContain('members_area')
|
||||
expect(wrapper.findAll('.nav-item').at(4).find('a').attributes('href')).toBe('#')
|
||||
})
|
||||
it('has first nav-item "admin_area" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(5).text()).toEqual('admin_area')
|
||||
})
|
||||
it('has first nav-item "logout" in navbar', () => {
|
||||
expect(wrapper.findAll('.nav-item').at(6).text()).toEqual('logout')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -59,7 +59,6 @@ export default {
|
||||
transactionCount: 0,
|
||||
pending: true,
|
||||
visible: false,
|
||||
elopageUri: this.getElopageLink(),
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -112,7 +111,12 @@ export default {
|
||||
window.location.assign(CONFIG.ADMIN_AUTH_URL.replace('$1', this.$store.state.token))
|
||||
this.$store.dispatch('logout') // logout without redirect
|
||||
},
|
||||
getElopageLink() {
|
||||
setVisible(bool) {
|
||||
this.visible = bool
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
elopageUri() {
|
||||
const pId = this.$store.state.publisherId
|
||||
? this.$store.state.publisherId
|
||||
: CONFIG.DEFAULT_PUBLISHER_ID
|
||||
@ -122,9 +126,6 @@ export default {
|
||||
: `https://elopage.com/s/gradido/basic-de/payment?locale=${this.$i18n.locale}&prid=111&pid=${pId}&firstName=${this.$store.state.firstName}&lastName=${this.$store.state.lastName}&email=${this.$store.state.email}`,
|
||||
)
|
||||
},
|
||||
setVisible(bool) {
|
||||
this.visible = bool
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user