- {randomization, select,
- null {No Python based randomization is present in this problem.}
- other {Defines when to randomize the variables specified in the associated Python script. For problems that do not randomize values, specify "Never".}
- }
-
- {randomization, select,
- null {No Python based randomization is present in this problem.}
- other {Defines when to randomize the variables specified in the associated Python script. For problems that do not randomize values, specify "Never".}
- }
-
- {randomization, select,
- null {No Python based randomization is present in this problem.}
- other {Defines when to randomize the variables specified in the associated Python script. For problems that do not randomize values, specify "Never".}
- }
-
-`;
-
-exports[`LicenseDetails snapshots snapshots: renders as expected with level set to block and license set to all rights reserved 1`] = `
-
-
-
-
-
-
-
-
-
-
-`;
-
-exports[`LicenseDetails snapshots snapshots: renders as expected with level set to block and license set to select 1`] = `false`;
-
-exports[`LicenseDetails snapshots snapshots: renders as expected with level set to library 1`] = `
-
-
-
-
-
-
-
-`;
diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/__snapshots__/index.test.jsx.snap b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/__snapshots__/index.test.jsx.snap
deleted file mode 100644
index 31ad92d693..0000000000
--- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/__snapshots__/index.test.jsx.snap
+++ /dev/null
@@ -1,85 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`SocialShareWidget rendered with videoSharingEnabled false with default props should return null 1`] = `null`;
-
-exports[`SocialShareWidget rendered with videoSharingEnabled false with videoSharingEnabledForAll false and isLibrary true should return null 1`] = `null`;
-
-exports[`SocialShareWidget rendered with videoSharingEnabled false with videoSharingEnabledForCourse and isLibrary false and videoSharingEnabledForAll true should return null 1`] = `null`;
-
-exports[`SocialShareWidget rendered with videoSharingEnabled true and allowVideoSharing value equals false should have subtitle with text that reads Enabled 1`] = `
-
-
-
-
-
-
- This video is shareable to social media
-
-
-
-
- Learn more about social sharing
-
-
-
-`;
-
-exports[`SocialShareWidget rendered with videoSharingEnabled true and allowVideoSharing value equals true should have subtitle with text that reads Enabled 1`] = `
-
-
-
-
-
-
- This video is shareable to social media
-
-
-
-
- Learn more about social sharing
-
-
-
-`;
diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/index.test.jsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/index.test.jsx
deleted file mode 100644
index 2d7fccd76c..0000000000
--- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/index.test.jsx
+++ /dev/null
@@ -1,274 +0,0 @@
-import 'CourseAuthoring/editors/setupEditorTest';
-import React from 'react';
-import { shallow } from '@edx/react-unit-test-utils';
-
-import { formatMessage } from '../../../../../../testUtils';
-import { actions, selectors } from '../../../../../../data/redux';
-import { SocialShareWidgetInternal as SocialShareWidget, mapStateToProps, mapDispatchToProps } from '.';
-import messages from './messages';
-
-jest.mock('react', () => {
- const updateState = jest.fn();
- return {
- ...jest.requireActual('react'),
- updateState,
- useContext: jest.fn(() => ({ license: ['error.license', jest.fn().mockName('error.setLicense')] })),
- };
-});
-
-jest.mock('../../../../../../data/redux', () => ({
- actions: {
- video: {
- updateField: jest.fn().mockName('actions.video.updateField'),
- },
- },
- selectors: {
- app: {
- isLibrary: jest.fn(state => ({ isLibrary: state })),
- },
- video: {
- allowVideoSharing: jest.fn(state => ({ allowVideoSharing: state })),
- videoSharingEnabledForAll: jest.fn(state => ({ videoSharingEnabledForAll: state })),
- videoSharingEnabledForCourse: jest.fn(state => ({ videoSharingEnabledForCourse: state })),
- videoSharingLearnMoreLink: jest.fn(state => ({ videoSharingLearnMoreLink: state })),
- },
- },
-}));
-
-describe('SocialShareWidget', () => {
- const props = {
- title: 'tiTLE',
- intl: { formatMessage },
- videoSharingEnabledForCourse: false,
- videoSharingEnabledForAll: false,
- isLibrary: false,
- allowVideoSharing: {
- level: 'block',
- value: false,
- },
- videoSharingLearnMoreLink: 'sOMeURl.cOM',
- updateField: jest.fn().mockName('args.updateField'),
- };
-
- describe('rendered with videoSharingEnabled false', () => {
- describe('with default props', () => {
- it('should return null', () => {
- const wrapper = shallow();
- expect(wrapper.snapshot).toMatchSnapshot();
- });
- });
- describe('with videoSharingEnabledForAll false and isLibrary true', () => {
- it('should return null', () => {
- const wrapper = shallow();
- expect(wrapper.snapshot).toMatchSnapshot();
- });
- });
- describe('with videoSharingEnabledForCourse and isLibrary false and videoSharingEnabledForAll true', () => {
- it('should return null', () => {
- const wrapper = shallow();
- expect(wrapper.snapshot).toMatchSnapshot();
- });
- });
- });
-
- describe('rendered with videoSharingEnabled true', () => {
- describe('and allowVideoSharing value equals true', () => {
- describe(' with level equal to course', () => {
- const wrapper = shallow();
- it('should have setting location message', () => {
- const settingLocationDisclaimer = wrapper.instance.findByType('FormattedMessage')[2].props.defaultMessage;
- expect(settingLocationDisclaimer).toEqual(messages.disclaimerSettingLocation.defaultMessage);
- });
- it('should have checkbox disabled prop equal true', () => {
- const disabledCheckbox = wrapper.shallowWrapper.props.children[1].props.disabled;
- expect(disabledCheckbox).toEqual(true);
- });
- });
- describe(' with level equal to block', () => {
- const wrapper = shallow();
- it('should not have setting location message', () => {
- const formattedMessages = wrapper.instance.findByType('FormattedMessage');
- expect(formattedMessages.length).toEqual(1);
- expect(formattedMessages[0]).not.toEqual(messages.disclaimerSettingLocation.defaultMessage);
- });
- it('should not have override note', () => {
- const formattedMessages = wrapper.instance.findByType('FormattedMessage');
- expect(formattedMessages.length).toEqual(1);
- expect(formattedMessages[0]).not.toEqual(messages.overrideSocialSharingNote.defaultMessage);
- });
- it('should have checkbox disabled prop equal false', () => {
- const disabledCheckbox = wrapper.shallowWrapper.props.children[1].props.disabled;
- expect(disabledCheckbox).toEqual(false);
- });
- });
- describe('isLibrary equals true', () => {
- const wrapper = shallow();
- it('should not have setting location message', () => {
- const formattedMessages = wrapper.instance.findByType('FormattedMessage');
- expect(formattedMessages.length).toEqual(1);
- expect(formattedMessages[0]).not.toEqual(messages.disclaimerSettingLocation.defaultMessage);
- });
- it('should not have override note', () => {
- const formattedMessages = wrapper.instance.findByType('FormattedMessage');
- expect(formattedMessages.length).toEqual(1);
- expect(formattedMessages[0]).not.toEqual(messages.overrideSocialSharingNote.defaultMessage);
- });
- it('should have checkbox disabled prop equal false', () => {
- const disabledCheckbox = wrapper.shallowWrapper.props.children[1].props.disabled;
- expect(disabledCheckbox).toEqual(false);
- });
- });
- it('should have subtitle with text that reads Enabled', () => {
- const wrapper = shallow();
- const { subtitle } = wrapper.shallowWrapper.props;
- expect(wrapper.snapshot).toMatchSnapshot();
- expect(subtitle).toEqual('Enabled');
- });
- });
- describe('and allowVideoSharing value equals false', () => {
- describe(' with level equal to course', () => {
- const wrapper = shallow();
- it('should have setting location message', () => {
- const settingLocationDisclaimer = wrapper.instance.findByType('FormattedMessage')[2].props.defaultMessage;
- expect(settingLocationDisclaimer).toEqual(messages.disclaimerSettingLocation.defaultMessage);
- });
- it('should have checkbox disabled prop equal true', () => {
- const disabledCheckbox = wrapper.shallowWrapper.props.children[1].props.disabled;
- expect(disabledCheckbox).toEqual(true);
- });
- });
- describe(' with level equal to block', () => {
- const wrapper = shallow();
- it('should not have setting location message', () => {
- const formattedMessages = wrapper.instance.findByType('FormattedMessage');
- expect(formattedMessages.length).toEqual(1);
- expect(formattedMessages.at(0)).not.toEqual(messages.disclaimerSettingLocation.defaultMessage);
- });
- it('should not have override note', () => {
- const formattedMessages = wrapper.instance.findByType('FormattedMessage');
- expect(formattedMessages.length).toEqual(1);
- expect(formattedMessages.at(0)).not.toEqual(messages.overrideSocialSharingNote.defaultMessage);
- });
- it('should have checkbox disabled prop equal false', () => {
- const disabledCheckbox = wrapper.shallowWrapper.props.children[1].props.disabled;
- expect(disabledCheckbox).toEqual(false);
- });
- });
- describe('isLibrary equals true', () => {
- const wrapper = shallow();
- it('should not have setting location message', () => {
- const formattedMessages = wrapper.instance.findByType('FormattedMessage');
- expect(formattedMessages.length).toEqual(1);
- expect(formattedMessages.at(0)).not.toEqual(messages.disclaimerSettingLocation.defaultMessage);
- });
- it('should not have override note', () => {
- const formattedMessages = wrapper.instance.findByType('FormattedMessage');
- expect(formattedMessages.length).toEqual(1);
- expect(formattedMessages.at(0)).not.toEqual(messages.overrideSocialSharingNote.defaultMessage);
- });
- it('should have checkbox disabled prop equal false', () => {
- const disabledCheckbox = wrapper.shallowWrapper.props.children[1].props.disabled;
- expect(disabledCheckbox).toEqual(false);
- });
- });
- it('should have subtitle with text that reads Enabled', () => {
- const wrapper = shallow();
- const { subtitle } = wrapper.shallowWrapper.props;
- expect(wrapper.snapshot).toMatchSnapshot();
- expect(subtitle).toEqual('Disabled');
- });
- });
- });
- describe('mapStateToProps', () => {
- const testState = { A: 'pple', B: 'anana', C: 'ucumber' };
- test('isLibrary from app.isLibrary', () => {
- expect(
- mapStateToProps(testState).isLibrary,
- ).toEqual(selectors.app.isLibrary(testState));
- });
- test('allowVideoSharing from video.allowVideoSharing', () => {
- expect(
- mapStateToProps(testState).allowVideoSharing,
- ).toEqual(selectors.video.allowVideoSharing(testState));
- });
- test('videoSharingEnabledForCourse from video.videoSharingEnabledForCourse', () => {
- expect(
- mapStateToProps(testState).videoSharingEnabledForCourse,
- ).toEqual(selectors.video.videoSharingEnabledForCourse(testState));
- });
- test('videoSharingEnabledForAll from video.videoSharingEnabledForAll', () => {
- expect(
- mapStateToProps(testState).videoSharingEnabledForAll,
- ).toEqual(selectors.video.videoSharingEnabledForAll(testState));
- });
- test('videoSharingLearnMoreLink from video.videoSharingLearnMoreLink', () => {
- expect(
- mapStateToProps(testState).videoSharingLearnMoreLink,
- ).toEqual(selectors.video.videoSharingLearnMoreLink(testState));
- });
- });
- describe('mapDispatchToProps', () => {
- const dispatch = jest.fn();
- test('updateField from actions.video.updateField', () => {
- expect(mapDispatchToProps.updateField).toEqual(dispatch(actions.video.updateField));
- });
- });
-});
diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/index.test.tsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/index.test.tsx
new file mode 100644
index 0000000000..b93e847a1d
--- /dev/null
+++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/index.test.tsx
@@ -0,0 +1,318 @@
+import React from 'react';
+import {
+ render, screen, initializeMocks,
+ fireEvent,
+} from '@src/testUtils';
+
+import { formatMessage } from '../../../../../../testUtils';
+import { SocialShareWidgetInternal as SocialShareWidget } from '.';
+import * as hooks from './hooks';
+
+jest.mock('../../../../../../data/redux', () => ({
+ actions: {
+ video: {
+ updateField: jest.fn().mockName('actions.video.updateField'),
+ },
+ },
+ selectors: {
+ app: {
+ isLibrary: jest.fn(state => ({ isLibrary: state })),
+ },
+ video: {
+ allowVideoSharing: jest.fn(state => ({ allowVideoSharing: state })),
+ videoSharingEnabledForAll: jest.fn(state => ({ videoSharingEnabledForAll: state })),
+ videoSharingEnabledForCourse: jest.fn(state => ({ videoSharingEnabledForCourse: state })),
+ videoSharingLearnMoreLink: jest.fn(state => ({ videoSharingLearnMoreLink: state })),
+ },
+ },
+}));
+
+describe('SocialShareWidget', () => {
+ const props = {
+ intl: { formatMessage },
+ videoSharingEnabledForCourse: false,
+ videoSharingEnabledForAll: false,
+ isLibrary: false,
+ allowVideoSharing: {
+ level: 'block',
+ value: false,
+ },
+ videoSharingLearnMoreLink: 'sOMeURl.cOM',
+ updateField: jest.fn().mockName('args.updateField'),
+ };
+
+ beforeEach(() => {
+ initializeMocks();
+ jest.spyOn(hooks, 'useTrackSocialSharingChange').mockReturnValue(jest.fn());
+ });
+
+ describe('rendered with videoSharingEnabled false', () => {
+ describe('with default props', () => {
+ it('should return null', () => {
+ const { container } = render();
+ const reduxWrapper = container.firstChild;
+ expect(reduxWrapper?.textContent).toBe('');
+ });
+ });
+
+ describe('with videoSharingEnabledForAll false and isLibrary true', () => {
+ it('should return null', () => {
+ const { container } = render();
+ const reduxWrapper = container.firstChild;
+ expect(reduxWrapper?.textContent).toBe('');
+ });
+ });
+
+ describe('with videoSharingEnabledForCourse and isLibrary false and videoSharingEnabledForAll true', () => {
+ it('should return null', () => {
+ const { container } = render();
+ const reduxWrapper = container.firstChild;
+ expect(reduxWrapper?.textContent).toBe('');
+ });
+ });
+ });
+
+ describe('rendered with videoSharingEnabled true', () => {
+ describe('and allowVideoSharing value equals true', () => {
+ describe(' with level equal to course', () => {
+ it('should have setting location message', () => {
+ render();
+ expect(screen.getByText('Change this setting on the course outline page.')).toBeInTheDocument();
+ });
+ it('should have checkbox disabled prop equal true', () => {
+ render();
+ const checkbox = screen.getByRole('checkbox', { name: 'This video is shareable to social media' });
+ expect(checkbox).toBeInTheDocument();
+ expect(checkbox).toBeDisabled();
+ });
+ });
+ describe(' with level equal to block', () => {
+ it('should not have setting location message', () => {
+ render();
+ expect(screen.queryByText('Change this setting on the course outline page.')).not.toBeInTheDocument();
+ });
+ it('should not have override note', () => {
+ render();
+ expect(screen.queryByText('Note: This setting is overridden by the course outline page.')).not.toBeInTheDocument();
+ });
+ it('should have checkbox disabled prop equal false', () => {
+ render();
+ const checkbox = screen.getByRole('checkbox', { name: 'This video is shareable to social media' });
+ expect(checkbox).toBeInTheDocument();
+ expect(checkbox).not.toBeDisabled();
+ });
+ });
+ describe('isLibrary equals true', () => {
+ it('should not have setting location message', () => {
+ render();
+ expect(screen.queryByText('Change this setting on the course outline page.')).not.toBeInTheDocument();
+ });
+ it('should not have override note', () => {
+ render();
+ expect(screen.queryByText('Note: This setting is overridden by the course outline page.')).not.toBeInTheDocument();
+ });
+ it('should have checkbox disabled prop equal false', () => {
+ render();
+ const checkbox = screen.getByRole('checkbox', { name: 'This video is shareable to social media' });
+ expect(checkbox).toBeInTheDocument();
+ expect(checkbox).not.toBeDisabled();
+ });
+ });
+ it('should have subtitle with text that reads Enabled', () => {
+ render();
+ expect(screen.getByText('Social Sharing')).toBeInTheDocument();
+ fireEvent.click(screen.getByText('Social Sharing'));
+ const subtitle = screen.getByText('Enabled');
+ expect(subtitle).toBeInTheDocument();
+ });
+ });
+
+ describe('and allowVideoSharing value equals false', () => {
+ describe(' with level equal to course', () => {
+ it('should have setting location message', () => {
+ render();
+ expect(screen.getByText('Change this setting on the course outline page.')).toBeInTheDocument();
+ });
+ it('should have checkbox disabled prop equal true', () => {
+ render();
+ const checkbox = screen.getByRole('checkbox', { name: 'This video is shareable to social media' });
+ expect(checkbox).toBeInTheDocument();
+ expect(checkbox).toBeDisabled();
+ });
+ });
+
+ describe(' with level equal to block', () => {
+ it('should not have setting location message', () => {
+ render();
+ expect(screen.queryByText('Change this setting on the course outline page.')).not.toBeInTheDocument();
+ });
+ it('should not have override note', () => {
+ render();
+ expect(screen.queryByText('Note: This setting is overridden by the course outline page.')).not.toBeInTheDocument();
+ });
+ it('should have checkbox disabled prop equal false', () => {
+ render();
+ const checkbox = screen.getByRole('checkbox', { name: 'This video is shareable to social media' });
+ expect(checkbox).toBeInTheDocument();
+ expect(checkbox).toBeEnabled();
+ });
+ });
+
+ describe('isLibrary equals true', () => {
+ it('should not have setting location message', () => {
+ render();
+ expect(screen.queryByText('Change this setting on the course outline page.')).not.toBeInTheDocument();
+ });
+ it('should not have override note', () => {
+ render();
+ expect(screen.queryByText('Note: This setting is overridden by the course outline page.')).not.toBeInTheDocument();
+ });
+ it('should have checkbox disabled prop equal false', () => {
+ render();
+ const checkbox = screen.getByRole('checkbox', { name: 'This video is shareable to social media' });
+ expect(checkbox).toBeInTheDocument();
+ expect(checkbox).toBeEnabled();
+ });
+ });
+ it('should have subtitle with text that reads Enabled', () => {
+ render();
+ expect(screen.getByText('Social Sharing')).toBeInTheDocument();
+ fireEvent.click(screen.getByText('Social Sharing'));
+ const subtitle = screen.getByText('Disabled');
+ expect(subtitle).toBeInTheDocument();
+ });
+ });
+ });
+});
diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/TranscriptWidget/__snapshots__/index.test.jsx.snap b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/TranscriptWidget/__snapshots__/index.test.jsx.snap
deleted file mode 100644
index 142328e51d..0000000000
--- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/TranscriptWidget/__snapshots__/index.test.jsx.snap
+++ /dev/null
@@ -1,925 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`TranscriptWidget component snapshots snapshot: render when \`isCreateWorkflow\` is \`True\` 1`] = `
-
-
-
- Transcripts
-
- }
- >
-
- To add transcripts, save and reopen this video
-