diff --git a/layouts/empty.vue b/layouts/empty.vue
new file mode 100644
index 000000000..eedfeaf9e
--- /dev/null
+++ b/layouts/empty.vue
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/layouts/home.vue b/layouts/home.vue
deleted file mode 100644
index 4afc11afd..000000000
--- a/layouts/home.vue
+++ /dev/null
@@ -1,29 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/pages/pix-site/index.vue b/pages/pix-site/index.vue
index a880360b3..73b8dbee3 100644
--- a/pages/pix-site/index.vue
+++ b/pages/pix-site/index.vue
@@ -1,15 +1,43 @@
-
+
+
+
+
+
+
+
+
+
diff --git a/pages/pix-site/locale-choice.vue b/pages/pix-site/locale-choice.vue
deleted file mode 100644
index f294ffec4..000000000
--- a/pages/pix-site/locale-choice.vue
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/tests/pages/pix-site/index.test.js b/tests/pages/pix-site/index.test.js
index 398f183a8..8a6af21a1 100644
--- a/tests/pages/pix-site/index.test.js
+++ b/tests/pages/pix-site/index.test.js
@@ -1,4 +1,5 @@
import { shallowMount } from '@vue/test-utils'
+import Vue from 'vue'
import Index from '@/pages/pix-site/index.vue'
describe('Index Page', () => {
@@ -6,7 +7,7 @@ describe('Index Page', () => {
beforeEach(() => {
$router = {
- push: jest.fn(),
+ replace: jest.fn(),
}
let cookieJar = ''
@@ -19,28 +20,40 @@ describe('Index Page', () => {
describe('#mounted', () => {
describe('when there is no cookie', () => {
- test('redirects to /locale-choice page', () => {
+ test('do not redirect', async () => {
// given
document.cookie = ''
// when
- shallowMount(Index, { mocks: { $router } })
+ const wrapper = shallowMount(Index, {
+ mocks: { $router },
+ stubs: ['client-only', 'pix-image', 'locale-link'],
+ })
+ await Vue.nextTick()
// then
- expect($router.push).toHaveBeenCalledWith('/locale-choice')
+ expect($router.replace).not.toHaveBeenCalled()
+ const localeLinks = wrapper.findAll('locale-link-stub')
+ expect(localeLinks.length).toBe(4)
})
})
describe('when there is a cookie', () => {
- test('redirects to locale page', () => {
+ test('redirects to locale page', async () => {
// given
document.cookie = 'foo=bar; locale=fr'
// when
- shallowMount(Index, { mocks: { $router } })
+ const wrapper = shallowMount(Index, {
+ mocks: { $router },
+ stubs: ['client-only', 'pix-image', 'locale-link'],
+ })
+ await Vue.nextTick()
// then
- expect($router.push).toHaveBeenCalledWith('/fr/')
+ expect($router.replace).toHaveBeenCalledWith('/fr/')
+ const localeLinks = wrapper.findAll('locale-link-stub')
+ expect(localeLinks.length).toBe(0)
})
})
})
@@ -51,7 +64,10 @@ describe('Index Page', () => {
test('returns no locale', () => {
// given
document.cookie = ''
- const wrapper = shallowMount(Index, { mocks: { $router } })
+ const wrapper = shallowMount(Index, {
+ mocks: { $router },
+ stubs: ['client-only', 'pix-image', 'locale-link'],
+ })
// when
const chosenLocale = wrapper.vm.getLocaleFromCookie()
@@ -65,7 +81,10 @@ describe('Index Page', () => {
test('returns the proper locale', () => {
// given
document.cookie = 'foo=bar; locale=fr'
- const wrapper = shallowMount(Index, { mocks: { $router } })
+ const wrapper = shallowMount(Index, {
+ mocks: { $router },
+ stubs: ['client-only', 'pix-image', 'locale-link'],
+ })
// when
const chosenLocale = wrapper.vm.getLocaleFromCookie()
@@ -79,7 +98,10 @@ describe('Index Page', () => {
test('cookie value is ignored', () => {
// given
document.cookie = 'foo=bar; locale=1234-crafted-cookie'
- const wrapper = shallowMount(Index, { mocks: { $router } })
+ const wrapper = shallowMount(Index, {
+ mocks: { $router },
+ stubs: ['client-only', 'pix-image', 'locale-link'],
+ })
// when
const chosenLocale = wrapper.vm.getLocaleFromCookie()