From 61896c421fd1c480d89c48af046ee6b3825efb05 Mon Sep 17 00:00:00 2001 From: elweyn Date: Tue, 12 Oct 2021 13:15:35 +0200 Subject: [PATCH] Tested the new functionality, and fixed the links. --- .../components/SidebarPlugin/SideBar.spec.js | 32 ++++++++++++++++--- .../src/components/SidebarPlugin/SideBar.vue | 4 +-- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/SidebarPlugin/SideBar.spec.js b/frontend/src/components/SidebarPlugin/SideBar.spec.js index 9f182ca93..385c2bbef 100644 --- a/frontend/src/components/SidebarPlugin/SideBar.spec.js +++ b/frontend/src/components/SidebarPlugin/SideBar.spec.js @@ -18,6 +18,10 @@ describe('SideBar', () => { $store: { state: { email: 'test@example.org', + publisherId: 123, + firstName: 'test', + lastName: 'example', + hasElopage: false, }, commit: jest.fn(), }, @@ -80,12 +84,16 @@ describe('SideBar', () => { describe('static menu items', () => { describe("member's area", () => { it('has a link to the elopage', () => { - expect(wrapper.findAll('li').at(0).text()).toBe('members_area') + expect(wrapper.findAll('li').at(0).text()).toContain('members_area') }) - it('links to the elopage', () => { + it('has a badge', () => { + expect(wrapper.findAll('li').at(0).text()).toContain('!') + }) + + it('links to the elopage registration', () => { expect(wrapper.findAll('li').at(0).find('a').attributes('href')).toBe( - 'https://elopage.com/s/gradido/sign_in?locale=en', + 'https://elopage.com/s/gradido/basic-de/payment?locale=en&prid=111&pid=123&firstName=test&lastName=example&email=test@example.org', ) }) @@ -94,11 +102,27 @@ describe('SideBar', () => { mocks.$i18n.locale = 'de' }) - it('links to the German elopage when locale is set to de', () => { + it('links to the German elopage registration when locale is set to de', () => { + expect(wrapper.findAll('li').at(0).find('a').attributes('href')).toBe( + 'https://elopage.com/s/gradido/basic-de/payment?locale=de&prid=111&pid=123&firstName=test&lastName=example&email=test@example.org', + ) + }) + }) + + describe('with hasElopage is true', () => { + beforeEach(() => { + mocks.$store.state.hasElopage = true + }) + + it('links to the elopage member area', () => { expect(wrapper.findAll('li').at(0).find('a').attributes('href')).toBe( 'https://elopage.com/s/gradido/sign_in?locale=de', ) }) + + it('has no badge', () => { + expect(wrapper.findAll('li').at(0).text()).not.toContain('!') + }) }) }) diff --git a/frontend/src/components/SidebarPlugin/SideBar.vue b/frontend/src/components/SidebarPlugin/SideBar.vue index 312be6b8a..9dc0a2765 100755 --- a/frontend/src/components/SidebarPlugin/SideBar.vue +++ b/frontend/src/components/SidebarPlugin/SideBar.vue @@ -113,8 +113,8 @@ export default { }, getElopageLink() { return this.$store.state.hasElopage - ? `https://elopage.com/s/gradido/sign_in?locale=${this.$i18n.locale}&email=${this.$store.state.email}` - : `https://elopage.com/s/gradido/basic-de/payment?locale=de&prid=111&pid=${this.$store.state.publisherId}&firstName=${this.$store.state.firstName}&lastName=${this.$store.state.lastName}&email=${this.$store.state.email}` + ? `https://elopage.com/s/gradido/sign_in?locale=${this.$i18n.locale}` + : `https://elopage.com/s/gradido/basic-de/payment?locale=${this.$i18n.locale}&prid=111&pid=${this.$store.state.publisherId}&firstName=${this.$store.state.firstName}&lastName=${this.$store.state.lastName}&email=${this.$store.state.email}` }, }, }