Skip to content

Commit f2d5bc4

Browse files
fix: removing edX text reference on video fallback message (#1996)
1 parent ee5e51d commit f2d5bc4

3 files changed

Lines changed: 30 additions & 12 deletions

File tree

src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/__snapshots__/index.test.jsx.snap

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,8 @@ exports[`VideoSourceWidget snapshots snapshots: renders as expected with default
6868
className="mt-3"
6969
>
7070
<FormattedMessage
71-
defaultMessage="To be sure all learners can access the video, edX
72-
recommends providing additional videos in both .mp4 and
73-
.webm formats. The first listed video compatible with the
74-
learner's device will play."
71+
defaultMessage="To be sure all learners can access the video, it is recommended to provide additional videos in both .mp4 and
72+
.webm formats. The first listed video compatible with the learner's device will play."
7573
description="Test explaining reason for fallback videos"
7674
id="authoring.videoeditor.videoSource.fallbackVideo.message"
7775
/>
@@ -227,10 +225,8 @@ exports[`VideoSourceWidget snapshots snapshots: renders as expected with videoSh
227225
className="mt-3"
228226
>
229227
<FormattedMessage
230-
defaultMessage="To be sure all learners can access the video, edX
231-
recommends providing additional videos in both .mp4 and
232-
.webm formats. The first listed video compatible with the
233-
learner's device will play."
228+
defaultMessage="To be sure all learners can access the video, it is recommended to provide additional videos in both .mp4 and
229+
.webm formats. The first listed video compatible with the learner's device will play."
234230
description="Test explaining reason for fallback videos"
235231
id="authoring.videoeditor.videoSource.fallbackVideo.message"
236232
/>

src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/index.test.jsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ import React from 'react';
33
import { dispatch } from 'react-redux';
44
import { shallow } from '@edx/react-unit-test-utils';
55

6+
import { render, screen, fireEvent } from '@testing-library/react';
7+
import { IntlProvider } from '@edx/frontend-platform/i18n';
68
import { formatMessage } from '../../../../../../testUtils';
79
import { VideoSourceWidgetInternal as VideoSourceWidget } from '.';
810
import * as hooks from './hooks';
11+
import messages from './messages';
912

1013
jest.mock('react-redux', () => {
1114
const dispatchFn = jest.fn();
@@ -106,4 +109,25 @@ describe('VideoSourceWidget', () => {
106109
expect(hook.updateVideoURL).toHaveBeenCalledWith('onBlur event', '');
107110
});
108111
});
112+
113+
describe('VideoSourceWidget', () => {
114+
it('calls addFallbackVideo when the add button is clicked', () => {
115+
// eslint-disable-next-line global-require
116+
const { fallbackHooks } = require('./hooks');
117+
const { addFallbackVideo } = fallbackHooks();
118+
119+
render(
120+
<IntlProvider locale="en" messages={messages}>
121+
<VideoSourceWidget intl={{ formatMessage: ({ defaultMessage }) => defaultMessage }} />
122+
</IntlProvider>,
123+
);
124+
125+
// Find the button by its text (from messages.addButtonLabel)
126+
const addButton = screen.getByRole('button');
127+
128+
fireEvent.click(addButton);
129+
130+
expect(addFallbackVideo).toHaveBeenCalled();
131+
});
132+
});
109133
});

src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/messages.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,8 @@ const messages = defineMessages({
4040
},
4141
fallbackVideoMessage: {
4242
id: 'authoring.videoeditor.videoSource.fallbackVideo.message',
43-
defaultMessage: `To be sure all learners can access the video, edX
44-
recommends providing additional videos in both .mp4 and
45-
.webm formats. The first listed video compatible with the
46-
learner's device will play.`,
43+
defaultMessage: `To be sure all learners can access the video, it is recommended to provide additional videos in both .mp4 and
44+
.webm formats. The first listed video compatible with the learner's device will play.`,
4745
description: 'Test explaining reason for fallback videos',
4846
},
4947
fallbackVideoLabel: {

0 commit comments

Comments
 (0)