@newskit-render/core 1.50.1 → 1.63.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +324 -0
- package/__pacts__/spec/newskitApi.consumer.pact.ts +19 -32
- package/__tests__/pages/[articleSlug].test.tsx +12 -8
- package/__tests__/pages/__snapshots__/brightcove.test.tsx.snap +20 -0
- package/__tests__/pages/__snapshots__/home.test.tsx.snap +241 -1846
- package/__tests__/pages/brightcove.test.tsx +34 -0
- package/__tests__/pages/home.test.tsx +22 -12
- package/__tests__/pages/mocks.ts +29 -0
- package/__tests__/pages/relatedArticles.test.tsx +76 -0
- package/components/article/RelatedArticles.tsx +48 -55
- package/components/article/__tests__/__snapshots__/index.test.tsx.snap +414 -3366
- package/components/article/__tests__/index.test.tsx +46 -2
- package/components/article/index.tsx +28 -15
- package/components/footer/__snapshots__/index.test.tsx.snap +37 -271
- package/components/header/index.tsx +7 -0
- package/components/section/layouts/Rows.tsx +36 -17
- package/components/section/layouts/__tests__/Rows.test.tsx +12 -0
- package/components/section/layouts/__tests__/__snapshots__/Lead.test.tsx.snap +36 -530
- package/components/section/layouts/__tests__/__snapshots__/SectionTitle.test.tsx.snap +42 -766
- package/components/section/layouts/types.ts +3 -0
- package/config/index.ts +85 -0
- package/constants/index.ts +3 -1
- package/cypress/e2e/account/accessibility.spec.js +14 -17
- package/cypress/e2e/account/account-subscription.spec.js +9 -8
- package/cypress/e2e/account/payment-failer.spec.js +3 -3
- package/cypress/support/commands.js +2 -2
- package/helpers/__tests__/getUser.test.ts +7 -8
- package/helpers/logger.ts +3 -1
- package/helpers/mocks/articleMock.ts +1 -1
- package/helpers/mocks/getUniversalArticleMock.ts +13 -0
- package/helpers/setupTests.ts +4 -0
- package/jest.config.js +22 -19
- package/package.json +11 -11
- package/pages/[section]/[articleId]/[articleSlug].tsx +9 -4
- package/pages/[section]/[articleId]/relatedArticles.tsx +85 -0
- package/pages/_app.tsx +4 -3
- package/pages/_document.tsx +17 -18
- package/pages/api/auth/[...nextauth].ts +2 -3
- package/pages/api/feed.ts +7 -3
- package/pages/api/news-sitemap.ts +4 -6
- package/pages/api/sitemap.ts +10 -7
- package/pages/help-hub/[id]/index.tsx +11 -0
- package/pages/help-hub/index.tsx +11 -0
- package/pages/index.tsx +1 -0
- package/pages/player/brightcove.tsx +19 -0
- package/pages/preview/[articleId]/version/[versionId]/index.tsx +9 -4
- package/public/icon.png +0 -0
- package/queries/getRadioPosts.ts +1 -1
- package/queries/getUniversalArticle.ts +13 -0
- package/temp/header.tsx +7 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { within } from '@testing-library/react'
|
|
2
2
|
|
|
3
3
|
import Article, { ArticleProps } from '..'
|
|
4
|
-
import { Slug, URL, Image } from '../../../helpers/global-types'
|
|
4
|
+
import { Slug, URL, Image, Video } from '../../../helpers/global-types'
|
|
5
5
|
import { renderWithTheme } from '../../../helpers/test-utils'
|
|
6
6
|
|
|
7
7
|
const articleData: ArticleProps = {
|
|
@@ -85,19 +85,32 @@ const articleData: ArticleProps = {
|
|
|
85
85
|
href: 'https://plchldr.co/i/70x50',
|
|
86
86
|
},
|
|
87
87
|
],
|
|
88
|
-
|
|
89
88
|
articleURL: 'http://article-url.com',
|
|
90
89
|
twitterUsername: 'twitterUser',
|
|
91
90
|
siteHost: 'hostname',
|
|
92
91
|
gscId: '4320982',
|
|
93
92
|
}
|
|
94
93
|
|
|
94
|
+
// remove this variable once SITE_HOST is refactored
|
|
95
|
+
jest.mock('../../../config', () => ({
|
|
96
|
+
siteHost: 'https://newskit-render.ceng-dev.newsuk.tech',
|
|
97
|
+
}))
|
|
98
|
+
|
|
99
|
+
jest.mock('@newskit-render/api', () => ({
|
|
100
|
+
acsSessionUrl: 'acsSessionUrl',
|
|
101
|
+
}))
|
|
95
102
|
jest.mock('@newskit-render/my-account', () => {
|
|
96
103
|
return {
|
|
97
104
|
PastDueBannerExternal: 'PastDueBannerExternal',
|
|
98
105
|
}
|
|
99
106
|
})
|
|
100
107
|
|
|
108
|
+
jest.mock('next/router', () => {
|
|
109
|
+
return {
|
|
110
|
+
useRouter: () => ({ asPath: '' }),
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
|
|
101
114
|
jest.mock('../../../helpers/getYear', () => ({
|
|
102
115
|
getYear: jest.fn().mockReturnValue('YYYY'),
|
|
103
116
|
}))
|
|
@@ -213,4 +226,35 @@ describe('Article', () => {
|
|
|
213
226
|
within(getByTestId('ArticleContent')).getAllByTestId('ArticleParagraph')
|
|
214
227
|
).toThrow()
|
|
215
228
|
})
|
|
229
|
+
|
|
230
|
+
test('should render video', () => {
|
|
231
|
+
const articleWithVideo = {
|
|
232
|
+
...articleData,
|
|
233
|
+
media: {
|
|
234
|
+
accountId: '5067014667001',
|
|
235
|
+
videoId: '6288769193001',
|
|
236
|
+
posterImage: {
|
|
237
|
+
crops: [
|
|
238
|
+
{
|
|
239
|
+
url:
|
|
240
|
+
'https://www.thesun.co.uk/wp-content/uploads/2021/12/image-5923b09d66.jpg?strip=all&w=600&h=338&crop=1',
|
|
241
|
+
alt: null,
|
|
242
|
+
aspectRatio: null,
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
}
|
|
248
|
+
const { getByTestId } = renderWithTheme(Article, articleWithVideo)
|
|
249
|
+
const video = getByTestId('bc-video-player')
|
|
250
|
+
const articleVideo = articleWithVideo?.media as Video
|
|
251
|
+
expect(video.getAttribute('data-account')).toBe(articleVideo.accountId)
|
|
252
|
+
expect(video.getAttribute('data-video-id')).toBe(articleVideo.videoId)
|
|
253
|
+
})
|
|
254
|
+
|
|
255
|
+
test('should not render video', () => {
|
|
256
|
+
articleData.media = undefined
|
|
257
|
+
const { getByTestId } = renderWithTheme(Article, articleData)
|
|
258
|
+
expect(() => getByTestId('bc-video-player')).toThrow()
|
|
259
|
+
})
|
|
216
260
|
})
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
Block,
|
|
5
5
|
Cell,
|
|
6
6
|
Image,
|
|
7
|
+
VideoPlayer,
|
|
7
8
|
Visible,
|
|
8
9
|
Stack,
|
|
9
10
|
AlignSelfValues,
|
|
@@ -227,22 +228,36 @@ const ArticlePage: React.FC<ArticleProps> = ({
|
|
|
227
228
|
</Stack>
|
|
228
229
|
</Visible>
|
|
229
230
|
</Block>
|
|
230
|
-
|
|
231
231
|
{media && 'crops' in media && (
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
232
|
+
<Block
|
|
233
|
+
spaceStack={{
|
|
234
|
+
xs: 'space060',
|
|
235
|
+
lg: 'space070',
|
|
236
|
+
}}
|
|
237
|
+
>
|
|
238
|
+
<StyledFigure>
|
|
239
|
+
<Image src={media.crops[0].url} alt={media.crops[0].alt} />
|
|
240
|
+
</StyledFigure>
|
|
241
|
+
</Block>
|
|
242
|
+
)}
|
|
243
|
+
{media && 'videoId' in media && (
|
|
244
|
+
<Block
|
|
245
|
+
spaceStack={{
|
|
246
|
+
xs: 'space060',
|
|
247
|
+
lg: 'space070',
|
|
248
|
+
}}
|
|
249
|
+
>
|
|
250
|
+
<VideoPlayer
|
|
251
|
+
config={{
|
|
252
|
+
'data-video-id': media.videoId,
|
|
253
|
+
'data-account': media.accountId,
|
|
254
|
+
'data-player': 'default',
|
|
255
|
+
'data-embed': 'default',
|
|
256
|
+
controls: true,
|
|
237
257
|
}}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
<Image src={media.crops[0].url} alt={media.crops[0].alt} />
|
|
241
|
-
</StyledFigure>
|
|
242
|
-
</Block>
|
|
243
|
-
</>
|
|
258
|
+
/>
|
|
259
|
+
</Block>
|
|
244
260
|
)}
|
|
245
|
-
|
|
246
261
|
<Block
|
|
247
262
|
spaceStack={{
|
|
248
263
|
xs: 'space060',
|
|
@@ -274,7 +289,6 @@ const ArticlePage: React.FC<ArticleProps> = ({
|
|
|
274
289
|
</Block>
|
|
275
290
|
))}
|
|
276
291
|
</Block>
|
|
277
|
-
|
|
278
292
|
<Visible xs sm>
|
|
279
293
|
<Block spaceStack="space050">
|
|
280
294
|
<Divider />
|
|
@@ -298,7 +312,6 @@ const ArticlePage: React.FC<ArticleProps> = ({
|
|
|
298
312
|
</Stack>
|
|
299
313
|
</Block>
|
|
300
314
|
</Visible>
|
|
301
|
-
|
|
302
315
|
{topics && <RelatedTopics topics={topics} />}
|
|
303
316
|
</Cell>
|
|
304
317
|
<Cell xs={12} lg={3} lgOffset={1}>
|
|
@@ -2,259 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Footer tests should render footer 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
width: 100%;
|
|
8
|
-
bottom: 0;
|
|
9
|
-
display: block;
|
|
10
|
-
padding: 12px;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.emotion-1 {
|
|
14
|
-
width: 100%;
|
|
15
|
-
max-width: 1920px;
|
|
16
|
-
margin: 0 auto;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.emotion-2 {
|
|
20
|
-
box-sizing: border-box;
|
|
21
|
-
-webkit-background-clip: padding-box;
|
|
22
|
-
background-clip: padding-box;
|
|
23
|
-
display: -webkit-box;
|
|
24
|
-
display: -webkit-flex;
|
|
25
|
-
display: -ms-flexbox;
|
|
26
|
-
display: flex;
|
|
27
|
-
-webkit-box-flex-wrap: wrap;
|
|
28
|
-
-webkit-flex-wrap: wrap;
|
|
29
|
-
-ms-flex-wrap: wrap;
|
|
30
|
-
flex-wrap: wrap;
|
|
31
|
-
-webkit-flex-direction: row;
|
|
32
|
-
-ms-flex-direction: row;
|
|
33
|
-
flex-direction: row;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@media screen {
|
|
37
|
-
.emotion-2 {
|
|
38
|
-
margin: -0px 8px 0 8px;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@media screen and (min-width: 480px) {
|
|
43
|
-
.emotion-2 {
|
|
44
|
-
margin: -0px 8px 0 8px;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
@media screen and (min-width: 768px) {
|
|
49
|
-
.emotion-2 {
|
|
50
|
-
margin: -0px 16px 0 16px;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
@media screen and (min-width: 1024px) {
|
|
55
|
-
.emotion-2 {
|
|
56
|
-
margin: -0px 16px 0 16px;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@media screen and (min-width: 1440px) {
|
|
61
|
-
.emotion-2 {
|
|
62
|
-
margin: -0px 16px 0 16px;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.emotion-3 {
|
|
67
|
-
box-sizing: border-box;
|
|
68
|
-
-webkit-background-clip: padding-box;
|
|
69
|
-
background-clip: padding-box;
|
|
70
|
-
-webkit-flex: 1 0 auto;
|
|
71
|
-
-ms-flex: 1 0 auto;
|
|
72
|
-
flex: 1 0 auto;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
@media screen {
|
|
76
|
-
.emotion-3 {
|
|
77
|
-
padding: 0 8px;
|
|
78
|
-
-webkit-flex-basis: 100%;
|
|
79
|
-
-ms-flex-preferred-size: 100%;
|
|
80
|
-
flex-basis: 100%;
|
|
81
|
-
max-width: 100%;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.emotion-4 {
|
|
86
|
-
margin-bottom: 12px;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.emotion-5 {
|
|
90
|
-
display: inline-block;
|
|
91
|
-
fill: #FFFFFF;
|
|
92
|
-
color: #FFFFFF;
|
|
93
|
-
width: 160px;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.emotion-7 {
|
|
97
|
-
border-width: 0px;
|
|
98
|
-
margin: 0;
|
|
99
|
-
width: 100%;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.emotion-8 {
|
|
103
|
-
display: -webkit-box;
|
|
104
|
-
display: -webkit-flex;
|
|
105
|
-
display: -ms-flexbox;
|
|
106
|
-
display: flex;
|
|
107
|
-
-webkit-box-flex-flow: row wrap;
|
|
108
|
-
-webkit-flex-flow: row wrap;
|
|
109
|
-
-ms-flex-flow: row wrap;
|
|
110
|
-
flex-flow: row wrap;
|
|
111
|
-
-webkit-box-pack: justify;
|
|
112
|
-
-webkit-justify-content: space-between;
|
|
113
|
-
justify-content: space-between;
|
|
114
|
-
-webkit-flex-direction: column;
|
|
115
|
-
-ms-flex-direction: column;
|
|
116
|
-
flex-direction: column;
|
|
117
|
-
margin-bottom: 24px;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
@media screen and (min-width: 768px) {
|
|
121
|
-
.emotion-8 {
|
|
122
|
-
-webkit-box-pack: start;
|
|
123
|
-
-ms-flex-pack: start;
|
|
124
|
-
-webkit-justify-content: flex-start;
|
|
125
|
-
justify-content: flex-start;
|
|
126
|
-
-webkit-flex-direction: row;
|
|
127
|
-
-ms-flex-direction: row;
|
|
128
|
-
flex-direction: row;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.emotion-9 {
|
|
133
|
-
margin-bottom: 16px;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
@media screen and (max-width: 767px) {
|
|
137
|
-
.emotion-9 {
|
|
138
|
-
margin-right: 0;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
@media screen and (min-width: 768px) {
|
|
143
|
-
.emotion-9 {
|
|
144
|
-
margin-right: 64px;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.emotion-10 {
|
|
149
|
-
display: inline-block;
|
|
150
|
-
transition-property: color;
|
|
151
|
-
transition-duration: 200ms;
|
|
152
|
-
transition-timing-function: cubic-bezier(0, 0, .5, 1);
|
|
153
|
-
color: #FFFFFF;
|
|
154
|
-
-webkit-text-decoration: none;
|
|
155
|
-
text-decoration: none;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.emotion-10 svg {
|
|
159
|
-
fill: #FFFFFF;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.emotion-10:hover:not(:disabled) {
|
|
163
|
-
color: #FFFFFF;
|
|
164
|
-
-webkit-text-decoration: underline;
|
|
165
|
-
text-decoration: underline;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.emotion-10:hover:not(:disabled) svg {
|
|
169
|
-
fill: #FFFFFF;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.emotion-10:active:not(:disabled) {
|
|
173
|
-
color: #FFFFFF;
|
|
174
|
-
-webkit-text-decoration: underline;
|
|
175
|
-
text-decoration: underline;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.emotion-10:active:not(:disabled) svg {
|
|
179
|
-
fill: #FFFFFF;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.emotion-11 {
|
|
183
|
-
display: -webkit-box;
|
|
184
|
-
display: -webkit-flex;
|
|
185
|
-
display: -ms-flexbox;
|
|
186
|
-
display: flex;
|
|
187
|
-
height: 100%;
|
|
188
|
-
-webkit-align-items: center;
|
|
189
|
-
-webkit-box-align: center;
|
|
190
|
-
-ms-flex-align: center;
|
|
191
|
-
align-items: center;
|
|
192
|
-
-webkit-flex-direction: row;
|
|
193
|
-
-ms-flex-direction: row;
|
|
194
|
-
flex-direction: row;
|
|
195
|
-
-webkit-box-pack: start;
|
|
196
|
-
-ms-flex-pack: start;
|
|
197
|
-
-webkit-justify-content: flex-start;
|
|
198
|
-
justify-content: flex-start;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.emotion-12 {
|
|
202
|
-
margin: 0;
|
|
203
|
-
font-family: "DM Sans",sans-serif;
|
|
204
|
-
font-size: 14px;
|
|
205
|
-
line-height: 21px;
|
|
206
|
-
font-weight: 500;
|
|
207
|
-
letter-spacing: 0;
|
|
208
|
-
padding: 0.5px 0px;
|
|
209
|
-
display: inline-block;
|
|
210
|
-
display: block;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
.emotion-12::before {
|
|
214
|
-
content: '';
|
|
215
|
-
margin-bottom: -0.391em;
|
|
216
|
-
display: block;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.emotion-12::after {
|
|
220
|
-
content: '';
|
|
221
|
-
margin-top: -0.409em;
|
|
222
|
-
display: block;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.emotion-35 {
|
|
226
|
-
margin: 0;
|
|
227
|
-
color: #535353;
|
|
228
|
-
font-family: "DM Sans",sans-serif;
|
|
229
|
-
font-size: 14px;
|
|
230
|
-
line-height: 1.5;
|
|
231
|
-
font-weight: 500;
|
|
232
|
-
letter-spacing: 0;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.emotion-35 svg {
|
|
236
|
-
fill: #535353;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
<div
|
|
240
|
-
class="emotion-0"
|
|
5
|
+
<div
|
|
6
|
+
class="css-1p8e12n"
|
|
241
7
|
>
|
|
242
8
|
<div
|
|
243
|
-
class="
|
|
9
|
+
class="css-8atxkm"
|
|
244
10
|
>
|
|
245
11
|
<div
|
|
246
|
-
class="
|
|
12
|
+
class="css-1w88buo"
|
|
247
13
|
data-testid="PageLayout"
|
|
248
14
|
>
|
|
249
15
|
<div
|
|
250
|
-
class="
|
|
16
|
+
class="css-18d6eiw"
|
|
251
17
|
data-testid="PageLayout"
|
|
252
18
|
>
|
|
253
19
|
<div
|
|
254
|
-
class="
|
|
20
|
+
class="css-a1yn46"
|
|
255
21
|
>
|
|
256
22
|
<svg
|
|
257
|
-
class="
|
|
23
|
+
class="css-kgdu16"
|
|
258
24
|
height="48px"
|
|
259
25
|
viewBox="0 0 244 40"
|
|
260
26
|
>
|
|
@@ -278,30 +44,30 @@ exports[`Footer tests should render footer 1`] = `
|
|
|
278
44
|
</svg>
|
|
279
45
|
</div>
|
|
280
46
|
<div
|
|
281
|
-
class="
|
|
47
|
+
class="css-a1yn46"
|
|
282
48
|
>
|
|
283
49
|
<hr
|
|
284
50
|
aria-hidden="true"
|
|
285
|
-
class="
|
|
51
|
+
class="css-13iiewa"
|
|
286
52
|
data-testid="divider"
|
|
287
53
|
/>
|
|
288
54
|
</div>
|
|
289
55
|
<div
|
|
290
|
-
class="
|
|
56
|
+
class="css-hx18jh"
|
|
291
57
|
>
|
|
292
58
|
<span
|
|
293
|
-
class="
|
|
59
|
+
class="css-1v0p1qz"
|
|
294
60
|
>
|
|
295
61
|
<a
|
|
296
62
|
aria-label="NavLink One"
|
|
297
|
-
class="
|
|
63
|
+
class="css-e43kyg"
|
|
298
64
|
href="/link-one"
|
|
299
65
|
>
|
|
300
66
|
<span
|
|
301
|
-
class="
|
|
67
|
+
class="css-17x5lw"
|
|
302
68
|
>
|
|
303
69
|
<span
|
|
304
|
-
class="
|
|
70
|
+
class="css-kxo08d"
|
|
305
71
|
>
|
|
306
72
|
NavLink One
|
|
307
73
|
</span>
|
|
@@ -309,18 +75,18 @@ exports[`Footer tests should render footer 1`] = `
|
|
|
309
75
|
</a>
|
|
310
76
|
</span>
|
|
311
77
|
<span
|
|
312
|
-
class="
|
|
78
|
+
class="css-1v0p1qz"
|
|
313
79
|
>
|
|
314
80
|
<a
|
|
315
81
|
aria-label="NavLink Two"
|
|
316
|
-
class="
|
|
82
|
+
class="css-e43kyg"
|
|
317
83
|
href="/link-two"
|
|
318
84
|
>
|
|
319
85
|
<span
|
|
320
|
-
class="
|
|
86
|
+
class="css-17x5lw"
|
|
321
87
|
>
|
|
322
88
|
<span
|
|
323
|
-
class="
|
|
89
|
+
class="css-kxo08d"
|
|
324
90
|
>
|
|
325
91
|
NavLink Two
|
|
326
92
|
</span>
|
|
@@ -328,18 +94,18 @@ exports[`Footer tests should render footer 1`] = `
|
|
|
328
94
|
</a>
|
|
329
95
|
</span>
|
|
330
96
|
<span
|
|
331
|
-
class="
|
|
97
|
+
class="css-1v0p1qz"
|
|
332
98
|
>
|
|
333
99
|
<a
|
|
334
100
|
aria-label="NavLink Three"
|
|
335
|
-
class="
|
|
101
|
+
class="css-e43kyg"
|
|
336
102
|
href="/link-three"
|
|
337
103
|
>
|
|
338
104
|
<span
|
|
339
|
-
class="
|
|
105
|
+
class="css-17x5lw"
|
|
340
106
|
>
|
|
341
107
|
<span
|
|
342
|
-
class="
|
|
108
|
+
class="css-kxo08d"
|
|
343
109
|
>
|
|
344
110
|
NavLink Three
|
|
345
111
|
</span>
|
|
@@ -347,18 +113,18 @@ exports[`Footer tests should render footer 1`] = `
|
|
|
347
113
|
</a>
|
|
348
114
|
</span>
|
|
349
115
|
<span
|
|
350
|
-
class="
|
|
116
|
+
class="css-1v0p1qz"
|
|
351
117
|
>
|
|
352
118
|
<a
|
|
353
119
|
aria-label="NavLink Four"
|
|
354
|
-
class="
|
|
120
|
+
class="css-e43kyg"
|
|
355
121
|
href="/link-four"
|
|
356
122
|
>
|
|
357
123
|
<span
|
|
358
|
-
class="
|
|
124
|
+
class="css-17x5lw"
|
|
359
125
|
>
|
|
360
126
|
<span
|
|
361
|
-
class="
|
|
127
|
+
class="css-kxo08d"
|
|
362
128
|
>
|
|
363
129
|
NavLink Four
|
|
364
130
|
</span>
|
|
@@ -366,18 +132,18 @@ exports[`Footer tests should render footer 1`] = `
|
|
|
366
132
|
</a>
|
|
367
133
|
</span>
|
|
368
134
|
<span
|
|
369
|
-
class="
|
|
135
|
+
class="css-1v0p1qz"
|
|
370
136
|
>
|
|
371
137
|
<a
|
|
372
138
|
aria-label="NavLink Five"
|
|
373
|
-
class="
|
|
139
|
+
class="css-e43kyg"
|
|
374
140
|
href="/link-five"
|
|
375
141
|
>
|
|
376
142
|
<span
|
|
377
|
-
class="
|
|
143
|
+
class="css-17x5lw"
|
|
378
144
|
>
|
|
379
145
|
<span
|
|
380
|
-
class="
|
|
146
|
+
class="css-kxo08d"
|
|
381
147
|
>
|
|
382
148
|
NavLink Five
|
|
383
149
|
</span>
|
|
@@ -385,18 +151,18 @@ exports[`Footer tests should render footer 1`] = `
|
|
|
385
151
|
</a>
|
|
386
152
|
</span>
|
|
387
153
|
<span
|
|
388
|
-
class="
|
|
154
|
+
class="css-1v0p1qz"
|
|
389
155
|
>
|
|
390
156
|
<a
|
|
391
157
|
aria-label="NavLink Six"
|
|
392
|
-
class="
|
|
158
|
+
class="css-e43kyg"
|
|
393
159
|
href="/link-six"
|
|
394
160
|
>
|
|
395
161
|
<span
|
|
396
|
-
class="
|
|
162
|
+
class="css-17x5lw"
|
|
397
163
|
>
|
|
398
164
|
<span
|
|
399
|
-
class="
|
|
165
|
+
class="css-kxo08d"
|
|
400
166
|
>
|
|
401
167
|
NavLink Six
|
|
402
168
|
</span>
|
|
@@ -405,16 +171,16 @@ exports[`Footer tests should render footer 1`] = `
|
|
|
405
171
|
</span>
|
|
406
172
|
</div>
|
|
407
173
|
<div
|
|
408
|
-
class="
|
|
174
|
+
class="css-a1yn46"
|
|
409
175
|
>
|
|
410
176
|
<hr
|
|
411
177
|
aria-hidden="true"
|
|
412
|
-
class="
|
|
178
|
+
class="css-13iiewa"
|
|
413
179
|
data-testid="divider"
|
|
414
180
|
/>
|
|
415
181
|
</div>
|
|
416
182
|
<p
|
|
417
|
-
class="
|
|
183
|
+
class="css-1rn2unv"
|
|
418
184
|
>
|
|
419
185
|
Copyright © YYYY News Corp. All rights reserved.
|
|
420
186
|
</p>
|
|
@@ -92,6 +92,13 @@ const pastDueBanner = {
|
|
|
92
92
|
text:
|
|
93
93
|
'You have cancelled your subscription and will lose access to all benefits on ##DATE##. To re-activate your subscription call ##PHONE_NUMBER##.',
|
|
94
94
|
},
|
|
95
|
+
toBeCancelledWithRefund: {
|
|
96
|
+
title: 'Your subscription will end soon.',
|
|
97
|
+
phoneNumber: '0800 xxxx xxxxx',
|
|
98
|
+
text:
|
|
99
|
+
'We have successfully cancelled your subscription and will be processing your refund shortly. If you have any question please call ##PHONE_NUMBER##.',
|
|
100
|
+
dismissDays: 7,
|
|
101
|
+
},
|
|
95
102
|
treshold: {
|
|
96
103
|
firstNotice: 26,
|
|
97
104
|
secondNotice: 30,
|
|
@@ -1,30 +1,49 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { Block, GridLayout } from 'newskit'
|
|
3
|
+
import { ArticleRecommendation } from '@newskit-render/standalone-components'
|
|
3
4
|
import { LayoutProps } from './types'
|
|
4
5
|
import { outerGridOverride } from './gridUtils'
|
|
5
6
|
import { getBlock } from './Block'
|
|
6
7
|
|
|
7
8
|
export const BasicRow: React.FC<LayoutProps> = ({
|
|
8
9
|
slice,
|
|
10
|
+
articles,
|
|
9
11
|
colums,
|
|
10
12
|
variant = 'titleTeaserVertical',
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
13
|
+
'data-testid': testid,
|
|
14
|
+
}) => {
|
|
15
|
+
const dataTestid =
|
|
16
|
+
(testid && testid) || (slice && `${slice.name}-Grid`) || 'Articles-Grid'
|
|
17
|
+
return (
|
|
18
|
+
<GridLayout
|
|
19
|
+
columns={colums}
|
|
20
|
+
columnGap="space050"
|
|
21
|
+
data-testid={dataTestid}
|
|
22
|
+
{...outerGridOverride}
|
|
23
|
+
>
|
|
24
|
+
{articles
|
|
25
|
+
? articles.map((article, i) => (
|
|
26
|
+
/* eslint-disable-next-line */
|
|
27
|
+
<Block
|
|
28
|
+
spaceStack="space050"
|
|
29
|
+
key={article.title}
|
|
30
|
+
data-testid={`articleRec-${i}`}
|
|
31
|
+
>
|
|
32
|
+
<ArticleRecommendation article={article} size="large" />
|
|
33
|
+
</Block>
|
|
34
|
+
))
|
|
35
|
+
: slice.children.map((block, i) => (
|
|
36
|
+
/* eslint-disable-next-line */
|
|
37
|
+
<Block
|
|
38
|
+
key={'article' in block ? block.article.id : i}
|
|
39
|
+
data-testid={`titleTeaserVertical-${i}`}
|
|
40
|
+
>
|
|
41
|
+
{getBlock(block, variant)}
|
|
42
|
+
</Block>
|
|
43
|
+
))}
|
|
44
|
+
</GridLayout>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
28
47
|
|
|
29
48
|
export const Row3: React.FC<LayoutProps> = ({ slice }) => (
|
|
30
49
|
<GridLayout
|
|
@@ -2,6 +2,7 @@ import { renderWithTheme } from '../../../../helpers/test-utils'
|
|
|
2
2
|
import { BasicRow, Row3 } from '../Rows'
|
|
3
3
|
import { getPageMock } from '../../../../helpers/mocks'
|
|
4
4
|
import { ArticleSlice } from '../../../../helpers/global-types'
|
|
5
|
+
import { relatedArticles } from '../../../../helpers/mocks/articleMock'
|
|
5
6
|
|
|
6
7
|
describe('Rows', () => {
|
|
7
8
|
test('should render a row with 2 columns', () => {
|
|
@@ -25,4 +26,15 @@ describe('Rows', () => {
|
|
|
25
26
|
|
|
26
27
|
expect(getAllByTestId(/titleTeaserVertical-/).length).toEqual(3)
|
|
27
28
|
})
|
|
29
|
+
|
|
30
|
+
describe('Recommended articles', () => {
|
|
31
|
+
test('should render with recommended articles', () => {
|
|
32
|
+
const { getAllByTestId } = renderWithTheme(BasicRow, {
|
|
33
|
+
articles: relatedArticles,
|
|
34
|
+
colums: { xs: '1fr', md: '1fr 1fr', lg: '1fr 1fr 1fr' },
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
expect(getAllByTestId(/articleRec-/).length).toEqual(4)
|
|
38
|
+
})
|
|
39
|
+
})
|
|
28
40
|
})
|