Skip to content

Commit ea039f8

Browse files
authored
Merge branch 'main' into nz-non-auxia-sign-in-gate
2 parents 97bfc78 + 01a4fe2 commit ea039f8

14 files changed

Lines changed: 158 additions & 103 deletions

dotcom-rendering/jest.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ const esModules = [
1414
'storybook',
1515
'parse5',
1616
'entities',
17+
'htmlparser2',
18+
'domhandler',
19+
'domelementtype',
20+
'domutils',
21+
'dom-serializer',
1722
].join('|');
1823

1924
module.exports = {

dotcom-rendering/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"@types/lodash.debounce": "4.0.7",
7979
"@types/lodash.get": "4.4.9",
8080
"@types/node": "catalog:",
81-
"@types/qs": "6.9.15",
81+
"@types/qs": "6.15.1",
8282
"@types/react": "18.3.1",
8383
"@types/react-dom": "18.3.0",
8484
"@types/react-google-recaptcha": "2.1.9",
@@ -144,7 +144,7 @@
144144
"rehype-stringify": "10.0.1",
145145
"remark-parse": "11.0.0",
146146
"remark-rehype": "11.1.2",
147-
"sanitize-html": "2.17.5",
147+
"sanitize-html": "2.17.7",
148148
"screenfull": "6.0.2",
149149
"semver": "7.5.4",
150150
"source-map": "0.7.4",

dotcom-rendering/src/components/PuzzlesDirectory.test.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,9 @@ describe('PuzzlesDirectory', () => {
339339
expect(
340340
getPuzzleUrl(item({ slug: 'word-wheel', variant: 'archive-page' })),
341341
).toBe('/puzzles-and-games/word-wheel/archive');
342+
expect(getPuzzleUrl(item({ url: '/crosswords/quick/123' }))).toBe(
343+
'/crosswords/quick/123',
344+
);
342345
expect(getPuzzleUrl(item({ url: 'https://example.com/play' }))).toBe(
343346
'https://example.com/play',
344347
);

dotcom-rendering/src/components/PuzzlesDirectory.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,7 @@ const nestedStyles = (span: number) => css`
395395
`;
396396

397397
const adStyles = css`
398-
max-width: 1300px;
399-
margin: 0 auto;
398+
width: 100%;
400399
overflow: hidden;
401400
background: ${palette.neutral[97]};
402401
`;
@@ -423,7 +422,7 @@ export const getPuzzleUrl = (item: PuzzleItem): string | undefined => {
423422
if (
424423
url !== undefined &&
425424
(url.startsWith('/puzzles-and-games') ||
426-
url.startsWith('/crosswords/series/') ||
425+
url.startsWith('/crosswords/') ||
427426
/^https?:\/\//.test(url))
428427
) {
429428
return url;

dotcom-rendering/src/components/PuzzlesSupporting.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const layout: PuzzlesLayoutType = {
4343
set: 'quick',
4444
cardVariant: 'primary',
4545
cadence: 'Daily',
46-
url: '/puzzles-and-games/crosswords/quick/1',
46+
url: '/crosswords/quick/1',
4747
},
4848
{
4949
id: 'wordiply',

dotcom-rendering/src/components/PuzzlesSupporting.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,9 @@ const puzzleUrl = (item: PuzzleItem): string | undefined => {
246246
const url = item.url;
247247
if (
248248
url !== undefined &&
249-
(url.startsWith('/puzzles-and-games') || /^https?:\/\//.test(url))
249+
(url.startsWith('/puzzles-and-games') ||
250+
url.startsWith('/crosswords/') ||
251+
/^https?:\/\//.test(url))
250252
) {
251253
return url;
252254
}

dotcom-rendering/src/frontend/feFront.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type {
99
StarRating,
1010
} from '../types/content';
1111
import type { FooterType } from '../types/footer';
12-
import type { EditorialTest } from '../types/front';
12+
import type { FrontEditorialTest } from '../types/front';
1313
import type { FENavType } from '../types/frontend';
1414
import type { FETagType } from '../types/tag';
1515
import type { Territory } from '../types/territory';
@@ -206,7 +206,7 @@ export type FEFrontCard = {
206206
href?: string;
207207
embedUri?: string;
208208
newsletterData?: Newsletter;
209-
tests?: EditorialTest[];
209+
tests?: FrontEditorialTest[];
210210
};
211211
header: {
212212
isVideo: boolean;
@@ -434,7 +434,7 @@ export type FESupportingContent = {
434434
properties: {
435435
href?: string;
436436
webUrl?: string;
437-
tests?: EditorialTest[];
437+
tests?: FrontEditorialTest[];
438438
};
439439
header: {
440440
kicker?: {

dotcom-rendering/src/layouts/PuzzlesLayout.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('PuzzlesLayout', () => {
4747
).not.toBeInTheDocument();
4848
});
4949

50-
it('keeps global chrome while respecting ad-free input', () => {
50+
it('renders both header slots without experiment participation and respects ad-free input', () => {
5151
const { rerender } = render(
5252
<PuzzlesLayout NAV={nav} puzzlesPage={page(true) as never} />,
5353
);
@@ -62,7 +62,7 @@ describe('PuzzlesLayout', () => {
6262
).toBeInTheDocument();
6363
expect(
6464
document.getElementById('dfp-ad--mobile-above-nav'),
65-
).not.toBeInTheDocument();
65+
).toBeInTheDocument();
6666
});
6767
it('renders the illustrated header with responsive sources and a fixed height', () => {
6868
render(<PuzzlesLayout NAV={nav} puzzlesPage={page() as never} />);

dotcom-rendering/src/layouts/PuzzlesLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export const PuzzlesLayout = ({
110110
padSides={false}
111111
shouldCenter={false}
112112
>
113-
<HeaderAdSlot />
113+
<HeaderAdSlot includeMobile={true} />
114114
</Section>
115115
</Stuck>
116116
)}

dotcom-rendering/src/model/enhanceCards.test.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import type {
55
FESupportingContent,
66
} from '../frontend/feFront';
77
import { ArticleDesign, ArticleDisplay, Pillar } from '../lib/articleFormat';
8-
import type { EditorialTest, VariantMeta } from '../types/front';
8+
import type { FrontEditorialTest, VariantMeta } from '../types/front';
99
import type { MainMedia } from '../types/mainMedia';
1010
import {
1111
decideArticleMedia,
1212
decideReplacementMedia,
1313
getActiveMediaAtom,
14-
getEditorialTestData,
14+
getFrontEditorialTestData,
1515
getMediaMetadata,
1616
} from './enhanceCards';
1717

@@ -535,7 +535,7 @@ describe('Enhance Cards', () => {
535535
});
536536
});
537537

538-
describe('getEditorialTestData', () => {
538+
describe('getFrontEditorialTestData', () => {
539539
const cardWithNoEditorialTest = {
540540
properties: {
541541
isBreaking: false,
@@ -626,7 +626,7 @@ describe('Enhance Cards', () => {
626626
},
627627
} as VariantMeta,
628628
],
629-
} as EditorialTest,
629+
} as FrontEditorialTest,
630630
],
631631
},
632632
};
@@ -639,7 +639,7 @@ describe('Enhance Cards', () => {
639639
{
640640
...cardWithEditorialTest.properties.tests[0],
641641
expiryDate: Date.now() - oneHourInMilliseconds,
642-
} as EditorialTest,
642+
} as FrontEditorialTest,
643643
],
644644
},
645645
};
@@ -652,7 +652,7 @@ describe('Enhance Cards', () => {
652652
{
653653
...cardWithEditorialTest.properties.tests[0],
654654
hasManuallyEndedOnThisTrail: true,
655-
} as EditorialTest,
655+
} as FrontEditorialTest,
656656
],
657657
},
658658
};
@@ -669,7 +669,7 @@ describe('Enhance Cards', () => {
669669

670670
it('returns undefined if no editorial test exists on the card, page is not in allowed fronts list, and user is not in a test bucket', () => {
671671
expect(
672-
getEditorialTestData(
672+
getFrontEditorialTestData(
673673
cardWithNoEditorialTest,
674674
{},
675675
true,
@@ -680,7 +680,7 @@ describe('Enhance Cards', () => {
680680

681681
it('returns undefined if editorial test exists and page is in allowed fronts list, but user is not in a test bucket', () => {
682682
expect(
683-
getEditorialTestData(
683+
getFrontEditorialTestData(
684684
cardWithEditorialTest,
685685
{},
686686
true,
@@ -691,7 +691,7 @@ describe('Enhance Cards', () => {
691691

692692
it('returns undefined if user is in a test bucket and page is in allowed fronts list, but editorial test does not exist', () => {
693693
expect(
694-
getEditorialTestData(
694+
getFrontEditorialTestData(
695695
cardWithNoEditorialTest,
696696
{
697697
'fronts-and-curation-editorial-test': 'a',
@@ -704,7 +704,7 @@ describe('Enhance Cards', () => {
704704

705705
it('returns undefined if editorial test exists and user is in a test bucket, but page is not in allowed fronts list', () => {
706706
expect(
707-
getEditorialTestData(
707+
getFrontEditorialTestData(
708708
cardWithEditorialTest,
709709
{
710710
'fronts-and-curation-editorial-test': 'a',
@@ -717,7 +717,7 @@ describe('Enhance Cards', () => {
717717

718718
it('returns undefined if editorial test exists, page is in allowed fronts list, user is in a variant bucket, but the feature switch is turned off ', () => {
719719
expect(
720-
getEditorialTestData(
720+
getFrontEditorialTestData(
721721
cardWithEditorialTest,
722722
{
723723
'fronts-and-curation-editorial-test': 'a',
@@ -730,7 +730,7 @@ describe('Enhance Cards', () => {
730730

731731
it('returns headline A & test uuid if editorial test exists, page is in allowed fronts list, and user is in bucket A', () => {
732732
expect(
733-
getEditorialTestData(
733+
getFrontEditorialTestData(
734734
cardWithEditorialTest,
735735
{
736736
'fronts-and-curation-editorial-test': 'a',
@@ -743,7 +743,7 @@ describe('Enhance Cards', () => {
743743

744744
it('returns headline B & test uuid if editorial test exists, page is in allowed fronts list, and user is in bucket B', () => {
745745
expect(
746-
getEditorialTestData(
746+
getFrontEditorialTestData(
747747
cardWithEditorialTest,
748748
{
749749
'fronts-and-curation-editorial-test': 'b',
@@ -756,7 +756,7 @@ describe('Enhance Cards', () => {
756756

757757
it('returns undefined if the bucket name does not match a variant meta id', () => {
758758
expect(
759-
getEditorialTestData(
759+
getFrontEditorialTestData(
760760
cardWithEditorialTest,
761761
{
762762
'fronts-and-curation-editorial-test': 'c',
@@ -769,7 +769,7 @@ describe('Enhance Cards', () => {
769769

770770
it('returns undefined if the variant headline is undefined', () => {
771771
expect(
772-
getEditorialTestData(
772+
getFrontEditorialTestData(
773773
cardWithEditorialTestWithUndefinedVariantMeta,
774774
{
775775
'fronts-and-curation-editorial-test': 'a',
@@ -782,7 +782,7 @@ describe('Enhance Cards', () => {
782782

783783
it('returns undefined if an editorial test has expired', () => {
784784
expect(
785-
getEditorialTestData(
785+
getFrontEditorialTestData(
786786
cardWithExpiredEditorialTest,
787787
{
788788
'fronts-and-curation-editorial-test': 'a',
@@ -795,7 +795,7 @@ describe('Enhance Cards', () => {
795795

796796
it('returns undefined if an editorial test has been manually ended', () => {
797797
expect(
798-
getEditorialTestData(
798+
getFrontEditorialTestData(
799799
cardWithManuallyEndedEditorialTest,
800800
{
801801
'fronts-and-curation-editorial-test': 'a',
@@ -808,7 +808,7 @@ describe('Enhance Cards', () => {
808808

809809
it('returns the variant headline & test uuid if an editorial test is present on a sublink', () => {
810810
expect(
811-
getEditorialTestData(
811+
getFrontEditorialTestData(
812812
cardWithSublinkWithEditorialTest
813813
.supportingContent[0] as FESupportingContent,
814814
{
@@ -822,7 +822,7 @@ describe('Enhance Cards', () => {
822822

823823
it('returns undefined for a sublink if an editorial test is expired on a sublink', () => {
824824
expect(
825-
getEditorialTestData(
825+
getFrontEditorialTestData(
826826
cardWithSublinkWithExpiredEditorialTest
827827
.supportingContent[0] as FESupportingContent,
828828
{

0 commit comments

Comments
 (0)