fix: removing edX text reference on video fallback message (#1996)

This commit is contained in:
jacobo-dominguez-wgu
2025-05-21 12:41:58 -06:00
committed by GitHub
parent ee5e51d371
commit f2d5bc4680
3 changed files with 30 additions and 12 deletions

View File

@@ -68,10 +68,8 @@ exports[`VideoSourceWidget snapshots snapshots: renders as expected with default
className="mt-3"
>
<FormattedMessage
defaultMessage="To be sure all learners can access the video, edX
recommends providing additional videos in both .mp4 and
.webm formats. The first listed video compatible with the
learner's device will play."
defaultMessage="To be sure all learners can access the video, it is recommended to provide additional videos in both .mp4 and
.webm formats. The first listed video compatible with the learner's device will play."
description="Test explaining reason for fallback videos"
id="authoring.videoeditor.videoSource.fallbackVideo.message"
/>
@@ -227,10 +225,8 @@ exports[`VideoSourceWidget snapshots snapshots: renders as expected with videoSh
className="mt-3"
>
<FormattedMessage
defaultMessage="To be sure all learners can access the video, edX
recommends providing additional videos in both .mp4 and
.webm formats. The first listed video compatible with the
learner's device will play."
defaultMessage="To be sure all learners can access the video, it is recommended to provide additional videos in both .mp4 and
.webm formats. The first listed video compatible with the learner's device will play."
description="Test explaining reason for fallback videos"
id="authoring.videoeditor.videoSource.fallbackVideo.message"
/>

View File

@@ -3,9 +3,12 @@ import React from 'react';
import { dispatch } from 'react-redux';
import { shallow } from '@edx/react-unit-test-utils';
import { render, screen, fireEvent } from '@testing-library/react';
import { IntlProvider } from '@edx/frontend-platform/i18n';
import { formatMessage } from '../../../../../../testUtils';
import { VideoSourceWidgetInternal as VideoSourceWidget } from '.';
import * as hooks from './hooks';
import messages from './messages';
jest.mock('react-redux', () => {
const dispatchFn = jest.fn();
@@ -106,4 +109,25 @@ describe('VideoSourceWidget', () => {
expect(hook.updateVideoURL).toHaveBeenCalledWith('onBlur event', '');
});
});
describe('VideoSourceWidget', () => {
it('calls addFallbackVideo when the add button is clicked', () => {
// eslint-disable-next-line global-require
const { fallbackHooks } = require('./hooks');
const { addFallbackVideo } = fallbackHooks();
render(
<IntlProvider locale="en" messages={messages}>
<VideoSourceWidget intl={{ formatMessage: ({ defaultMessage }) => defaultMessage }} />
</IntlProvider>,
);
// Find the button by its text (from messages.addButtonLabel)
const addButton = screen.getByRole('button');
fireEvent.click(addButton);
expect(addFallbackVideo).toHaveBeenCalled();
});
});
});

View File

@@ -40,10 +40,8 @@ const messages = defineMessages({
},
fallbackVideoMessage: {
id: 'authoring.videoeditor.videoSource.fallbackVideo.message',
defaultMessage: `To be sure all learners can access the video, edX
recommends providing additional videos in both .mp4 and
.webm formats. The first listed video compatible with the
learner's device will play.`,
defaultMessage: `To be sure all learners can access the video, it is recommended to provide additional videos in both .mp4 and
.webm formats. The first listed video compatible with the learner's device will play.`,
description: 'Test explaining reason for fallback videos',
},
fallbackVideoLabel: {