@newskit-render/core 4.62.13 → 4.62.14-672c61c57.5
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/__tests__/pages/__snapshots__/home.test.tsx.snap +75 -0
- package/__tests__/pages/home.test.tsx +14 -0
- package/components/article/__tests__/__snapshots__/index.test.tsx.snap +75 -0
- package/components/article/__tests__/index.test.tsx +53 -14
- package/components/article/__tests__/mocks.ts +8 -0
- package/components/header/banner-messages.ts +5 -0
- package/package.json +11 -11
|
@@ -164,6 +164,81 @@ exports[`getServerSideProps Homepage 1`] = `
|
|
|
164
164
|
</span>
|
|
165
165
|
</a>
|
|
166
166
|
</div>
|
|
167
|
+
<div
|
|
168
|
+
class="css-bo73co"
|
|
169
|
+
>
|
|
170
|
+
<hr
|
|
171
|
+
aria-hidden="true"
|
|
172
|
+
class="css-1y03jd"
|
|
173
|
+
data-testid="divider"
|
|
174
|
+
/>
|
|
175
|
+
<hr
|
|
176
|
+
aria-hidden="true"
|
|
177
|
+
class="css-80khzk"
|
|
178
|
+
data-testid="divider"
|
|
179
|
+
/>
|
|
180
|
+
</div>
|
|
181
|
+
<div
|
|
182
|
+
class="css-mycqxl"
|
|
183
|
+
>
|
|
184
|
+
<a
|
|
185
|
+
class="css-1ulbpfm"
|
|
186
|
+
href="/account"
|
|
187
|
+
>
|
|
188
|
+
<span
|
|
189
|
+
class="css-pqzzby"
|
|
190
|
+
>
|
|
191
|
+
<span
|
|
192
|
+
class="css-1xzc2un"
|
|
193
|
+
>
|
|
194
|
+
<svg
|
|
195
|
+
aria-hidden="true"
|
|
196
|
+
class="css-fvymbj"
|
|
197
|
+
data-testid="account-link"
|
|
198
|
+
fill="currentColor"
|
|
199
|
+
height="24px"
|
|
200
|
+
viewBox="0 0 24 24"
|
|
201
|
+
width="24px"
|
|
202
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
203
|
+
>
|
|
204
|
+
<path
|
|
205
|
+
clip-rule="evenodd"
|
|
206
|
+
d="M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM7.07 18.28C7.5 17.38 10.12 16.5 12 16.5C13.88 16.5 16.51 17.38 16.93 18.28C15.57 19.36 13.86 20 12 20C10.14 20 8.43 19.36 7.07 18.28ZM12 14.5C13.46 14.5 16.93 15.09 18.36 16.83C19.38 15.49 20 13.82 20 12C20 7.59 16.41 4 12 4C7.59 4 4 7.59 4 12C4 13.82 4.62 15.49 5.64 16.83C7.07 15.09 10.54 14.5 12 14.5ZM12 6C10.06 6 8.5 7.56 8.5 9.5C8.5 11.44 10.06 13 12 13C13.94 13 15.5 11.44 15.5 9.5C15.5 7.56 13.94 6 12 6ZM10.5 9.5C10.5 10.33 11.17 11 12 11C12.83 11 13.5 10.33 13.5 9.5C13.5 8.67 12.83 8 12 8C11.17 8 10.5 8.67 10.5 9.5Z"
|
|
207
|
+
fill="#FFFFFF"
|
|
208
|
+
fill-rule="evenodd"
|
|
209
|
+
/>
|
|
210
|
+
</svg>
|
|
211
|
+
</span>
|
|
212
|
+
<span
|
|
213
|
+
class="css-1xzc2un"
|
|
214
|
+
>
|
|
215
|
+
<hr
|
|
216
|
+
aria-hidden="true"
|
|
217
|
+
class="css-1y03jd"
|
|
218
|
+
data-testid="divider"
|
|
219
|
+
/>
|
|
220
|
+
</span>
|
|
221
|
+
<span
|
|
222
|
+
class="css-1xzc2un"
|
|
223
|
+
>
|
|
224
|
+
<hr
|
|
225
|
+
aria-hidden="true"
|
|
226
|
+
class="css-80khzk"
|
|
227
|
+
data-testid="divider"
|
|
228
|
+
/>
|
|
229
|
+
</span>
|
|
230
|
+
<span
|
|
231
|
+
class="css-1xzc2un"
|
|
232
|
+
>
|
|
233
|
+
<span
|
|
234
|
+
class="css-yk25sg"
|
|
235
|
+
>
|
|
236
|
+
Account
|
|
237
|
+
</span>
|
|
238
|
+
</span>
|
|
239
|
+
</span>
|
|
240
|
+
</a>
|
|
241
|
+
</div>
|
|
167
242
|
</div>
|
|
168
243
|
</nav>
|
|
169
244
|
</div>
|
|
@@ -8,8 +8,22 @@ jest.mock('../../helpers/getYear', () => ({
|
|
|
8
8
|
|
|
9
9
|
describe('getServerSideProps', () => {
|
|
10
10
|
test('Homepage', () => {
|
|
11
|
+
const mockUser = {
|
|
12
|
+
firstName: '',
|
|
13
|
+
lastName: '',
|
|
14
|
+
cpn: '',
|
|
15
|
+
email: '',
|
|
16
|
+
hash: '',
|
|
17
|
+
mobile: '',
|
|
18
|
+
phoneNumber: '',
|
|
19
|
+
dateOfBirth: '',
|
|
20
|
+
paymentFailure: { active: false, startDate: '' },
|
|
21
|
+
subscriptions: [],
|
|
22
|
+
account: { optOut: false },
|
|
23
|
+
}
|
|
11
24
|
const { asFragment } = renderWithTheme(SectionPage, {
|
|
12
25
|
page: getPageMock.page,
|
|
26
|
+
user: mockUser,
|
|
13
27
|
})
|
|
14
28
|
expect(asFragment()).toMatchSnapshot()
|
|
15
29
|
})
|
|
@@ -164,6 +164,81 @@ exports[`Article should render tile and sub title 1`] = `
|
|
|
164
164
|
</span>
|
|
165
165
|
</a>
|
|
166
166
|
</div>
|
|
167
|
+
<div
|
|
168
|
+
class="css-bo73co"
|
|
169
|
+
>
|
|
170
|
+
<hr
|
|
171
|
+
aria-hidden="true"
|
|
172
|
+
class="css-1y03jd"
|
|
173
|
+
data-testid="divider"
|
|
174
|
+
/>
|
|
175
|
+
<hr
|
|
176
|
+
aria-hidden="true"
|
|
177
|
+
class="css-80khzk"
|
|
178
|
+
data-testid="divider"
|
|
179
|
+
/>
|
|
180
|
+
</div>
|
|
181
|
+
<div
|
|
182
|
+
class="css-mycqxl"
|
|
183
|
+
>
|
|
184
|
+
<a
|
|
185
|
+
class="css-1ulbpfm"
|
|
186
|
+
href="/account"
|
|
187
|
+
>
|
|
188
|
+
<span
|
|
189
|
+
class="css-pqzzby"
|
|
190
|
+
>
|
|
191
|
+
<span
|
|
192
|
+
class="css-1xzc2un"
|
|
193
|
+
>
|
|
194
|
+
<svg
|
|
195
|
+
aria-hidden="true"
|
|
196
|
+
class="css-fvymbj"
|
|
197
|
+
data-testid="account-link"
|
|
198
|
+
fill="currentColor"
|
|
199
|
+
height="24px"
|
|
200
|
+
viewBox="0 0 24 24"
|
|
201
|
+
width="24px"
|
|
202
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
203
|
+
>
|
|
204
|
+
<path
|
|
205
|
+
clip-rule="evenodd"
|
|
206
|
+
d="M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM7.07 18.28C7.5 17.38 10.12 16.5 12 16.5C13.88 16.5 16.51 17.38 16.93 18.28C15.57 19.36 13.86 20 12 20C10.14 20 8.43 19.36 7.07 18.28ZM12 14.5C13.46 14.5 16.93 15.09 18.36 16.83C19.38 15.49 20 13.82 20 12C20 7.59 16.41 4 12 4C7.59 4 4 7.59 4 12C4 13.82 4.62 15.49 5.64 16.83C7.07 15.09 10.54 14.5 12 14.5ZM12 6C10.06 6 8.5 7.56 8.5 9.5C8.5 11.44 10.06 13 12 13C13.94 13 15.5 11.44 15.5 9.5C15.5 7.56 13.94 6 12 6ZM10.5 9.5C10.5 10.33 11.17 11 12 11C12.83 11 13.5 10.33 13.5 9.5C13.5 8.67 12.83 8 12 8C11.17 8 10.5 8.67 10.5 9.5Z"
|
|
207
|
+
fill="#FFFFFF"
|
|
208
|
+
fill-rule="evenodd"
|
|
209
|
+
/>
|
|
210
|
+
</svg>
|
|
211
|
+
</span>
|
|
212
|
+
<span
|
|
213
|
+
class="css-1xzc2un"
|
|
214
|
+
>
|
|
215
|
+
<hr
|
|
216
|
+
aria-hidden="true"
|
|
217
|
+
class="css-1y03jd"
|
|
218
|
+
data-testid="divider"
|
|
219
|
+
/>
|
|
220
|
+
</span>
|
|
221
|
+
<span
|
|
222
|
+
class="css-1xzc2un"
|
|
223
|
+
>
|
|
224
|
+
<hr
|
|
225
|
+
aria-hidden="true"
|
|
226
|
+
class="css-80khzk"
|
|
227
|
+
data-testid="divider"
|
|
228
|
+
/>
|
|
229
|
+
</span>
|
|
230
|
+
<span
|
|
231
|
+
class="css-1xzc2un"
|
|
232
|
+
>
|
|
233
|
+
<span
|
|
234
|
+
class="css-yk25sg"
|
|
235
|
+
>
|
|
236
|
+
Account
|
|
237
|
+
</span>
|
|
238
|
+
</span>
|
|
239
|
+
</span>
|
|
240
|
+
</a>
|
|
241
|
+
</div>
|
|
167
242
|
</div>
|
|
168
243
|
</nav>
|
|
169
244
|
</div>
|
|
@@ -4,7 +4,7 @@ import { within } from '@testing-library/react'
|
|
|
4
4
|
import Article from '..'
|
|
5
5
|
import { Video } from '../../../helpers/global-types'
|
|
6
6
|
import { renderWithTheme } from '../../../helpers/test-utils'
|
|
7
|
-
import { dpaTemplatesMock, articleData } from './mocks'
|
|
7
|
+
import { dpaTemplatesMock, articleData, userData } from './mocks'
|
|
8
8
|
|
|
9
9
|
const ArticleWrapper = (props) => (
|
|
10
10
|
<ArticleRecommendationsProviderContext.Provider
|
|
@@ -39,7 +39,10 @@ describe('Article', () => {
|
|
|
39
39
|
test('should render tile and sub title', () => {
|
|
40
40
|
const { getByTestId, asFragment } = renderWithTheme(
|
|
41
41
|
ArticleWrapper,
|
|
42
|
-
|
|
42
|
+
{
|
|
43
|
+
...articleData,
|
|
44
|
+
...userData
|
|
45
|
+
}
|
|
43
46
|
)
|
|
44
47
|
const headLine = within(getByTestId('HeadLine'))
|
|
45
48
|
const kicker = within(getByTestId('Kicker'))
|
|
@@ -53,7 +56,10 @@ describe('Article', () => {
|
|
|
53
56
|
})
|
|
54
57
|
|
|
55
58
|
test('should render byline', () => {
|
|
56
|
-
const { getByTestId } = renderWithTheme(ArticleWrapper,
|
|
59
|
+
const { getByTestId } = renderWithTheme(ArticleWrapper, {
|
|
60
|
+
...articleData,
|
|
61
|
+
...userData
|
|
62
|
+
})
|
|
57
63
|
const byline = within(getByTestId('MetaBox'))
|
|
58
64
|
const authorName = byline.getByText('John Smith')
|
|
59
65
|
const authorTitle = byline.getByText('John Smith')
|
|
@@ -63,14 +69,20 @@ describe('Article', () => {
|
|
|
63
69
|
|
|
64
70
|
test('should render published time', () => {
|
|
65
71
|
articleData.updatedDateTime = undefined
|
|
66
|
-
const { getByTestId } = renderWithTheme(ArticleWrapper,
|
|
72
|
+
const { getByTestId } = renderWithTheme(ArticleWrapper, {
|
|
73
|
+
...articleData,
|
|
74
|
+
...userData
|
|
75
|
+
})
|
|
67
76
|
const metaBox = within(getByTestId('MetaBox'))
|
|
68
77
|
const date = metaBox.getByText('Thu February 14 2019, 12:00am')
|
|
69
78
|
expect(date).toBeInTheDocument()
|
|
70
79
|
})
|
|
71
80
|
|
|
72
81
|
test('should render related topics', () => {
|
|
73
|
-
const { getByTestId } = renderWithTheme(ArticleWrapper,
|
|
82
|
+
const { getByTestId } = renderWithTheme(ArticleWrapper, {
|
|
83
|
+
...articleData,
|
|
84
|
+
...userData
|
|
85
|
+
})
|
|
74
86
|
const topics = within(getByTestId('RelatedTopics')).getAllByTestId('tag')
|
|
75
87
|
expect(topics[0].getAttribute('href')).toBe(null)
|
|
76
88
|
expect(within(topics[0]).getByText('Some topic one')).toBeInTheDocument()
|
|
@@ -82,12 +94,18 @@ describe('Article', () => {
|
|
|
82
94
|
|
|
83
95
|
test('should not render related topics', () => {
|
|
84
96
|
articleData.topics = undefined
|
|
85
|
-
const { getByTestId } = renderWithTheme(ArticleWrapper,
|
|
97
|
+
const { getByTestId } = renderWithTheme(ArticleWrapper, {
|
|
98
|
+
...articleData,
|
|
99
|
+
...userData
|
|
100
|
+
})
|
|
86
101
|
expect(() => getByTestId('topics')).toThrow()
|
|
87
102
|
})
|
|
88
103
|
|
|
89
104
|
test('should render highlights panel', () => {
|
|
90
|
-
const { getByTestId } = renderWithTheme(ArticleWrapper,
|
|
105
|
+
const { getByTestId } = renderWithTheme(ArticleWrapper, {
|
|
106
|
+
...articleData,
|
|
107
|
+
...userData
|
|
108
|
+
})
|
|
91
109
|
const title = within(getByTestId('Highlights')).getAllByText(
|
|
92
110
|
'Highlights'
|
|
93
111
|
)[0]
|
|
@@ -99,7 +117,10 @@ describe('Article', () => {
|
|
|
99
117
|
})
|
|
100
118
|
|
|
101
119
|
test('should render related articles panel', () => {
|
|
102
|
-
const { getByTestId } = renderWithTheme(ArticleWrapper,
|
|
120
|
+
const { getByTestId } = renderWithTheme(ArticleWrapper, {
|
|
121
|
+
...articleData,
|
|
122
|
+
...userData
|
|
123
|
+
})
|
|
103
124
|
const title = within(getByTestId('RelatedArticles')).getByText('Related')
|
|
104
125
|
const card = within(getByTestId('RelatedArticles')).getAllByTestId(
|
|
105
126
|
'article-recommendation-large'
|
|
@@ -110,7 +131,10 @@ describe('Article', () => {
|
|
|
110
131
|
})
|
|
111
132
|
|
|
112
133
|
test('should render image', () => {
|
|
113
|
-
const { getByAltText } = renderWithTheme(ArticleWrapper,
|
|
134
|
+
const { getByAltText } = renderWithTheme(ArticleWrapper, {
|
|
135
|
+
...articleData,
|
|
136
|
+
...userData
|
|
137
|
+
})
|
|
114
138
|
const img = getByAltText('testIMG')
|
|
115
139
|
expect(img.getAttribute('src')).toBe(
|
|
116
140
|
'/_next/image?url=%2Fimg%2Furl&w=3840&q=75'
|
|
@@ -119,12 +143,18 @@ describe('Article', () => {
|
|
|
119
143
|
|
|
120
144
|
test('should not render image', () => {
|
|
121
145
|
articleData.media = undefined
|
|
122
|
-
const { getByAltText } = renderWithTheme(ArticleWrapper,
|
|
146
|
+
const { getByAltText } = renderWithTheme(ArticleWrapper, {
|
|
147
|
+
...articleData,
|
|
148
|
+
...userData
|
|
149
|
+
})
|
|
123
150
|
expect(() => getByAltText('testIMG')).toThrow()
|
|
124
151
|
})
|
|
125
152
|
|
|
126
153
|
test('should render paragraphs', () => {
|
|
127
|
-
const { getByTestId } = renderWithTheme(ArticleWrapper,
|
|
154
|
+
const { getByTestId } = renderWithTheme(ArticleWrapper, {
|
|
155
|
+
...articleData,
|
|
156
|
+
...userData
|
|
157
|
+
})
|
|
128
158
|
const paragraphs = getByTestId('ArticleContent')
|
|
129
159
|
expect(within(paragraphs).getByText('paragraph one')).toBeInTheDocument()
|
|
130
160
|
expect(within(paragraphs).getByText('paragraph two')).toBeInTheDocument()
|
|
@@ -133,7 +163,10 @@ describe('Article', () => {
|
|
|
133
163
|
|
|
134
164
|
test('should not render paragraphs', () => {
|
|
135
165
|
articleData.summary = undefined
|
|
136
|
-
const { getByTestId } = renderWithTheme(ArticleWrapper,
|
|
166
|
+
const { getByTestId } = renderWithTheme(ArticleWrapper, {
|
|
167
|
+
...articleData,
|
|
168
|
+
...userData
|
|
169
|
+
})
|
|
137
170
|
expect(() =>
|
|
138
171
|
within(getByTestId('ArticleContent')).getAllByTestId('ArticleParagraph')
|
|
139
172
|
).toThrow()
|
|
@@ -156,7 +189,10 @@ describe('Article', () => {
|
|
|
156
189
|
},
|
|
157
190
|
},
|
|
158
191
|
}
|
|
159
|
-
const { getByTestId } = renderWithTheme(ArticleWrapper,
|
|
192
|
+
const { getByTestId } = renderWithTheme(ArticleWrapper, {
|
|
193
|
+
...articleWithVideo, // <-- use articleWithVideo here
|
|
194
|
+
...userData
|
|
195
|
+
})
|
|
160
196
|
const video = getByTestId('bc-video-player')
|
|
161
197
|
const articleVideo = articleWithVideo?.media as Video
|
|
162
198
|
expect(video.getAttribute('data-account')).toBe(articleVideo.accountId)
|
|
@@ -165,7 +201,10 @@ describe('Article', () => {
|
|
|
165
201
|
|
|
166
202
|
test('should not render video', () => {
|
|
167
203
|
articleData.media = undefined
|
|
168
|
-
const { getByTestId } = renderWithTheme(ArticleWrapper,
|
|
204
|
+
const { getByTestId } = renderWithTheme(ArticleWrapper, {
|
|
205
|
+
...articleData,
|
|
206
|
+
...userData
|
|
207
|
+
})
|
|
169
208
|
expect(() => getByTestId('bc-video-player')).toThrow()
|
|
170
209
|
})
|
|
171
210
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newskit-render/core",
|
|
3
|
-
"version": "4.62.
|
|
3
|
+
"version": "4.62.14-672c61c57.5+672c61c57",
|
|
4
4
|
"description": "Newskit Render - Core package",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -42,15 +42,15 @@
|
|
|
42
42
|
"@emotion/styled": "11.9.3",
|
|
43
43
|
"@newrelic/next": "0.5.2",
|
|
44
44
|
"@newrelic/winston-enricher": "4.0.1",
|
|
45
|
-
"@newskit-render/api": "^1.19.
|
|
46
|
-
"@newskit-render/auth": "^1.10.
|
|
47
|
-
"@newskit-render/checkout": "^3.13.
|
|
48
|
-
"@newskit-render/feature-flags": "^1.15.
|
|
49
|
-
"@newskit-render/feed": "^1.10.
|
|
50
|
-
"@newskit-render/my-account": "^7.180.5",
|
|
51
|
-
"@newskit-render/shared-components": "^4.72.
|
|
52
|
-
"@newskit-render/standalone-components": "^3.28.
|
|
53
|
-
"@newskit-render/validation": "^1.24.
|
|
45
|
+
"@newskit-render/api": "^1.19.1-672c61c57.31+672c61c57",
|
|
46
|
+
"@newskit-render/auth": "^1.10.1-672c61c57.192+672c61c57",
|
|
47
|
+
"@newskit-render/checkout": "^3.13.25-672c61c57.17+672c61c57",
|
|
48
|
+
"@newskit-render/feature-flags": "^1.15.2-672c61c57.21+672c61c57",
|
|
49
|
+
"@newskit-render/feed": "^1.10.2-672c61c57.31+672c61c57",
|
|
50
|
+
"@newskit-render/my-account": "^7.180.6-672c61c57.5+672c61c57",
|
|
51
|
+
"@newskit-render/shared-components": "^4.72.5-672c61c57.17+672c61c57",
|
|
52
|
+
"@newskit-render/standalone-components": "^3.28.12-672c61c57.17+672c61c57",
|
|
53
|
+
"@newskit-render/validation": "^1.24.1-672c61c57.41+672c61c57",
|
|
54
54
|
"cross-fetch": "3.1.5",
|
|
55
55
|
"graphql": "16.6.0",
|
|
56
56
|
"lodash.get": "4.4.2",
|
|
@@ -123,5 +123,5 @@
|
|
|
123
123
|
"@types/pino-std-serializers": "2.4.1",
|
|
124
124
|
"@types/pino-pretty": "4.7.5"
|
|
125
125
|
},
|
|
126
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "672c61c573cff53530846915b51bf2c8daae364f"
|
|
127
127
|
}
|