diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/CollapsibleFormWidget.jsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/CollapsibleFormWidget.jsx index 9323f7968..4eeabbd49 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/CollapsibleFormWidget.jsx +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/CollapsibleFormWidget.jsx @@ -23,7 +23,7 @@ export const CollapsibleFormWidget = ({ intl, }) => ( diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/DurationWidget.jsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/DurationWidget.jsx index c5895a9ab..7c165d0c9 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/DurationWidget.jsx +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/DurationWidget.jsx @@ -1,11 +1,9 @@ import React from 'react'; import { useDispatch } from 'react-redux'; -// import PropTypes from 'prop-types'; import { Col, - FormControl, - FormGroup, + Form, Row, } from '@edx/paragon'; @@ -31,12 +29,15 @@ export const DurationWidget = ({ }); const timeKeys = keyStore(duration.formValue); - const getTotalLabel = (startTime, stopTime) => { + const getTotalLabel = (startTime, stopTime, subtitle) => { if (!stopTime) { if (!startTime) { return intl.formatMessage(messages.fullVideoLength); } - return intl.formatMessage(messages.startsAt, { startTime: durationFromValue(startTime) }); + if (subtitle) { + return intl.formatMessage(messages.startsAt, { startTime: durationFromValue(startTime) }); + } + return null; } const total = stopTime - (startTime || 0); return intl.formatMessage(messages.total, { total: durationFromValue(total) }); @@ -45,32 +46,32 @@ export const DurationWidget = ({ return ( - - + - + - - - - + + + - + - - + +
{getTotalLabel(duration.formValue.startTime, duration.formValue.stopTime)} diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/DurationWidget.test.jsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/DurationWidget.test.jsx new file mode 100644 index 000000000..68a9f8e57 --- /dev/null +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/DurationWidget.test.jsx @@ -0,0 +1,22 @@ +import React from 'react'; +import { shallow } from 'enzyme'; + +import { formatMessage } from '../../../../../../testUtils'; +import { DurationWidget } from './DurationWidget'; + +describe('DurationWidget', () => { + const props = { + isError: false, + subtitle: 'SuBTItle', + title: 'tiTLE', + // inject + intl: { formatMessage }, + }; + describe('render', () => { + test('snapshots: renders as expected with default props', () => { + expect( + shallow(), + ).toMatchSnapshot(); + }); + }); +}); diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/HandoutWidget/__snapshots__/index.test.jsx.snap b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/HandoutWidget/__snapshots__/index.test.jsx.snap index cdabb7323..e361b0b12 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/HandoutWidget/__snapshots__/index.test.jsx.snap +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/HandoutWidget/__snapshots__/index.test.jsx.snap @@ -97,54 +97,64 @@ exports[`HandoutWidget snapshots snapshots: renders as expected with handout 1`] } } /> - - - - + + sOMeUrl + + + + + - - - - - - - - - - - - } - className="mt-1" - subtitle="sOMeUrl " + + + + + + + + + + + + - + `; diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/HandoutWidget/index.jsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/HandoutWidget/index.jsx index 9f15ca9f0..d1f063b08 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/HandoutWidget/index.jsx +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/HandoutWidget/index.jsx @@ -7,8 +7,8 @@ import { Stack, Icon, IconButton, - Card, Dropdown, + ActionRow, } from '@edx/paragon'; import { FileUpload, MoreHoriz } from '@edx/paragon/icons'; import { @@ -61,38 +61,37 @@ export const HandoutWidget = ({ {handout ? ( - - - - - - - - - - - updateField({ handout: null })}> - - - - - )} - /> - + + + {handoutName} + + + + + + + + + + + updateField({ handout: null })}> + + + + + + + ) : ( diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/ThumbnailWidget/__snapshots__/index.test.jsx.snap b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/ThumbnailWidget/__snapshots__/index.test.jsx.snap index 24b76066e..b38f3025e 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/ThumbnailWidget/__snapshots__/index.test.jsx.snap +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/ThumbnailWidget/__snapshots__/index.test.jsx.snap @@ -44,7 +44,7 @@ exports[`ThumbnailWidget snapshots snapshots: renders as expected where thumbnai exports[`ThumbnailWidget snapshots snapshots: renders as expected where videoType equals edxVideo 1`] = ` `; +exports[`ThumbnailWidget snapshots snapshots: renders as expected where videoType equals edxVideo and no thumbnail 1`] = ` + + + + + +
+ +
+
+ +
+ + +
+
+`; + exports[`ThumbnailWidget snapshots snapshots: renders as expected with a thumbnail provided 1`] = ` { + if (isEdxVideo) { + if (thumbnail) { + return intl.formatMessage(messages.yesSubtitle); + } + return intl.formatMessage(messages.noneSubtitle); + } + return intl.formatMessage(messages.unavailableSubtitle); + }; return (!isLibrary ? ( { shallow(), ).toMatchSnapshot(); }); + test('snapshots: renders as expected where videoType equals edxVideo and no thumbnail', () => { + expect( + shallow(), + ).toMatchSnapshot(); + }); }); describe('mapStateToProps', () => { const testState = { A: 'pple', B: 'anana', C: 'ucumber' }; diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/ThumbnailWidget/messages.js b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/ThumbnailWidget/messages.js index e60a9b2d3..0d65283c6 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/ThumbnailWidget/messages.js +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/ThumbnailWidget/messages.js @@ -9,6 +9,16 @@ export const messages = { defaultMessage: 'Unavailable', description: 'Subtitle for unavailable thumbnail widget', }, + noneSubtitle: { + id: 'authoring.videoeditor.thumbnail.none.subtitle', + defaultMessage: 'None', + description: 'Subtitle for when no thumbnail has been uploaded to the widget', + }, + yesSubtitle: { + id: 'authoring.videoeditor.thumbnail.yes.subtitle', + defaultMessage: 'Yes', + description: 'Subtitle for when thumbnail has been uploaded to the widget', + }, unavailableMessage: { id: 'authoring.videoeditor.thumbnail.unavailable.message', defaultMessage: 'Select a video from your library to enable this feature', diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/__snapshots__/CollapsibleFormWidget.test.jsx.snap b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/__snapshots__/CollapsibleFormWidget.test.jsx.snap index e89b7c0d2..db5e74937 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/__snapshots__/CollapsibleFormWidget.test.jsx.snap +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/__snapshots__/CollapsibleFormWidget.test.jsx.snap @@ -2,7 +2,7 @@ exports[`CollapsibleFormWidget render snapshots: renders as expected with default props 1`] = ` diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/__snapshots__/DurationWidget.test.jsx.snap b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/__snapshots__/DurationWidget.test.jsx.snap new file mode 100644 index 000000000..ac33f352c --- /dev/null +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/__snapshots__/DurationWidget.test.jsx.snap @@ -0,0 +1,53 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`DurationWidget render snapshots: renders as expected with default props 1`] = ` + + + + + + + + + + + + + + + + +
+ Full video length +
+
+`; diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/index.jsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/index.jsx index 3b1a0b196..24d194ae3 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/index.jsx +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/index.jsx @@ -11,18 +11,15 @@ import VideoSourceWidget from './components/VideoSourceWidget'; import './index.scss'; export const VideoSettingsModal = () => ( -
-
- -

Settings

- - - - - - -
-
+ <> + + + + + + + + ); export default VideoSettingsModal; diff --git a/src/editors/data/redux/thunkActions/video.js b/src/editors/data/redux/thunkActions/video.js index 9de6194e5..aa10c5dfa 100644 --- a/src/editors/data/redux/thunkActions/video.js +++ b/src/editors/data/redux/thunkActions/video.js @@ -175,7 +175,14 @@ export const uploadThumbnail = ({ thumbnail }) => (dispatch, getState) => { thumbnail, videoId, onSuccess: (response) => { - const thumbnailUrl = studioEndpointUrl + response.data.image_url; + let thumbnailUrl; + if (response.data.image_url.startsWith('/')) { + // in local environments, image_url is a relative path + thumbnailUrl = studioEndpointUrl + response.data.image_url; + } else { + // in stage and production, image_url is an absolute path to the image + thumbnailUrl = response.data.image_url; + } dispatch(actions.video.updateField({ thumbnail: thumbnailUrl, })); diff --git a/src/editors/data/redux/thunkActions/video.test.js b/src/editors/data/redux/thunkActions/video.test.js index 6a1206152..718185c01 100644 --- a/src/editors/data/redux/thunkActions/video.test.js +++ b/src/editors/data/redux/thunkActions/video.test.js @@ -33,7 +33,7 @@ const mockFile = 'soMEtRANscRipT'; const mockFilename = 'soMEtRANscRipT.srt'; const mockThumbnail = 'sOMefILE'; const mockThumbnailResponse = { data: { image_url: 'soMEimAGEUrL' } }; -const thumbnailUrl = 'soMEeNDPoiNTsoMEimAGEUrL'; +const thumbnailUrl = 'soMEimAGEUrL'; const mockAllowThumbnailUpload = { data: { allowThumbnailUpload: 'soMEbOolEAn' } }; const testMetadata = {