From f2d5bc4680ecbebb65177656d604a6c7462593b7 Mon Sep 17 00:00:00 2001 From: jacobo-dominguez-wgu Date: Wed, 21 May 2025 12:41:58 -0600 Subject: [PATCH] fix: removing edX text reference on video fallback message (#1996) --- .../__snapshots__/index.test.jsx.snap | 12 ++++------ .../VideoSourceWidget/index.test.jsx | 24 +++++++++++++++++++ .../components/VideoSourceWidget/messages.js | 6 ++--- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/__snapshots__/index.test.jsx.snap b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/__snapshots__/index.test.jsx.snap index c4fe62487..c912b9b82 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/__snapshots__/index.test.jsx.snap +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/__snapshots__/index.test.jsx.snap @@ -68,10 +68,8 @@ exports[`VideoSourceWidget snapshots snapshots: renders as expected with default className="mt-3" > @@ -227,10 +225,8 @@ exports[`VideoSourceWidget snapshots snapshots: renders as expected with videoSh className="mt-3" > diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/index.test.jsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/index.test.jsx index 187e12741..ddfbafce2 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/index.test.jsx +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/index.test.jsx @@ -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( + + defaultMessage }} /> + , + ); + + // Find the button by its text (from messages.addButtonLabel) + const addButton = screen.getByRole('button'); + + fireEvent.click(addButton); + + expect(addFallbackVideo).toHaveBeenCalled(); + }); + }); }); diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/messages.js b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/messages.js index 61e1d9c5d..b0d104cc9 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/messages.js +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/VideoSourceWidget/messages.js @@ -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: {