File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
entry_types/scrolled/package
spec/contentElements/iframeEmbed
src/contentElements/iframeEmbed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import '@testing-library/jest-dom/extend-expect' ;
3+
4+ import { renderInContentElement } from 'pageflow-scrolled/testHelpers' ;
5+ import { IframeEmbed } from 'contentElements/iframeEmbed/IframeEmbed' ;
6+ import fitViewportStyles from 'frontend/FitViewport.module.css' ;
7+
8+ describe ( 'IframeEmbed' , ( ) => {
9+ it ( 'renders FitViewport with aspect ratio by default' , ( ) => {
10+ const { container} = renderInContentElement (
11+ < IframeEmbed configuration = { { source : 'https://example.com' } } /> ,
12+ { seed : { } }
13+ ) ;
14+
15+ expect ( container . querySelector ( `.${ fitViewportStyles . container } ` ) ) . not . toBeNull ( ) ;
16+ } ) ;
17+
18+ it ( 'skips aspect ratio when autoResize is enabled' , ( ) => {
19+ const { container} = renderInContentElement (
20+ < IframeEmbed configuration = { { source : 'https://example.com' ,
21+ autoResize : true } } /> ,
22+ { seed : { } }
23+ ) ;
24+
25+ expect ( container . querySelector ( `.${ fitViewportStyles . container } ` ) ) . toBeNull ( ) ;
26+ } ) ;
27+ } ) ;
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ export function IframeEmbed({configuration}) {
5555 return (
5656 < div className = { styles . wrapper }
5757 style = { { pointerEvents : isEditable && ! isSelected ? 'none' : undefined } } >
58- < FitViewport aspectRatio = { aspectRatios [ aspectRatio || 'wide' ] }
58+ < FitViewport aspectRatio = { configuration . autoResize ? null : aspectRatios [ aspectRatio || 'wide' ] }
5959 opaque = { utils . isBlank ( configuration . source ) } >
6060 < ContentElementBox >
6161 < ContentElementFigure configuration = { configuration } >
You can’t perform that action at this time.
0 commit comments