@financial-times/cp-content-pipeline-ui 9.12.1 → 9.13.0
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 +24 -0
- package/lib/components/ContentLayout/index.d.ts +24 -0
- package/lib/components/ContentLayout/index.js +34 -0
- package/lib/components/ContentLayout/index.js.map +1 -0
- package/lib/components/ContentLayout/test/index.spec.d.ts +1 -0
- package/lib/components/ContentLayout/test/index.spec.js +57 -0
- package/lib/components/ContentLayout/test/index.spec.js.map +1 -0
- package/lib/components/content-tree/Clip/components/index.d.ts +0 -2
- package/lib/components/content-tree/Clip/components/index.js +1 -5
- package/lib/components/content-tree/Clip/components/index.js.map +1 -1
- package/lib/components/content-tree/Clip/template/component.d.ts +1 -1
- package/lib/components/content-tree/Clip/template/component.js +3 -3
- package/lib/components/content-tree/Clip/template/component.js.map +1 -1
- package/lib/components/content-tree/Clip/test/snapshot.spec.js +26 -0
- package/lib/components/content-tree/Clip/test/snapshot.spec.js.map +1 -1
- package/package.json +4 -4
- package/src/components/ContentLayout/index.tsx +91 -0
- package/src/components/ContentLayout/test/__snapshots__/index.spec.tsx.snap +96 -0
- package/src/components/ContentLayout/test/index.spec.tsx +81 -0
- package/src/components/content-tree/Clip/components/index.tsx +0 -2
- package/src/components/content-tree/Clip/template/component.tsx +23 -24
- package/src/components/content-tree/Clip/test/__snapshots__/snapshot.spec.tsx.snap +277 -0
- package/src/components/content-tree/Clip/test/snapshot.spec.tsx +40 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/components/content-tree/Clip/components/Container.d.ts +0 -6
- package/lib/components/content-tree/Clip/components/Container.js +0 -13
- package/lib/components/content-tree/Clip/components/Container.js.map +0 -1
- package/lib/components/content-tree/Clip/components/ContentLayout.d.ts +0 -6
- package/lib/components/content-tree/Clip/components/ContentLayout.js +0 -13
- package/lib/components/content-tree/Clip/components/ContentLayout.js.map +0 -1
- package/src/components/content-tree/Clip/components/Container.tsx +0 -32
- package/src/components/content-tree/Clip/components/ContentLayout.tsx +0 -18
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { ContentLayout } from '../../../ContentLayout'
|
|
3
|
+
import { ClipTag } from '../components'
|
|
3
4
|
import { ContentProps } from '../../../types'
|
|
4
5
|
import type * as ComponentWorkarounds from '../../Workarounds'
|
|
5
6
|
|
|
@@ -21,7 +22,7 @@ export interface ClipPropsOld {
|
|
|
21
22
|
clips?: ComponentWorkarounds.Clip[]
|
|
22
23
|
poster?: string
|
|
23
24
|
posterAlt?: string
|
|
24
|
-
dataLayout:
|
|
25
|
+
dataLayout: 'in-line' | 'mid-grid' | 'full-grid'
|
|
25
26
|
description?: string
|
|
26
27
|
muted?: boolean
|
|
27
28
|
caption?: string
|
|
@@ -90,28 +91,26 @@ const ClipComponent: React.FC<ClipProps> = ({
|
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
return (
|
|
93
|
-
<ContentLayout dataLayout={content.dataLayout}>
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
/>
|
|
114
|
-
</Container>
|
|
94
|
+
<ContentLayout dataLayout={content.dataLayout} dataComponent="clip-set">
|
|
95
|
+
<ClipTag
|
|
96
|
+
id={id}
|
|
97
|
+
dataLayout={content.dataLayout}
|
|
98
|
+
description={content.description ?? ''}
|
|
99
|
+
poster={posterAttribute}
|
|
100
|
+
autoplay={content.autoplay}
|
|
101
|
+
noAudio={noAudio}
|
|
102
|
+
loop={content.loop}
|
|
103
|
+
muted={content.muted}
|
|
104
|
+
clip={clip}
|
|
105
|
+
credits={content.credits ?? ''}
|
|
106
|
+
caption={content.caption ?? ''}
|
|
107
|
+
systemTitle={systemTitle}
|
|
108
|
+
accessibility={accessibility}
|
|
109
|
+
preload={preload}
|
|
110
|
+
dataTrackable="next-article-cp-clip"
|
|
111
|
+
maxClipWidth={maxClipWidth}
|
|
112
|
+
fragmentIdentifier={content.fragmentIdentifier ?? ''}
|
|
113
|
+
/>
|
|
115
114
|
</ContentLayout>
|
|
116
115
|
)
|
|
117
116
|
}
|
|
@@ -1,5 +1,282 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`Clip Snapshot component rendered on server ContentLayout integration tests edge case: custom dataLayout value should wrap in ContentLayout 1`] = `
|
|
4
|
+
"<div class="n-content-layout__container--in-line" data-component="clip-set">
|
|
5
|
+
<div
|
|
6
|
+
data-cp-clip-layout="custom-layout"
|
|
7
|
+
data-cp-clip-poster=""
|
|
8
|
+
data-cp-clip-no-audio="false"
|
|
9
|
+
data-cp-clip-no-description="false"
|
|
10
|
+
data-cp-clip-caption=""
|
|
11
|
+
data-cp-clip-no-info-box="false"
|
|
12
|
+
data-cp-clip-no-caption="false"
|
|
13
|
+
data-cp-clip-closed-caption="false"
|
|
14
|
+
class="cp-clip"
|
|
15
|
+
data-trackable="next-article-cp-clip"
|
|
16
|
+
data-o-component="cp-clip"
|
|
17
|
+
data-cp-clip-id="localhost:8080/fakevideo.mpg"
|
|
18
|
+
data-cp-clip-system-title=""
|
|
19
|
+
id=""
|
|
20
|
+
>
|
|
21
|
+
<div
|
|
22
|
+
data-o-component="o-expander"
|
|
23
|
+
class="o-expander o-expander__info-box"
|
|
24
|
+
data-o-expander-shrink-to="hidden"
|
|
25
|
+
data-trackable="clip-info-box"
|
|
26
|
+
data-o-expander-collapsed-toggle-text="<span class='o-expander__visually-hidden'>Show video info</span>"
|
|
27
|
+
data-o-expander-expanded-toggle-text="<span class='o-expander__visually-hidden'>Hide video info</span>"
|
|
28
|
+
>
|
|
29
|
+
<button
|
|
30
|
+
data-trackable="toggle-open-close"
|
|
31
|
+
class="o-expander__toggle o-expander__toggle-empty"
|
|
32
|
+
>
|
|
33
|
+
<span class="o-expander__visually-hidden o3-type-detail"
|
|
34
|
+
>Show video info</span
|
|
35
|
+
>
|
|
36
|
+
</button>
|
|
37
|
+
<div class="o-expander__content video-info"></div>
|
|
38
|
+
</div>
|
|
39
|
+
<div class="cp-clip__video-container">
|
|
40
|
+
<video
|
|
41
|
+
class="cp-clip__video"
|
|
42
|
+
controls=""
|
|
43
|
+
controlsList="nodownload noremoteplayback noplaybackrate"
|
|
44
|
+
disablepictureinpicture=""
|
|
45
|
+
disableremoteplayback=""
|
|
46
|
+
playsinline=""
|
|
47
|
+
poster=""
|
|
48
|
+
preload="auto"
|
|
49
|
+
id="clip-localhost:8080/fakevideo.mpg"
|
|
50
|
+
crossorigin="anonymous"
|
|
51
|
+
style="height: fit-content; width: 100%"
|
|
52
|
+
>
|
|
53
|
+
<source
|
|
54
|
+
id="video-source-0-localhost:8080/fakevideo.mpg"
|
|
55
|
+
data-cp-component="cp-clip__video-source"
|
|
56
|
+
src="localhost:8080/fakevideo.mpg"
|
|
57
|
+
type="video/mp4"
|
|
58
|
+
/>
|
|
59
|
+
</video>
|
|
60
|
+
</div>
|
|
61
|
+
<div
|
|
62
|
+
class="cp-clip__video-meta-info"
|
|
63
|
+
data-cp-clip-video-meta-info="true"
|
|
64
|
+
></div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
"
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
exports[`Clip Snapshot component rendered on server ContentLayout integration tests full-grid default render - should wrap in ContentLayout with proper classes 1`] = `
|
|
71
|
+
"<div class="n-content-layout" data-layout-width="full-grid">
|
|
72
|
+
<div class="n-content-layout__container" data-component="clip-set">
|
|
73
|
+
<div
|
|
74
|
+
data-cp-clip-layout="full-grid"
|
|
75
|
+
data-cp-clip-poster=""
|
|
76
|
+
data-cp-clip-no-audio="false"
|
|
77
|
+
data-cp-clip-no-description="false"
|
|
78
|
+
data-cp-clip-caption=""
|
|
79
|
+
data-cp-clip-no-info-box="false"
|
|
80
|
+
data-cp-clip-no-caption="false"
|
|
81
|
+
data-cp-clip-closed-caption="false"
|
|
82
|
+
class="cp-clip"
|
|
83
|
+
data-trackable="next-article-cp-clip"
|
|
84
|
+
data-o-component="cp-clip"
|
|
85
|
+
data-cp-clip-id="localhost:8080/fakevideo.mpg"
|
|
86
|
+
data-cp-clip-system-title=""
|
|
87
|
+
id=""
|
|
88
|
+
>
|
|
89
|
+
<div
|
|
90
|
+
data-o-component="o-expander"
|
|
91
|
+
class="o-expander o-expander__info-box"
|
|
92
|
+
data-o-expander-shrink-to="hidden"
|
|
93
|
+
data-trackable="clip-info-box"
|
|
94
|
+
data-o-expander-collapsed-toggle-text="<span class='o-expander__visually-hidden'>Show video info</span>"
|
|
95
|
+
data-o-expander-expanded-toggle-text="<span class='o-expander__visually-hidden'>Hide video info</span>"
|
|
96
|
+
>
|
|
97
|
+
<button
|
|
98
|
+
data-trackable="toggle-open-close"
|
|
99
|
+
class="o-expander__toggle o-expander__toggle-empty"
|
|
100
|
+
>
|
|
101
|
+
<span class="o-expander__visually-hidden o3-type-detail"
|
|
102
|
+
>Show video info</span
|
|
103
|
+
>
|
|
104
|
+
</button>
|
|
105
|
+
<div class="o-expander__content video-info"></div>
|
|
106
|
+
</div>
|
|
107
|
+
<div class="cp-clip__video-container">
|
|
108
|
+
<video
|
|
109
|
+
class="cp-clip__video"
|
|
110
|
+
controls=""
|
|
111
|
+
controlsList="nodownload noremoteplayback noplaybackrate"
|
|
112
|
+
disablepictureinpicture=""
|
|
113
|
+
disableremoteplayback=""
|
|
114
|
+
playsinline=""
|
|
115
|
+
poster=""
|
|
116
|
+
preload="auto"
|
|
117
|
+
id="clip-localhost:8080/fakevideo.mpg"
|
|
118
|
+
crossorigin="anonymous"
|
|
119
|
+
style="height: fit-content; width: 100%"
|
|
120
|
+
>
|
|
121
|
+
<source
|
|
122
|
+
id="video-source-0-localhost:8080/fakevideo.mpg"
|
|
123
|
+
data-cp-component="cp-clip__video-source"
|
|
124
|
+
src="localhost:8080/fakevideo.mpg"
|
|
125
|
+
type="video/mp4"
|
|
126
|
+
/>
|
|
127
|
+
</video>
|
|
128
|
+
</div>
|
|
129
|
+
<div
|
|
130
|
+
class="cp-clip__video-meta-info"
|
|
131
|
+
data-cp-clip-video-meta-info="true"
|
|
132
|
+
></div>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
"
|
|
137
|
+
`;
|
|
138
|
+
|
|
139
|
+
exports[`Clip Snapshot component rendered on server ContentLayout integration tests in-line render - should not wrap in ContentLayout div 1`] = `
|
|
140
|
+
"<div class="n-content-layout__container--in-line" data-component="clip-set">
|
|
141
|
+
<div
|
|
142
|
+
data-cp-clip-layout="in-line"
|
|
143
|
+
data-cp-clip-poster=""
|
|
144
|
+
data-cp-clip-no-audio="false"
|
|
145
|
+
data-cp-clip-no-description="false"
|
|
146
|
+
data-cp-clip-caption=""
|
|
147
|
+
data-cp-clip-no-info-box="false"
|
|
148
|
+
data-cp-clip-no-caption="false"
|
|
149
|
+
data-cp-clip-closed-caption="false"
|
|
150
|
+
class="cp-clip"
|
|
151
|
+
data-trackable="next-article-cp-clip"
|
|
152
|
+
data-o-component="cp-clip"
|
|
153
|
+
data-cp-clip-id="localhost:8080/fakevideo.mpg"
|
|
154
|
+
data-cp-clip-system-title=""
|
|
155
|
+
id=""
|
|
156
|
+
>
|
|
157
|
+
<div
|
|
158
|
+
data-o-component="o-expander"
|
|
159
|
+
class="o-expander o-expander__info-box"
|
|
160
|
+
data-o-expander-shrink-to="hidden"
|
|
161
|
+
data-trackable="clip-info-box"
|
|
162
|
+
data-o-expander-collapsed-toggle-text="<span class='o-expander__visually-hidden'>Show video info</span>"
|
|
163
|
+
data-o-expander-expanded-toggle-text="<span class='o-expander__visually-hidden'>Hide video info</span>"
|
|
164
|
+
>
|
|
165
|
+
<button
|
|
166
|
+
data-trackable="toggle-open-close"
|
|
167
|
+
class="o-expander__toggle o-expander__toggle-empty"
|
|
168
|
+
>
|
|
169
|
+
<span class="o-expander__visually-hidden o3-type-detail"
|
|
170
|
+
>Show video info</span
|
|
171
|
+
>
|
|
172
|
+
</button>
|
|
173
|
+
<div class="o-expander__content video-info"></div>
|
|
174
|
+
</div>
|
|
175
|
+
<div class="cp-clip__video-container">
|
|
176
|
+
<video
|
|
177
|
+
class="cp-clip__video"
|
|
178
|
+
controls=""
|
|
179
|
+
controlsList="nodownload noremoteplayback noplaybackrate"
|
|
180
|
+
disablepictureinpicture=""
|
|
181
|
+
disableremoteplayback=""
|
|
182
|
+
playsinline=""
|
|
183
|
+
poster=""
|
|
184
|
+
preload="auto"
|
|
185
|
+
id="clip-localhost:8080/fakevideo.mpg"
|
|
186
|
+
crossorigin="anonymous"
|
|
187
|
+
style="height: fit-content; width: 100%"
|
|
188
|
+
>
|
|
189
|
+
<source
|
|
190
|
+
id="video-source-0-localhost:8080/fakevideo.mpg"
|
|
191
|
+
data-cp-component="cp-clip__video-source"
|
|
192
|
+
src="localhost:8080/fakevideo.mpg"
|
|
193
|
+
type="video/mp4"
|
|
194
|
+
/>
|
|
195
|
+
</video>
|
|
196
|
+
</div>
|
|
197
|
+
<div
|
|
198
|
+
class="cp-clip__video-meta-info"
|
|
199
|
+
data-cp-clip-video-meta-info="true"
|
|
200
|
+
></div>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
"
|
|
204
|
+
`;
|
|
205
|
+
|
|
206
|
+
exports[`Clip Snapshot component rendered on server ContentLayout integration tests mid-grid default render - should wrap in ContentLayout with nested Container structure 1`] = `
|
|
207
|
+
"<div class="n-content-layout" data-layout-width="full-grid">
|
|
208
|
+
<div class="n-content-layout__container" data-component="clip-set">
|
|
209
|
+
<div
|
|
210
|
+
data-o-grid-colspan="12 S12 M12 L10 XL10"
|
|
211
|
+
class="n-content-layout__container--mid-grid"
|
|
212
|
+
>
|
|
213
|
+
<div
|
|
214
|
+
data-cp-clip-layout="mid-grid"
|
|
215
|
+
data-cp-clip-poster=""
|
|
216
|
+
data-cp-clip-no-audio="false"
|
|
217
|
+
data-cp-clip-no-description="false"
|
|
218
|
+
data-cp-clip-caption=""
|
|
219
|
+
data-cp-clip-no-info-box="false"
|
|
220
|
+
data-cp-clip-no-caption="false"
|
|
221
|
+
data-cp-clip-closed-caption="false"
|
|
222
|
+
class="cp-clip"
|
|
223
|
+
data-trackable="next-article-cp-clip"
|
|
224
|
+
data-o-component="cp-clip"
|
|
225
|
+
data-cp-clip-id="localhost:8080/fakevideo.mpg"
|
|
226
|
+
data-cp-clip-system-title=""
|
|
227
|
+
id=""
|
|
228
|
+
>
|
|
229
|
+
<div
|
|
230
|
+
data-o-component="o-expander"
|
|
231
|
+
class="o-expander o-expander__info-box"
|
|
232
|
+
data-o-expander-shrink-to="hidden"
|
|
233
|
+
data-trackable="clip-info-box"
|
|
234
|
+
data-o-expander-collapsed-toggle-text="<span class='o-expander__visually-hidden'>Show video info</span>"
|
|
235
|
+
data-o-expander-expanded-toggle-text="<span class='o-expander__visually-hidden'>Hide video info</span>"
|
|
236
|
+
>
|
|
237
|
+
<button
|
|
238
|
+
data-trackable="toggle-open-close"
|
|
239
|
+
class="o-expander__toggle o-expander__toggle-empty"
|
|
240
|
+
>
|
|
241
|
+
<span class="o-expander__visually-hidden o3-type-detail"
|
|
242
|
+
>Show video info</span
|
|
243
|
+
>
|
|
244
|
+
</button>
|
|
245
|
+
<div class="o-expander__content video-info"></div>
|
|
246
|
+
</div>
|
|
247
|
+
<div class="cp-clip__video-container">
|
|
248
|
+
<video
|
|
249
|
+
class="cp-clip__video"
|
|
250
|
+
controls=""
|
|
251
|
+
controlsList="nodownload noremoteplayback noplaybackrate"
|
|
252
|
+
disablepictureinpicture=""
|
|
253
|
+
disableremoteplayback=""
|
|
254
|
+
playsinline=""
|
|
255
|
+
poster=""
|
|
256
|
+
preload="auto"
|
|
257
|
+
id="clip-localhost:8080/fakevideo.mpg"
|
|
258
|
+
crossorigin="anonymous"
|
|
259
|
+
style="height: fit-content; width: 100%"
|
|
260
|
+
>
|
|
261
|
+
<source
|
|
262
|
+
id="video-source-0-localhost:8080/fakevideo.mpg"
|
|
263
|
+
data-cp-component="cp-clip__video-source"
|
|
264
|
+
src="localhost:8080/fakevideo.mpg"
|
|
265
|
+
type="video/mp4"
|
|
266
|
+
/>
|
|
267
|
+
</video>
|
|
268
|
+
</div>
|
|
269
|
+
<div
|
|
270
|
+
class="cp-clip__video-meta-info"
|
|
271
|
+
data-cp-clip-video-meta-info="true"
|
|
272
|
+
></div>
|
|
273
|
+
</div>
|
|
274
|
+
</div>
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
"
|
|
278
|
+
`;
|
|
279
|
+
|
|
3
280
|
exports[`Clip Snapshot component rendered on server full-grid default render 1`] = `
|
|
4
281
|
"<div class="n-content-layout" data-layout-width="full-grid">
|
|
5
282
|
<div class="n-content-layout__container" data-component="clip-set">
|
|
@@ -25,6 +25,46 @@ describe('Clip Snapshot', () => {
|
|
|
25
25
|
const url = 'localhost:8080/fakevideo.mpg'
|
|
26
26
|
const poster = 'localhost:8080/fakeposter.jpg'
|
|
27
27
|
|
|
28
|
+
describe('ContentLayout integration tests', () => {
|
|
29
|
+
it('in-line render - should not wrap in ContentLayout div', () => {
|
|
30
|
+
const tree = renderer
|
|
31
|
+
.create(
|
|
32
|
+
<ClipServer content={{ url, dataLayout: 'in-line' }}></ClipServer>
|
|
33
|
+
)
|
|
34
|
+
.toJSON()
|
|
35
|
+
expect(formatString(tree)).toMatchSnapshot()
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it('full-grid default render - should wrap in ContentLayout with proper classes', () => {
|
|
39
|
+
const tree = renderer
|
|
40
|
+
.create(
|
|
41
|
+
<ClipServer content={{ url, dataLayout: 'full-grid' }}></ClipServer>
|
|
42
|
+
)
|
|
43
|
+
.toJSON()
|
|
44
|
+
expect(formatString(tree)).toMatchSnapshot()
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('mid-grid default render - should wrap in ContentLayout with nested Container structure', () => {
|
|
48
|
+
const tree = renderer
|
|
49
|
+
.create(
|
|
50
|
+
<ClipServer content={{ url, dataLayout: 'mid-grid' }}></ClipServer>
|
|
51
|
+
)
|
|
52
|
+
.toJSON()
|
|
53
|
+
expect(formatString(tree)).toMatchSnapshot()
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('edge case: custom dataLayout value should wrap in ContentLayout', () => {
|
|
57
|
+
const tree = renderer
|
|
58
|
+
.create(
|
|
59
|
+
<ClipServer
|
|
60
|
+
content={{ url, dataLayout: 'custom-layout' }}
|
|
61
|
+
></ClipServer>
|
|
62
|
+
)
|
|
63
|
+
.toJSON()
|
|
64
|
+
expect(formatString(tree)).toMatchSnapshot()
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
|
|
28
68
|
it('in-line render', () => {
|
|
29
69
|
const tree = renderer
|
|
30
70
|
.create(
|