Skip to content

Commit e81903a

Browse files
committed
Merge branch 'latest' of https://github.com/bbc/simorgh into ws-playwright-sample-tests
2 parents 3a08945 + eedba4b commit e81903a

File tree

32 files changed

+3470
-135
lines changed

32 files changed

+3470
-135
lines changed
-12.6 KB
Binary file not shown.
13.4 KB
Binary file not shown.

scripts/bundleSize/bundleSizeConfig.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99

1010
export const VARIANCE = 5;
1111

12-
export const MIN_SIZE = 931;
13-
export const MAX_SIZE = 1298;
12+
export const MIN_SIZE = 939;
13+
export const MAX_SIZE = 1303;

src/app/components/Account/AccountHeader/index.test.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import Cookie from 'js-cookie';
21
import { screen } from '@testing-library/react';
32
import { render } from '#app/components/react-testing-library-with-providers';
43
import { IdctaConfig } from '#app/models/types/account';
@@ -17,22 +16,19 @@ const idctaConfig: IdctaConfig = {
1716
settings_url: 'https://example.com/settings',
1817
signout_url: 'https://example.com/signout',
1918
foryou_url: 'https://example.com/foryou',
19+
initialIsSignedIn: false,
2020
identity: {
2121
idSignedInCookieName: 'ckns_id',
2222
},
2323
};
2424

25-
const renderWithProviders = () =>
25+
const renderWithProviders = (overrides = {}) =>
2626
render(<AccountHeader />, {
2727
service: 'hindi',
28-
idctaConfig,
28+
idctaConfig: { ...idctaConfig, ...overrides },
2929
});
3030

