diff --git a/f2/src/__tests__/BusinessPage.test.js b/f2/src/__tests__/BusinessPage.test.js
index a17c76acb..d569cac48 100644
--- a/f2/src/__tests__/BusinessPage.test.js
+++ b/f2/src/__tests__/BusinessPage.test.js
@@ -13,19 +13,20 @@ i18n.load('en', { en })
i18n.activate('en')
describe('', () => {
- afterEach(cleanup)
+ beforeEach(() => (global.scrollTo = jest.fn()))
+ afterEach(cleanup)
- it('renders', () => {
- render(
-
-
-
-
-
-
-
-
- ,
- )
- })
+ it('renders', () => {
+ render(
+
+
+
+
+
+
+
+
+ ,
+ )
+ })
})
diff --git a/f2/src/__tests__/CancelPage.test.js b/f2/src/__tests__/CancelPage.test.js
index 1880bb0ca..f6ff180ad 100644
--- a/f2/src/__tests__/CancelPage.test.js
+++ b/f2/src/__tests__/CancelPage.test.js
@@ -13,6 +13,7 @@ i18n.load('en', { en })
i18n.activate('en')
describe('', () => {
+ beforeEach(() => (global.scrollTo = jest.fn()))
afterEach(cleanup)
it('renders', () => {
diff --git a/f2/src/__tests__/ConfirmCancelPage.test.js b/f2/src/__tests__/ConfirmCancelPage.test.js
index f90fc5461..081d09f61 100644
--- a/f2/src/__tests__/ConfirmCancelPage.test.js
+++ b/f2/src/__tests__/ConfirmCancelPage.test.js
@@ -13,6 +13,7 @@ i18n.load('en', { en })
i18n.activate('en')
describe('', () => {
+ beforeEach(() => (global.scrollTo = jest.fn()))
afterEach(cleanup)
it('renders', () => {
diff --git a/f2/src/__tests__/ConfirmationSummary.test.js b/f2/src/__tests__/ConfirmationSummary.test.js
index ff44f0031..620fbecf8 100644
--- a/f2/src/__tests__/ConfirmationSummary.test.js
+++ b/f2/src/__tests__/ConfirmationSummary.test.js
@@ -13,6 +13,7 @@ i18n.load('en', { en })
i18n.activate('en')
describe('', () => {
+ beforeEach(() => (global.scrollTo = jest.fn()))
afterEach(cleanup)
it('renders', () => {
diff --git a/f2/src/__tests__/ContactInfoPage.test.js b/f2/src/__tests__/ContactInfoPage.test.js
index e07ebe0de..c4cbbee8b 100644
--- a/f2/src/__tests__/ContactInfoPage.test.js
+++ b/f2/src/__tests__/ContactInfoPage.test.js
@@ -13,6 +13,7 @@ i18n.load('en', { en })
i18n.activate('en')
describe('', () => {
+ beforeEach(() => (global.scrollTo = jest.fn()))
afterEach(cleanup)
it('renders', () => {
diff --git a/f2/src/__tests__/DevicesPage.test.js b/f2/src/__tests__/DevicesPage.test.js
index 79e467601..0da7d7e5f 100644
--- a/f2/src/__tests__/DevicesPage.test.js
+++ b/f2/src/__tests__/DevicesPage.test.js
@@ -13,6 +13,7 @@ i18n.load('en', { en })
i18n.activate('en')
describe('', () => {
+ beforeEach(() => (global.scrollTo = jest.fn()))
afterEach(cleanup)
it('renders', () => {
@@ -28,4 +29,4 @@ describe('', () => {
,
)
})
-})
\ No newline at end of file
+})
diff --git a/f2/src/__tests__/FeedbackPage.test.js b/f2/src/__tests__/FeedbackPage.test.js
index 109f05a3a..9db3fe72a 100644
--- a/f2/src/__tests__/FeedbackPage.test.js
+++ b/f2/src/__tests__/FeedbackPage.test.js
@@ -13,6 +13,7 @@ i18n.load('en', { en })
i18n.activate('en')
describe('', () => {
+ beforeEach(() => (global.scrollTo = jest.fn()))
afterEach(cleanup)
it('renders', () => {
diff --git a/f2/src/__tests__/InformationPage.test.js b/f2/src/__tests__/InformationPage.test.js
index 8afcaba33..efc1e20a5 100644
--- a/f2/src/__tests__/InformationPage.test.js
+++ b/f2/src/__tests__/InformationPage.test.js
@@ -13,19 +13,20 @@ i18n.load('en', { en })
i18n.activate('en')
describe('', () => {
- afterEach(cleanup)
+ beforeEach(() => (global.scrollTo = jest.fn()))
+ afterEach(cleanup)
- it('renders', () => {
- render(
-
-
-
-
-
-
-
-
- ,
- )
- })
+ it('renders', () => {
+ render(
+
+
+
+
+
+
+
+
+ ,
+ )
+ })
})
diff --git a/f2/src/__tests__/LandingPage.test.js b/f2/src/__tests__/LandingPage.test.js
index b13732343..10f21163c 100644
--- a/f2/src/__tests__/LandingPage.test.js
+++ b/f2/src/__tests__/LandingPage.test.js
@@ -13,6 +13,7 @@ i18n.load('en', { en })
i18n.activate('en')
describe('', () => {
+ beforeEach(() => (global.scrollTo = jest.fn()))
afterEach(cleanup)
it('renders', () => {
diff --git a/f2/src/__tests__/LocationPage.test.js b/f2/src/__tests__/LocationPage.test.js
index 50c56c3ca..3ae1fafb5 100644
--- a/f2/src/__tests__/LocationPage.test.js
+++ b/f2/src/__tests__/LocationPage.test.js
@@ -13,6 +13,7 @@ i18n.load('en', { en })
i18n.activate('en')
describe('', () => {
+ beforeEach(() => (global.scrollTo = jest.fn()))
afterEach(cleanup)
it('renders', () => {
diff --git a/f2/src/__tests__/PrivacyConsentPage.test.js b/f2/src/__tests__/PrivacyConsentPage.test.js
index d513fecd7..88b03e34c 100644
--- a/f2/src/__tests__/PrivacyConsentPage.test.js
+++ b/f2/src/__tests__/PrivacyConsentPage.test.js
@@ -13,6 +13,7 @@ i18n.load('en', { en })
i18n.activate('en')
describe('', () => {
+ beforeEach(() => (global.scrollTo = jest.fn()))
afterEach(cleanup)
it('renders', () => {
@@ -28,4 +29,4 @@ describe('', () => {
,
)
})
-})
\ No newline at end of file
+})
diff --git a/f2/src/__tests__/WhatHappenedPage.test.js b/f2/src/__tests__/WhatHappenedPage.test.js
index 2968b47f3..67737768c 100644
--- a/f2/src/__tests__/WhatHappenedPage.test.js
+++ b/f2/src/__tests__/WhatHappenedPage.test.js
@@ -13,6 +13,7 @@ i18n.load('en', { en })
i18n.activate('en')
describe('', () => {
+ beforeEach(() => (global.scrollTo = jest.fn()))
afterEach(cleanup)
it('renders', () => {
diff --git a/f2/src/__tests__/WhatWasAffectedPage.test.js b/f2/src/__tests__/WhatWasAffectedPage.test.js
index 9e193e47e..bcce6a746 100644
--- a/f2/src/__tests__/WhatWasAffectedPage.test.js
+++ b/f2/src/__tests__/WhatWasAffectedPage.test.js
@@ -13,6 +13,7 @@ i18n.load('en', { en })
i18n.activate('en')
describe('', () => {
+ beforeEach(() => (global.scrollTo = jest.fn()))
afterEach(cleanup)
it('renders', () => {
diff --git a/f2/src/components/footer/__tests__/Footer.test.js b/f2/src/components/footer/__tests__/Footer.test.js
index a4881e12d..2e95a3770 100644
--- a/f2/src/components/footer/__tests__/Footer.test.js
+++ b/f2/src/components/footer/__tests__/Footer.test.js
@@ -11,6 +11,7 @@ i18n.load('en', { en })
i18n.activate('en')
describe('', () => {
+ beforeEach(() => (global.scrollTo = jest.fn()))
afterEach(cleanup)
it('renders children correctly', () => {
diff --git a/f2/src/components/layout/__tests__/Layout.test.js b/f2/src/components/layout/__tests__/Layout.test.js
index ede1f5a6e..e2d60c97e 100644
--- a/f2/src/components/layout/__tests__/Layout.test.js
+++ b/f2/src/components/layout/__tests__/Layout.test.js
@@ -3,6 +3,7 @@ import { render, cleanup } from '@testing-library/react'
import { Layout } from '..'
describe('', () => {
+ beforeEach(() => (global.scrollTo = jest.fn()))
afterEach(cleanup)
it('renders', () => {
diff --git a/f2/src/components/layout/index.js b/f2/src/components/layout/index.js
index 261c0fab3..8e4fbbc45 100644
--- a/f2/src/components/layout/index.js
+++ b/f2/src/components/layout/index.js
@@ -1,4 +1,4 @@
-import React from 'react'
+import React, { useEffect } from 'react'
import PropTypes from 'prop-types'
import { Container } from '../container'
@@ -10,6 +10,11 @@ export const Layout = ({ fluid, columns, ...props }) => {
xl: columns.xl * 100 + '%',
}
+ // scroll to the top of the page when this Layout renders
+ useEffect(() => {
+ window.scrollTo(0, 0)
+ })
+
return (
', () => {
+ beforeEach(() => (global.scrollTo = jest.fn()))
afterEach(cleanup)
it('properly renders alpha banner', () => {
diff --git a/f2/src/components/warning-banner/__tests__/WarningBanner.test.js b/f2/src/components/warning-banner/__tests__/WarningBanner.test.js
index 0dd21324d..931d5c764 100644
--- a/f2/src/components/warning-banner/__tests__/WarningBanner.test.js
+++ b/f2/src/components/warning-banner/__tests__/WarningBanner.test.js
@@ -11,6 +11,7 @@ i18n.load('en', { en })
i18n.activate('en')
describe('', () => {
+ beforeEach(() => (global.scrollTo = jest.fn()))
afterEach(cleanup)
it('renders correctly', () => {