diff --git a/webapp/components/_new/features/InternalPage/InternalPage.vue b/webapp/components/_new/features/InternalPage/InternalPage.vue index c0520f935..3729261ab 100644 --- a/webapp/components/_new/features/InternalPage/InternalPage.vue +++ b/webapp/components/_new/features/InternalPage/InternalPage.vue @@ -25,11 +25,21 @@ diff --git a/webapp/mixins/internalPageMixins.js b/webapp/mixins/internalPageMixins.js index 922d64f95..b5a5ab90d 100644 --- a/webapp/mixins/internalPageMixins.js +++ b/webapp/mixins/internalPageMixins.js @@ -1,22 +1,26 @@ import InternalPage from '~/components/_new/features/InternalPage/InternalPage.vue' +import links from '~/constants/links.js' -export function internalPageMixins(pageParams) { +export function internalPageMixins() { return { layout: 'basic', components: { InternalPage, }, - data() { - return { pageParams } - }, head() { return { title: this.$t(this.pageParams.internalPage.headTitleIdent), } }, - created() { - if (!this.pageParams.isInternalPage) { - this.pageParams.redirectToPage(this) + async asyncData({ params, error }) { + const [link] = Object.keys(links).filter((key) => links[key].name === params.static) + if (!link) + return error({ + statusCode: 404, + key: 'error-pages.404-default', + }) + return { + pageParams: links[link], } }, } diff --git a/webapp/pages/__snapshots__/_static.spec.js.snap b/webapp/pages/__snapshots__/_static.spec.js.snap new file mode 100644 index 000000000..d871df4a9 --- /dev/null +++ b/webapp/pages/__snapshots__/_static.spec.js.snap @@ -0,0 +1,32 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`_static mount renders 1`] = ` +
+
+
+

+ + + +

+
+ +
+
+
+ + +
+
+
+
+`; diff --git a/webapp/pages/_static.spec.js b/webapp/pages/_static.spec.js new file mode 100644 index 000000000..9e37cf3fd --- /dev/null +++ b/webapp/pages/_static.spec.js @@ -0,0 +1,38 @@ +import { mount } from '@vue/test-utils' +import Static from './_static.vue' + +const localVue = global.localVue + +describe('_static', () => { + let wrapper + + describe('mount', () => { + const Wrapper = (page) => { + return mount(Static, { + mocks: { + $t: jest.fn(), + }, + data() { + return { + pageParams: { + internalPage: { + hasContainer: true, + hasBaseCard: true, + hasLoginInHeader: true, + }, + }, + } + }, + localVue, + }) + } + + beforeEach(async () => { + wrapper = await Wrapper('faq') + }) + + it('renders', () => { + expect(wrapper.element).toMatchSnapshot() + }) + }) +}) diff --git a/webapp/pages/_static.vue b/webapp/pages/_static.vue new file mode 100644 index 000000000..1f6b283a5 --- /dev/null +++ b/webapp/pages/_static.vue @@ -0,0 +1,13 @@ + + + diff --git a/webapp/pages/code-of-conduct.spec.js b/webapp/pages/code-of-conduct.spec.js deleted file mode 100644 index e914ceaee..000000000 --- a/webapp/pages/code-of-conduct.spec.js +++ /dev/null @@ -1,43 +0,0 @@ -import { mount } from '@vue/test-utils' -import CodeOfConduct from './code-of-conduct.vue' -import VueMeta from 'vue-meta' - -const localVue = global.localVue -localVue.use(VueMeta, { keyName: 'head' }) - -// avoid: 'Error: Not implemented: navigation (except hash changes)', see https://stackoverflow.com/questions/54090231/how-to-fix-error-not-implemented-navigation-except-hash-changes -const assignMock = jest.fn() -delete window.location -window.location = { assign: assignMock } - -describe('code-of-conduct.vue', () => { - let wrapper - let mocks - - beforeEach(() => { - mocks = { - $t: (t) => t, - } - }) - - describe('mount', () => { - const Wrapper = () => { - return mount(CodeOfConduct, { - mocks, - localVue, - }) - } - - beforeEach(() => { - wrapper = Wrapper() - }) - - it('renders', () => { - expect(wrapper.element.tagName).toBe('DIV') - }) - - it('has correct content', () => { - expect(wrapper.vm.$metaInfo.title).toBe('site.code-of-conduct') - }) - }) -}) diff --git a/webapp/pages/code-of-conduct.vue b/webapp/pages/code-of-conduct.vue deleted file mode 100644 index 3a3275c39..000000000 --- a/webapp/pages/code-of-conduct.vue +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/webapp/pages/data-privacy.spec.js b/webapp/pages/data-privacy.spec.js deleted file mode 100644 index a1fdf4afc..000000000 --- a/webapp/pages/data-privacy.spec.js +++ /dev/null @@ -1,43 +0,0 @@ -import { mount } from '@vue/test-utils' -import DataPrivacy from './data-privacy.vue' -import VueMeta from 'vue-meta' - -const localVue = global.localVue -localVue.use(VueMeta, { keyName: 'head' }) - -// avoid: 'Error: Not implemented: navigation (except hash changes)', see https://stackoverflow.com/questions/54090231/how-to-fix-error-not-implemented-navigation-except-hash-changes -const assignMock = jest.fn() -delete window.location -window.location = { assign: assignMock } - -describe('data-privacy.vue', () => { - let wrapper - let mocks - - beforeEach(() => { - mocks = { - $t: (t) => t, - } - }) - - describe('mount', () => { - const Wrapper = () => { - return mount(DataPrivacy, { - mocks, - localVue, - }) - } - - beforeEach(() => { - wrapper = Wrapper() - }) - - it('renders', () => { - expect(wrapper.element.tagName).toBe('DIV') - }) - - it('has correct content', () => { - expect(wrapper.vm.$metaInfo.title).toBe('site.data-privacy') - }) - }) -}) diff --git a/webapp/pages/data-privacy.vue b/webapp/pages/data-privacy.vue deleted file mode 100644 index 31f86c9b8..000000000 --- a/webapp/pages/data-privacy.vue +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/webapp/pages/donate.spec.js b/webapp/pages/donate.spec.js deleted file mode 100644 index 2eff7d8d0..000000000 --- a/webapp/pages/donate.spec.js +++ /dev/null @@ -1,47 +0,0 @@ -import { mount } from '@vue/test-utils' -import Donate from './donate.vue' -import VueMeta from 'vue-meta' - -const localVue = global.localVue -localVue.use(VueMeta, { keyName: 'head' }) - -// avoid: 'Error: Not implemented: navigation (except hash changes)', see https://stackoverflow.com/questions/54090231/how-to-fix-error-not-implemented-navigation-except-hash-changes -const assignMock = jest.fn() -delete window.location -window.location = { assign: assignMock } - -const openMock = jest.fn() -delete window.open -window.open = openMock - -describe('donate.vue', () => { - let wrapper - let mocks - - beforeEach(() => { - mocks = { - $t: (t) => t, - } - }) - - describe('mount', () => { - const Wrapper = () => { - return mount(Donate, { - mocks, - localVue, - }) - } - - beforeEach(() => { - wrapper = Wrapper() - }) - - it('renders', () => { - expect(wrapper.element.tagName).toBe('DIV') - }) - - it('has correct content', () => { - expect(wrapper.vm.$metaInfo.title).toBe('site.donate') - }) - }) -}) diff --git a/webapp/pages/donate.vue b/webapp/pages/donate.vue deleted file mode 100644 index aac73695f..000000000 --- a/webapp/pages/donate.vue +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/webapp/pages/faq.spec.js b/webapp/pages/faq.spec.js deleted file mode 100644 index 9d3c776cc..000000000 --- a/webapp/pages/faq.spec.js +++ /dev/null @@ -1,43 +0,0 @@ -import { mount } from '@vue/test-utils' -import Faq from './faq.vue' -import VueMeta from 'vue-meta' - -const localVue = global.localVue -localVue.use(VueMeta, { keyName: 'head' }) - -// avoid: 'Error: Not implemented: navigation (except hash changes)', see https://stackoverflow.com/questions/54090231/how-to-fix-error-not-implemented-navigation-except-hash-changes -const assignMock = jest.fn() -delete window.location -window.location = { assign: assignMock } - -describe('faq.vue', () => { - let wrapper - let mocks - - beforeEach(() => { - mocks = { - $t: (t) => t, - } - }) - - describe('mount', () => { - const Wrapper = () => { - return mount(Faq, { - mocks, - localVue, - }) - } - - beforeEach(() => { - wrapper = Wrapper() - }) - - it('renders', () => { - expect(wrapper.element.tagName).toBe('DIV') - }) - - it('has correct content', () => { - expect(wrapper.vm.$metaInfo.title).toBe('site.faq') - }) - }) -}) diff --git a/webapp/pages/faq.vue b/webapp/pages/faq.vue deleted file mode 100644 index ec0ee8eda..000000000 --- a/webapp/pages/faq.vue +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/webapp/pages/imprint.spec.js b/webapp/pages/imprint.spec.js deleted file mode 100644 index 5e8b57064..000000000 --- a/webapp/pages/imprint.spec.js +++ /dev/null @@ -1,47 +0,0 @@ -import { mount } from '@vue/test-utils' -import Imprint from './imprint.vue' -import VueMeta from 'vue-meta' - -const localVue = global.localVue -localVue.use(VueMeta, { keyName: 'head' }) - -// avoid: 'Error: Not implemented: navigation (except hash changes)', see https://stackoverflow.com/questions/54090231/how-to-fix-error-not-implemented-navigation-except-hash-changes -const assignMock = jest.fn() -delete window.location -window.location = { assign: assignMock } - -const openMock = jest.fn() -delete window.open -window.open = openMock - -describe('imprint.vue', () => { - let wrapper - let mocks - - beforeEach(() => { - mocks = { - $t: (t) => t, - } - }) - - describe('mount', () => { - const Wrapper = () => { - return mount(Imprint, { - mocks, - localVue, - }) - } - - beforeEach(() => { - wrapper = Wrapper() - }) - - it('renders', () => { - expect(wrapper.element.tagName).toBe('DIV') - }) - - it('has correct content', () => { - expect(wrapper.vm.$metaInfo.title).toBe('site.imprint') - }) - }) -}) diff --git a/webapp/pages/imprint.vue b/webapp/pages/imprint.vue deleted file mode 100644 index 3c5fea10e..000000000 --- a/webapp/pages/imprint.vue +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/webapp/pages/organization.spec.js b/webapp/pages/organization.spec.js deleted file mode 100644 index 1829ac065..000000000 --- a/webapp/pages/organization.spec.js +++ /dev/null @@ -1,47 +0,0 @@ -import { mount } from '@vue/test-utils' -import Organization from './organization.vue' -import VueMeta from 'vue-meta' - -const localVue = global.localVue -localVue.use(VueMeta, { keyName: 'head' }) - -// avoid: 'Error: Not implemented: navigation (except hash changes)', see https://stackoverflow.com/questions/54090231/how-to-fix-error-not-implemented-navigation-except-hash-changes -const assignMock = jest.fn() -delete window.location -window.location = { assign: assignMock } - -const openMock = jest.fn() -delete window.open -window.open = openMock - -describe('organization.vue', () => { - let wrapper - let mocks - - beforeEach(() => { - mocks = { - $t: (t) => t, - } - }) - - describe('mount', () => { - const Wrapper = () => { - return mount(Organization, { - mocks, - localVue, - }) - } - - beforeEach(() => { - wrapper = Wrapper() - }) - - it('renders', () => { - expect(wrapper.element.tagName).toBe('DIV') - }) - - it('has correct content', () => { - expect(wrapper.vm.$metaInfo.title).toBe('site.made') - }) - }) -}) diff --git a/webapp/pages/organization.vue b/webapp/pages/organization.vue deleted file mode 100644 index 7f6f3abd6..000000000 --- a/webapp/pages/organization.vue +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/webapp/pages/support.spec.js b/webapp/pages/support.spec.js deleted file mode 100644 index 57e729796..000000000 --- a/webapp/pages/support.spec.js +++ /dev/null @@ -1,47 +0,0 @@ -import { mount } from '@vue/test-utils' -import Support from './support.vue' -import VueMeta from 'vue-meta' - -const localVue = global.localVue -localVue.use(VueMeta, { keyName: 'head' }) - -// avoid: 'Error: Not implemented: navigation (except hash changes)', see https://stackoverflow.com/questions/54090231/how-to-fix-error-not-implemented-navigation-except-hash-changes -const assignMock = jest.fn() -delete window.location -window.location = { assign: assignMock } - -const openMock = jest.fn() -delete window.open -window.open = openMock - -describe('support.vue', () => { - let wrapper - let mocks - - beforeEach(() => { - mocks = { - $t: (t) => t, - } - }) - - describe('mount', () => { - const Wrapper = () => { - return mount(Support, { - mocks, - localVue, - }) - } - - beforeEach(() => { - wrapper = Wrapper() - }) - - it('renders', () => { - expect(wrapper.element.tagName).toBe('DIV') - }) - - it('has correct content', () => { - expect(wrapper.vm.$metaInfo.title).toBe('site.support') - }) - }) -}) diff --git a/webapp/pages/support.vue b/webapp/pages/support.vue deleted file mode 100644 index e157693c7..000000000 --- a/webapp/pages/support.vue +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/webapp/pages/terms-and-conditions.spec.js b/webapp/pages/terms-and-conditions.spec.js deleted file mode 100644 index cc3b5b435..000000000 --- a/webapp/pages/terms-and-conditions.spec.js +++ /dev/null @@ -1,43 +0,0 @@ -import { mount } from '@vue/test-utils' -import TermsAndConditions from './terms-and-conditions.vue' -import VueMeta from 'vue-meta' - -const localVue = global.localVue -localVue.use(VueMeta, { keyName: 'head' }) - -// avoid: 'Error: Not implemented: navigation (except hash changes)', see https://stackoverflow.com/questions/54090231/how-to-fix-error-not-implemented-navigation-except-hash-changes -const assignMock = jest.fn() -delete window.location -window.location = { assign: assignMock } - -describe('terms-and-conditions.vue', () => { - let wrapper - let mocks - - beforeEach(() => { - mocks = { - $t: (t) => t, - } - }) - - describe('mount', () => { - const Wrapper = () => { - return mount(TermsAndConditions, { - mocks, - localVue, - }) - } - - beforeEach(() => { - wrapper = Wrapper() - }) - - it('renders', () => { - expect(wrapper.element.tagName).toBe('DIV') - }) - - it('has correct content', () => { - expect(wrapper.vm.$metaInfo.title).toBe('site.termsAndConditions') - }) - }) -}) diff --git a/webapp/pages/terms-and-conditions.vue b/webapp/pages/terms-and-conditions.vue deleted file mode 100644 index 341de62db..000000000 --- a/webapp/pages/terms-and-conditions.vue +++ /dev/null @@ -1,12 +0,0 @@ - - -