diff --git a/src/app/components/Footer/List/index.tsx b/src/app/components/Footer/List/index.tsx
index dbd523c49d6..08b5231d714 100644
--- a/src/app/components/Footer/List/index.tsx
+++ b/src/app/components/Footer/List/index.tsx
@@ -36,9 +36,7 @@ export default ({
)}
{elements.map((elem, index) => (
// eslint-disable-next-line react/no-array-index-key
-
- {elem}
-
+ {elem}
))}
);
diff --git a/src/app/components/Footer/index.test.tsx b/src/app/components/Footer/index.test.tsx
index 4bf48529faa..5faf165f1be 100644
--- a/src/app/components/Footer/index.test.tsx
+++ b/src/app/components/Footer/index.test.tsx
@@ -21,6 +21,14 @@ describe('Footer', () => {
'#',
);
});
+
+ it('should not render an empty list item when the "Do not share or sell my info" link is not present', () => {
+ render(, { showAdsBasedOnLocation: false });
+ const listItems = screen.getAllByRole('listitem');
+ listItems.forEach(listItem => {
+ expect(listItem).not.toBeEmptyDOMElement();
+ });
+ });
});
describe('Collective News Text', () => {
diff --git a/src/app/components/Footer/index.tsx b/src/app/components/Footer/index.tsx
index b3418af8de8..c4d3da8a1c6 100644
--- a/src/app/components/Footer/index.tsx
+++ b/src/app/components/Footer/index.tsx
@@ -29,36 +29,38 @@ export default () => {
collectiveNewsroomText,
} = footer;
- const elements = links?.map(({ id, text, href, lang }) => {
- if (id === 'COOKIE_SETTINGS') {
- if (isAmp) {
- return (
- // @ts-expect-error we do not have a className
-
- {text}
-
- );
- }
+ const elements = links
+ ?.map(({ id, text, href, lang }) => {
+ if (id === 'COOKIE_SETTINGS') {
+ if (isAmp) {
+ return (
+ // @ts-expect-error we do not have a className
+
+ {text}
+
+ );
+ }
- if (showAdsBasedOnLocation) {
- return (
-
- );
+ if (showAdsBasedOnLocation) {
+ return (
+
+ );
+ }
+ } else {
+ return ;
}
- } else {
- return ;
- }
- return null;
- });
+ return null;
+ })
+ .filter(Boolean);
return (
diff --git a/src/app/components/PageLayoutWrapper/__snapshots__/index.test.tsx.snap b/src/app/components/PageLayoutWrapper/__snapshots__/index.test.tsx.snap
index 71ec1080e8f..940cb4cf43d 100644
--- a/src/app/components/PageLayoutWrapper/__snapshots__/index.test.tsx.snap
+++ b/src/app/components/PageLayoutWrapper/__snapshots__/index.test.tsx.snap
@@ -1006,13 +1006,13 @@ exports[`PageLayoutWrapper should render default page wrapper with children 1`]
@media (min-width: 15rem) and (max-width: 37.4375rem) {
.emotion-151 {
- grid-template-rows: repeat(5, auto);
+ grid-template-rows: repeat(4, auto);
}
}
@media (min-width: 37.5rem) and (max-width: 62.9375rem) {
.emotion-151 {
- grid-template-rows: repeat(4, auto);
+ grid-template-rows: repeat(3, auto);
}
}
@@ -1637,9 +1637,7 @@ exports[`PageLayoutWrapper should render default page wrapper with children 1`]
Why you can trust the BBC
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
-
+
-
+
-
+
-
+
-
+
-