3131
describe('AccountHeader', () => {
32-
afterEach(() => {
33-
Cookie.remove('ckns_id');
34-
});
35-
3632
it('shows Sign in when signed out and account toggle is enabled for service', async () => {
3733
renderWithProviders();
3834

@@ -53,9 +49,7 @@ describe('AccountHeader', () => {
5349
});
5450

5551
it('shows For you when signed in', async () => {
56-
Cookie.set('ckns_id', '1');
57-
58-
renderWithProviders();
52+
renderWithProviders({ initialIsSignedIn: true });
5953

6054
const link = await screen.findByRole('link', { name: 'For you' });
6155
expect(link).toHaveAttribute(

src/app/components/Account/AccountPromotionalBanner/index.styles.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
import { Theme, css } from '@emotion/react';
22

33
export default {
4-
actionLinkWrapper: ({ mq }) =>
4+
callToActionLink: ({ mq }) =>
55
css({
6-
display: 'flex',
6+
padding: '1rem',
7+
display: 'inline-flex',
8+
justifyContent: 'center',
79
flexDirection: 'column',
8-
flex: '1 1 auto',
10+
flex: '0 0 auto',
911
alignItems: 'center',
1012
gap: '1rem',
1113
[mq.GROUP_2_MIN_WIDTH]: {
1214
flexDirection: 'row',
1315
},
1416
}),
15-
callToActionLink: () =>
16-
css({
17-
padding: '1rem',
18-
}),
1917

2018
buttonSeparatorText: ({ palette }: Theme) =>
2119
css({

src/app/components/Account/AccountPromotionalBanner/index.test.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import Cookie from 'js-cookie';
21
import userEvent from '@testing-library/user-event';
32
import {
43
render,
54
screen,
65
} from '#app/components/react-testing-library-with-providers';
76
import type { IdctaConfig } from '#app/models/types/account';
8-
97
import AccountPromotionalBanner from '.';
108

119
const idctaConfig: IdctaConfig = {
@@ -19,7 +17,7 @@ const idctaConfig: IdctaConfig = {
1917
identity: {
2018
idSignedInCookieName: 'ckns_id',
2119
},
22-
};
20+
} as unknown as IdctaConfig;
2321

2422
const renderWithProviders = (idctaOverrides: Partial<IdctaConfig> = {}) =>
2523
render(<AccountPromotionalBanner />, {
@@ -28,10 +26,6 @@ const renderWithProviders = (idctaOverrides: Partial<IdctaConfig> = {}) =>
2826
});
2927

3028
describe('AccountPromotionalBanner', () => {
31-
afterEach(() => {
32-
Cookie.remove('ckns_id');
33-
});
34-
3529
it('renders when signed out and IDCTA is available', async () => {
3630
renderWithProviders();
3731

@@ -61,9 +55,7 @@ describe('AccountPromotionalBanner', () => {
6155
});
6256

6357
it('does not render when signed in', () => {
64-
Cookie.set('ckns_id', '1');
65-
66-
renderWithProviders();
58+
renderWithProviders({ initialIsSignedIn: true });
6759

6860
expect(
6961
screen.queryByRole('heading', { name: 'Discover your BBC' }),

src/app/components/Account/AccountPromotionalBanner/index.tsx

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -80,37 +80,35 @@ const AccountPromotionalBanner = () => {
8080
setIsDismissed(true);
8181
}}
8282
>
83-
<div css={styles.actionLinkWrapper}>
84-
<CallToActionLink
85-
url={signInUrl}
86-
className="focusIndicatorInvert"
87-
css={[styles.callToActionLink, styles.signInLink]}
88-
>
89-
<CallToActionLink.ButtonLikeWrapper>
90-
<CallToActionLink.Text shouldUnderlineOnHoverFocus>
91-
{signInText}
92-
<CallToActionLink.Chevron />
93-
</CallToActionLink.Text>
94-
</CallToActionLink.ButtonLikeWrapper>
95-
</CallToActionLink>
83+
<CallToActionLink
84+
url={signInUrl}
85+
className="focusIndicatorInvert"
86+
css={[styles.callToActionLink, styles.signInLink]}
87+
>
88+
<CallToActionLink.ButtonLikeWrapper>
89+
<CallToActionLink.Text shouldUnderlineOnHoverFocus>
90+
{signInText}
91+
<CallToActionLink.Chevron />
92+
</CallToActionLink.Text>
93+
</CallToActionLink.ButtonLikeWrapper>
94+
</CallToActionLink>
9695

97-
<Paragraph size="bodyCopy" css={styles.buttonSeparatorText}>
98-
{buttonSeparatorText}
99-
</Paragraph>
96+
<Paragraph size="bodyCopy" css={styles.buttonSeparatorText}>
97+
{buttonSeparatorText}
98+
</Paragraph>
10099

101-
<CallToActionLink
102-
url={registerUrl}
103-
className="focusIndicatorInvert"
104-
css={[styles.callToActionLink, styles.registerLink]}
105-
>
106-
<CallToActionLink.ButtonLikeWrapper>
107-
<CallToActionLink.Text shouldUnderlineOnHoverFocus>
108-
{registerText}
109-
<CallToActionLink.Chevron />
110-
</CallToActionLink.Text>
111-
</CallToActionLink.ButtonLikeWrapper>
112-
</CallToActionLink>
113-
</div>
100+
<CallToActionLink
101+
url={registerUrl}
102+
className="focusIndicatorInvert"
103+
css={[styles.callToActionLink, styles.registerLink]}
104+
>
105+
<CallToActionLink.ButtonLikeWrapper>
106+
<CallToActionLink.Text shouldUnderlineOnHoverFocus>
107+
{registerText}
108+
<CallToActionLink.Chevron />
109+
</CallToActionLink.Text>
110+
</CallToActionLink.ButtonLikeWrapper>
111+
</CallToActionLink>
114112
</PromotionalBanner>
115113
);
116114
};

src/app/components/Curation/index.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
VISUAL_STYLE,
44
VISUAL_PROMINENCE,
55
} from '#app/models/types/curationData';
6+
import { ComponentExperimentProps } from '#app/models/types/global';
67
import RadioSchedule from '#app/legacy/containers/RadioSchedule';
78
import useViewTracker from '#app/hooks/useViewTracker';
89
import useClickTrackerHandler from '#app/hooks/useClickTrackerHandler';
@@ -51,6 +52,11 @@ const getGridComponent = (componentName: string | null) => {
5152
}
5253
};
5354

55+
interface CurationProps extends Curation {
56+
// keep this local so we do not change the shared bff curation data shape
57+
experimentProps?: ComponentExperimentProps;
58+
}
59+
5460
export default ({
5561
visualStyle = NONE,
5662
visualProminence = NORMAL,
@@ -68,7 +74,8 @@ export default ({
6874
renderVisuallyHiddenH2Title = false,
6975
curationId,
7076
mediaCollection,
71-
}: Curation) => {
77+
experimentProps,
78+
}: CurationProps) => {
7279
const componentName = getComponentName({
7380
visualStyle,
7481
visualProminence,
@@ -95,6 +102,8 @@ export default ({
95102
isLive: summaryIsLive,
96103
title: linkText,
97104
} = firstSummary || {};
105+
// flatten this once so the tracking object stays easy to read below
106+
const experimentTrackingProps = experimentProps || {};
98107

99108
const eventTrackingData: EventTrackingData = {
100109
componentName,
@@ -106,6 +115,7 @@ export default ({
106115
...(curationId && { resourceId: curationId }),
107116
...(summaries?.length > 0 && { itemCount: summaries.length }),
108117
},
118+
...experimentTrackingProps,
109119
};
110120

111121
switch (componentName) {

0 commit comments

Comments
 (0)