@financial-times/cp-content-pipeline-ui 13.7.2 → 13.8.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 +7 -0
- package/lib/components/FixedAspectRatio/FixedAspectRatio.js +6 -0
- package/lib/components/FixedAspectRatio/FixedAspectRatio.js.map +1 -1
- package/lib/components/FixedAspectRatio/test/index.spec.d.ts +1 -0
- package/lib/components/FixedAspectRatio/test/index.spec.js +44 -0
- package/lib/components/FixedAspectRatio/test/index.spec.js.map +1 -0
- package/lib/components/FixedAspectRatio/test/snapshot.spec.d.ts +1 -0
- package/lib/components/FixedAspectRatio/test/snapshot.spec.js +47 -0
- package/lib/components/FixedAspectRatio/test/snapshot.spec.js.map +1 -0
- package/package.json +1 -1
- package/src/components/FixedAspectRatio/FixedAspectRatio.tsx +9 -2
- package/src/components/FixedAspectRatio/test/__snapshots__/snapshot.spec.tsx.snap +49 -0
- package/src/components/FixedAspectRatio/test/index.spec.tsx +52 -0
- package/src/components/FixedAspectRatio/test/snapshot.spec.tsx +53 -0
- package/src/components/content-tree/Clip/client/main.scss +7 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -574,6 +574,13 @@
|
|
|
574
574
|
* @financial-times/cp-content-pipeline-client bumped from ^3.7.2 to ^3.7.3
|
|
575
575
|
* @financial-times/cp-content-pipeline-schema bumped from ^2.10.1 to ^2.10.2
|
|
576
576
|
|
|
577
|
+
## [13.8.0](https://github.com/Financial-Times/cp-content-pipeline/compare/cp-content-pipeline-ui-v13.7.2...cp-content-pipeline-ui-v13.8.0) (2026-10-14)
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
### Features
|
|
581
|
+
|
|
582
|
+
* ci-3667 vertical video 2:3 ([b32ef9f](https://github.com/Financial-Times/cp-content-pipeline/commit/b32ef9fcf556eb4bde2354ee88b6037feb1e9a7f))
|
|
583
|
+
|
|
577
584
|
## [13.7.2](https://github.com/Financial-Times/cp-content-pipeline/compare/cp-content-pipeline-ui-v13.7.1...cp-content-pipeline-ui-v13.7.2) (2026-10-14)
|
|
578
585
|
|
|
579
586
|
|
|
@@ -17,6 +17,12 @@ const FixedAspectRatio = ({ width, height, children, style = {}, element = 'div'
|
|
|
17
17
|
width: '100%',
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
+
else if (width < height) {
|
|
21
|
+
fixedAspectRatioStyles = {
|
|
22
|
+
aspectRatio: '2/3',
|
|
23
|
+
objectFit: 'cover',
|
|
24
|
+
};
|
|
25
|
+
}
|
|
20
26
|
else {
|
|
21
27
|
fixedAspectRatioStyles = {
|
|
22
28
|
aspectRatio: `${width}/${height}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FixedAspectRatio.js","sourceRoot":"","sources":["../../../src/components/FixedAspectRatio/FixedAspectRatio.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAUzB;;;GAGG;AACI,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"FixedAspectRatio.js","sourceRoot":"","sources":["../../../src/components/FixedAspectRatio/FixedAspectRatio.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAUzB;;;GAGG;AACI,MAAM,gBAAgB,GAEzB,CAAC,EACH,KAAK,EACL,MAAM,EACN,QAAQ,EACR,KAAK,GAAG,EAAE,EACV,OAAO,GAAG,KAAK,EACf,GAAG,UAAU,EACd,EAAE,EAAE;IACH,IAAI,sBAAsB,CAAA;IAC1B,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;QACtB,sBAAsB,GAAG;YACvB,MAAM,EAAE,aAAa;YACrB,KAAK,EAAE,MAAM;SACd,CAAA;IACH,CAAC;SAAM,IAAI,KAAK,GAAG,MAAM,EAAE,CAAC;QAC1B,sBAAsB,GAAG;YACvB,WAAW,EAAE,KAAK;YAClB,SAAS,EAAE,OAAO;SACnB,CAAA;IACH,CAAC;SAAM,CAAC;QACN,sBAAsB,GAAG;YACvB,WAAW,EAAE,GAAG,KAAK,IAAI,MAAM,EAAE;YACjC,KAAK,EAAE,MAAM;SACd,CAAA;IACH,CAAC;IAED,OAAO,eAAK,CAAC,aAAa,CACxB,OAAO,EACP,EAAE,GAAG,UAAU,EAAE,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,GAAG,sBAAsB,EAAE,EAAE,EACjE,QAAQ,CACT,CAAA;AACH,CAAC,CAAA;AAjCY,QAAA,gBAAgB,oBAiC5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
7
|
+
// @ts-nocheck
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const FixedAspectRatio_1 = require("../FixedAspectRatio");
|
|
10
|
+
const react_2 = require("@testing-library/react");
|
|
11
|
+
describe('FixedAspectRatio template', () => {
|
|
12
|
+
it('renders default height and width if none specified', () => {
|
|
13
|
+
const props = {
|
|
14
|
+
id: 'test-id',
|
|
15
|
+
};
|
|
16
|
+
const tree = (0, react_2.render)(react_1.default.createElement(FixedAspectRatio_1.FixedAspectRatio, { ...props },
|
|
17
|
+
react_1.default.createElement("div", null, "Children 1")));
|
|
18
|
+
// note: we can't test "height: fit-content" here as jsdom doesn't support it
|
|
19
|
+
expect(tree.container.firstChild.style.width).toBe('100%');
|
|
20
|
+
});
|
|
21
|
+
it('renders portrait dimensions as 2/3', () => {
|
|
22
|
+
const props = {
|
|
23
|
+
id: 'test-id',
|
|
24
|
+
width: 200,
|
|
25
|
+
height: 300,
|
|
26
|
+
};
|
|
27
|
+
const tree = (0, react_2.render)(react_1.default.createElement(FixedAspectRatio_1.FixedAspectRatio, { ...props },
|
|
28
|
+
react_1.default.createElement("div", null, "Children")));
|
|
29
|
+
expect(tree.container.firstChild.style.aspectRatio).toBe('2/3');
|
|
30
|
+
expect(tree.container.firstChild.style.objectFit).toBe('cover');
|
|
31
|
+
});
|
|
32
|
+
it('renders landscape aspect ratio using given dimensions', () => {
|
|
33
|
+
const props = {
|
|
34
|
+
id: 'test-id',
|
|
35
|
+
height: 200,
|
|
36
|
+
width: 300,
|
|
37
|
+
};
|
|
38
|
+
const tree = (0, react_2.render)(react_1.default.createElement(FixedAspectRatio_1.FixedAspectRatio, { ...props },
|
|
39
|
+
react_1.default.createElement("div", null, "Children")));
|
|
40
|
+
expect(tree.container.firstChild.style.aspectRatio).toBe('300/200');
|
|
41
|
+
expect(tree.container.firstChild.style.width).toBe('100%');
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=index.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../../../../src/components/FixedAspectRatio/test/index.spec.tsx"],"names":[],"mappings":";;;;;AAAA,6DAA6D;AAC7D,cAAc;AACd,kDAAyB;AAEzB,0DAA6E;AAC7E,kDAA+C;AAE/C,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC5D,MAAM,KAAK,GAA0B;YACnC,EAAE,EAAE,SAAS;SACd,CAAA;QACD,MAAM,IAAI,GAAG,IAAA,cAAM,EACjB,8BAAC,mCAAgB,OAAK,KAAK;YACzB,wDAAqB,CACJ,CACpB,CAAA;QACD,6EAA6E;QAC7E,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC5D,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,KAAK,GAA0B;YACnC,EAAE,EAAE,SAAS;YACb,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,GAAG;SACZ,CAAA;QACD,MAAM,IAAI,GAAG,IAAA,cAAM,EACjB,8BAAC,mCAAgB,OAAK,KAAK;YACzB,sDAAmB,CACF,CACpB,CAAA;QAED,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC/D,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACjE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;QAC/D,MAAM,KAAK,GAA0B;YACnC,EAAE,EAAE,SAAS;YACb,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,GAAG;SACX,CAAA;QACD,MAAM,IAAI,GAAG,IAAA,cAAM,EACjB,8BAAC,mCAAgB,OAAK,KAAK;YACzB,sDAAmB,CACF,CACpB,CAAA;QACD,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACnE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC5D,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
7
|
+
// @ts-nocheck
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const react_test_renderer_1 = __importDefault(require("react-test-renderer"));
|
|
10
|
+
const FixedAspectRatio_1 = require("../FixedAspectRatio");
|
|
11
|
+
describe('FixedAspectRatio snapshot', () => {
|
|
12
|
+
it('renders correctly with no height or width specified', () => {
|
|
13
|
+
const props = {
|
|
14
|
+
id: 'test-id',
|
|
15
|
+
};
|
|
16
|
+
const tree = react_test_renderer_1.default
|
|
17
|
+
.create(react_1.default.createElement(FixedAspectRatio_1.FixedAspectRatio, { ...props },
|
|
18
|
+
react_1.default.createElement("div", null, "Children")))
|
|
19
|
+
.toJSON();
|
|
20
|
+
expect(tree).toMatchSnapshot();
|
|
21
|
+
});
|
|
22
|
+
it('renders correctly with portrait dimensions', () => {
|
|
23
|
+
const props = {
|
|
24
|
+
id: 'test-id',
|
|
25
|
+
width: 200,
|
|
26
|
+
height: 300,
|
|
27
|
+
};
|
|
28
|
+
const tree = react_test_renderer_1.default
|
|
29
|
+
.create(react_1.default.createElement(FixedAspectRatio_1.FixedAspectRatio, { ...props },
|
|
30
|
+
react_1.default.createElement("div", null, "Children")))
|
|
31
|
+
.toJSON();
|
|
32
|
+
expect(tree).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
it('renders correctly with landscape dimensions', () => {
|
|
35
|
+
const props = {
|
|
36
|
+
id: 'test-id',
|
|
37
|
+
width: 300,
|
|
38
|
+
height: 200,
|
|
39
|
+
};
|
|
40
|
+
const tree = react_test_renderer_1.default
|
|
41
|
+
.create(react_1.default.createElement(FixedAspectRatio_1.FixedAspectRatio, { ...props },
|
|
42
|
+
react_1.default.createElement("div", null, "Children")))
|
|
43
|
+
.toJSON();
|
|
44
|
+
expect(tree).toMatchSnapshot();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=snapshot.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.spec.js","sourceRoot":"","sources":["../../../../src/components/FixedAspectRatio/test/snapshot.spec.tsx"],"names":[],"mappings":";;;;;AAAA,6DAA6D;AAC7D,cAAc;AACd,kDAAyB;AACzB,8EAA0C;AAC1C,0DAA6E;AAE7E,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC7D,MAAM,KAAK,GAA0B;YACnC,EAAE,EAAE,SAAS;SACd,CAAA;QACD,MAAM,IAAI,GAAG,6BAAQ;aAClB,MAAM,CACL,8BAAC,mCAAgB,OAAK,KAAK;YACzB,sDAAmB,CACF,CACpB;aACA,MAAM,EAAE,CAAA;QACX,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAA;IAChC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,MAAM,KAAK,GAA0B;YACnC,EAAE,EAAE,SAAS;YACb,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,GAAG;SACZ,CAAA;QACD,MAAM,IAAI,GAAG,6BAAQ;aAClB,MAAM,CACL,8BAAC,mCAAgB,OAAK,KAAK;YACzB,sDAAmB,CACF,CACpB;aACA,MAAM,EAAE,CAAA;QACX,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAA;IAChC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,KAAK,GAA0B;YACnC,EAAE,EAAE,SAAS;YACb,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,GAAG;SACZ,CAAA;QACD,MAAM,IAAI,GAAG,6BAAQ;aAClB,MAAM,CACL,8BAAC,mCAAgB,OAAK,KAAK;YACzB,sDAAmB,CACF,CACpB;aACA,MAAM,EAAE,CAAA;QACX,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAA;IAChC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -5,14 +5,16 @@ type FixedAspectRatioProps = {
|
|
|
5
5
|
height: number
|
|
6
6
|
style?: React.CSSProperties
|
|
7
7
|
element?: string
|
|
8
|
-
[key:string]: string | boolean | React.ReactNode | React.CSSProperties
|
|
8
|
+
[key: string]: string | boolean | React.ReactNode | React.CSSProperties
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* High Order Component that forces a fixed aspect ratio to prevent Cumulative Layout Shift
|
|
13
13
|
* for elements that have a deterministic aspect ratio server-side
|
|
14
14
|
*/
|
|
15
|
-
export const FixedAspectRatio: React.FC<
|
|
15
|
+
export const FixedAspectRatio: React.FC<
|
|
16
|
+
React.PropsWithChildren<FixedAspectRatioProps>
|
|
17
|
+
> = ({
|
|
16
18
|
width,
|
|
17
19
|
height,
|
|
18
20
|
children,
|
|
@@ -26,6 +28,11 @@ export const FixedAspectRatio: React.FC<React.PropsWithChildren<FixedAspectRatio
|
|
|
26
28
|
height: `fit-content`,
|
|
27
29
|
width: '100%',
|
|
28
30
|
}
|
|
31
|
+
} else if (width < height) {
|
|
32
|
+
fixedAspectRatioStyles = {
|
|
33
|
+
aspectRatio: '2/3',
|
|
34
|
+
objectFit: 'cover',
|
|
35
|
+
}
|
|
29
36
|
} else {
|
|
30
37
|
fixedAspectRatioStyles = {
|
|
31
38
|
aspectRatio: `${width}/${height}`,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`FixedAspectRatio snapshot renders correctly with landscape dimensions 1`] = `
|
|
4
|
+
<div
|
|
5
|
+
id="test-id"
|
|
6
|
+
style={
|
|
7
|
+
{
|
|
8
|
+
"aspectRatio": "300/200",
|
|
9
|
+
"width": "100%",
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
>
|
|
13
|
+
<div>
|
|
14
|
+
Children
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
exports[`FixedAspectRatio snapshot renders correctly with no height or width specified 1`] = `
|
|
20
|
+
<div
|
|
21
|
+
id="test-id"
|
|
22
|
+
style={
|
|
23
|
+
{
|
|
24
|
+
"height": "fit-content",
|
|
25
|
+
"width": "100%",
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
>
|
|
29
|
+
<div>
|
|
30
|
+
Children
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
exports[`FixedAspectRatio snapshot renders correctly with portrait dimensions 1`] = `
|
|
36
|
+
<div
|
|
37
|
+
id="test-id"
|
|
38
|
+
style={
|
|
39
|
+
{
|
|
40
|
+
"aspectRatio": "2/3",
|
|
41
|
+
"objectFit": "cover",
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
>
|
|
45
|
+
<div>
|
|
46
|
+
Children
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
`;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
import { FixedAspectRatio, FixedAspectRatioProps } from '../FixedAspectRatio'
|
|
6
|
+
import { render } from '@testing-library/react'
|
|
7
|
+
|
|
8
|
+
describe('FixedAspectRatio template', () => {
|
|
9
|
+
it('renders default height and width if none specified', () => {
|
|
10
|
+
const props: FixedAspectRatioProps = {
|
|
11
|
+
id: 'test-id',
|
|
12
|
+
}
|
|
13
|
+
const tree = render(
|
|
14
|
+
<FixedAspectRatio {...props}>
|
|
15
|
+
<div>Children 1</div>
|
|
16
|
+
</FixedAspectRatio>
|
|
17
|
+
)
|
|
18
|
+
// note: we can't test "height: fit-content" here as jsdom doesn't support it
|
|
19
|
+
expect(tree.container.firstChild.style.width).toBe('100%')
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('renders portrait dimensions as 2/3', () => {
|
|
23
|
+
const props: FixedAspectRatioProps = {
|
|
24
|
+
id: 'test-id',
|
|
25
|
+
width: 200,
|
|
26
|
+
height: 300,
|
|
27
|
+
}
|
|
28
|
+
const tree = render(
|
|
29
|
+
<FixedAspectRatio {...props}>
|
|
30
|
+
<div>Children</div>
|
|
31
|
+
</FixedAspectRatio>
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
expect(tree.container.firstChild.style.aspectRatio).toBe('2/3')
|
|
35
|
+
expect(tree.container.firstChild.style.objectFit).toBe('cover')
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it('renders landscape aspect ratio using given dimensions', () => {
|
|
39
|
+
const props: FixedAspectRatioProps = {
|
|
40
|
+
id: 'test-id',
|
|
41
|
+
height: 200,
|
|
42
|
+
width: 300,
|
|
43
|
+
}
|
|
44
|
+
const tree = render(
|
|
45
|
+
<FixedAspectRatio {...props}>
|
|
46
|
+
<div>Children</div>
|
|
47
|
+
</FixedAspectRatio>
|
|
48
|
+
)
|
|
49
|
+
expect(tree.container.firstChild.style.aspectRatio).toBe('300/200')
|
|
50
|
+
expect(tree.container.firstChild.style.width).toBe('100%')
|
|
51
|
+
})
|
|
52
|
+
})
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import renderer from 'react-test-renderer'
|
|
5
|
+
import { FixedAspectRatio, FixedAspectRatioProps } from '../FixedAspectRatio'
|
|
6
|
+
|
|
7
|
+
describe('FixedAspectRatio snapshot', () => {
|
|
8
|
+
it('renders correctly with no height or width specified', () => {
|
|
9
|
+
const props: FixedAspectRatioProps = {
|
|
10
|
+
id: 'test-id',
|
|
11
|
+
}
|
|
12
|
+
const tree = renderer
|
|
13
|
+
.create(
|
|
14
|
+
<FixedAspectRatio {...props}>
|
|
15
|
+
<div>Children</div>
|
|
16
|
+
</FixedAspectRatio>
|
|
17
|
+
)
|
|
18
|
+
.toJSON()
|
|
19
|
+
expect(tree).toMatchSnapshot()
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('renders correctly with portrait dimensions', () => {
|
|
23
|
+
const props: FixedAspectRatioProps = {
|
|
24
|
+
id: 'test-id',
|
|
25
|
+
width: 200,
|
|
26
|
+
height: 300,
|
|
27
|
+
}
|
|
28
|
+
const tree = renderer
|
|
29
|
+
.create(
|
|
30
|
+
<FixedAspectRatio {...props}>
|
|
31
|
+
<div>Children</div>
|
|
32
|
+
</FixedAspectRatio>
|
|
33
|
+
)
|
|
34
|
+
.toJSON()
|
|
35
|
+
expect(tree).toMatchSnapshot()
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it('renders correctly with landscape dimensions', () => {
|
|
39
|
+
const props: FixedAspectRatioProps = {
|
|
40
|
+
id: 'test-id',
|
|
41
|
+
width: 300,
|
|
42
|
+
height: 200,
|
|
43
|
+
}
|
|
44
|
+
const tree = renderer
|
|
45
|
+
.create(
|
|
46
|
+
<FixedAspectRatio {...props}>
|
|
47
|
+
<div>Children</div>
|
|
48
|
+
</FixedAspectRatio>
|
|
49
|
+
)
|
|
50
|
+
.toJSON()
|
|
51
|
+
expect(tree).toMatchSnapshot()
|
|
52
|
+
})
|
|
53
|
+
})
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
@import '@financial-times/o-loading/main';
|
|
4
4
|
@import "./progressBar.scss";
|
|
5
5
|
|
|
6
|
+
[data-x-component="live-blog-post"] {
|
|
7
|
+
.cp-clip {
|
|
8
|
+
width: fit-content;
|
|
9
|
+
margin: auto;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
6
13
|
.cp-clip {
|
|
7
14
|
--o-loading-size: 64px;
|
|
8
15
|
@import "../components/caption";
|
|
@@ -103,7 +110,6 @@
|
|
|
103
110
|
}
|
|
104
111
|
}
|
|
105
112
|
|
|
106
|
-
|
|
107
113
|
.cp-clip__play-icon-container {
|
|
108
114
|
@include cp-clip__icon-container;
|
|
109
115
|
}
|