Skip to content

Commit 8268e1b

Browse files
Update to support existing crossword routes in puzzle cards (#16740)
1 parent beaf72d commit 8268e1b

4 files changed

Lines changed: 8 additions & 3 deletions

File tree

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ export const getPuzzleUrl = (item: PuzzleItem): string | undefined => {
423423
if (
424424
url !== undefined &&
425425
(url.startsWith('/puzzles-and-games') ||
426-
url.startsWith('/crosswords/series/') ||
426+
url.startsWith('/crosswords/') ||
427427
/^https?:\/\//.test(url))
428428
) {
429429
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
}

0 commit comments

Comments
 (0)