Skip to content

Commit

Permalink
fix: do not push locale redirect transition page in user history
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbertrand committed Jan 6, 2023
1 parent 80a37b6 commit 7daee2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pages/pix-site/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default {
mounted() {
const chosenLocale = this.getLocaleFromCookie()
if (chosenLocale) {
return this.$router.push(`/${chosenLocale}/`)
return this.$router.replace(`/${chosenLocale}/`)
}
this.shouldDisplayLocaleChoice = true
},
Expand Down
6 changes: 3 additions & 3 deletions tests/pages/pix-site/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('Index Page', () => {

beforeEach(() => {
$router = {
push: jest.fn(),
replace: jest.fn(),
}

let cookieJar = ''
Expand All @@ -32,7 +32,7 @@ describe('Index Page', () => {
await Vue.nextTick()

// then
expect($router.push).not.toHaveBeenCalled()
expect($router.replace).not.toHaveBeenCalled()
const localeLinks = wrapper.findAll('locale-link-stub')
expect(localeLinks.length).toBe(4)
})
Expand All @@ -51,7 +51,7 @@ describe('Index Page', () => {
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)
})
Expand Down

0 comments on commit 7daee2b

Please sign in to comment.