diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoPreviewWidget/index.jsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoPreviewWidget/index.jsx index 0c4a0f089a..3377e31f45 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoPreviewWidget/index.jsx +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoPreviewWidget/index.jsx @@ -11,11 +11,13 @@ import hooks from './hooks'; import LanguageNamesWidget from './LanguageNamesWidget'; import videoThumbnail from '../../../../../../data/images/videoThumbnail.svg'; -const VideoPreviewWidget = ({ +// Exporting to test this component separately +export const VideoPreviewWidget = ({ thumbnail, videoSource, transcripts, blockTitle, + isLibrary, intl, }) => { const imgRef = React.useRef(); @@ -45,7 +47,10 @@ const VideoPreviewWidget = ({ />

{blockTitle}

- + {!isLibrary && ( + // Since content libraries v2 don't support static assets yet, we can't include transcripts. + + )} {videoType && ( ({ @@ -76,6 +82,7 @@ export const mapStateToProps = (state) => ({ videoSource: selectors.video.videoSource(state), thumbnail: selectors.video.thumbnail(state), blockTitle: selectors.app.blockTitle(state), + isLibrary: selectors.app.isLibrary(state), }); export default injectIntl(connect(mapStateToProps)(VideoPreviewWidget)); diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoPreviewWidget/index.test.jsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoPreviewWidget/index.test.jsx new file mode 100644 index 0000000000..fc7f89a5cd --- /dev/null +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoPreviewWidget/index.test.jsx @@ -0,0 +1,47 @@ +import { + initializeMocks, + render, + screen, +} from '../../../../../../../testUtils'; + +import { VideoPreviewWidget } from '.'; + +describe('VideoPreviewWidget', () => { + const mockIntl = { + formatMessage: (message) => message.defaultMessage, + }; + + beforeEach(() => { + initializeMocks(); + }); + + describe('render', () => { + test('renders transcripts section in preview for courses', () => { + render( + , + ); + expect(screen.queryByText('No transcripts added')).toBeInTheDocument(); + }); + + test('hides transcripts section in preview for libraries', () => { + render( + , + ); + expect(screen.queryByText('No transcripts added')).not.toBeInTheDocument(); + }); + }); +}); diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/index.tsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/index.tsx index 589c3a9af1..4761e39320 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/index.tsx +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/index.tsx @@ -11,7 +11,8 @@ import LicenseWidget from './components/LicenseWidget'; import ThumbnailWidget from './components/ThumbnailWidget'; import TranscriptWidget from './components/TranscriptWidget'; import VideoSourceWidget from './components/VideoSourceWidget'; -import VideoPreviewWidget from './components/VideoPreviewWidget'; +// Using default import to get selectors connected VideoSourceWidget +import ConnectedVideoPreviewWidget from './components/VideoPreviewWidget'; import './index.scss'; import SocialShareWidget from './components/SocialShareWidget'; import messages from '../../messages'; @@ -42,7 +43,7 @@ const VideoSettingsModal: React.FC = ({ )} - + {!isLibrary && (