style: rename function

This commit is contained in:
jansenk
2023-06-22 09:26:11 -04:00
parent 491d870cd2
commit 1a0cc2db2a
3 changed files with 5 additions and 5 deletions

View File

@@ -3,7 +3,7 @@ import { sendTrackEvent } from '@edx/frontend-platform/analytics';
import { selectors } from '../../../../../../data/redux';
import analyticsEvents from './constants';
export const handleSocialSharingCheckboxChange = ({ updateField }) => {
export const useTrackSocialSharingChange = ({ updateField }) => {
const analytics = useSelector(selectors.app.analytics);
const allowVideoSharing = useSelector(selectors.video.allowVideoSharing);
return (event) => {
@@ -23,4 +23,4 @@ export const handleSocialSharingCheckboxChange = ({ updateField }) => {
};
};
export default handleSocialSharingCheckboxChange;
export default useTrackSocialSharingChange;

View File

@@ -18,14 +18,14 @@ jest.mock('@edx/frontend-platform/analytics', () => ({
}));
describe('SocialShareWidget hooks', () => {
describe('handleSocialSharingCheckboxChange when', () => {
describe('useTrackSocialSharingChange when', () => {
let onClick;
let updateField;
describe.each([true, false])('box is toggled', (checked) => {
beforeAll(() => {
jest.resetAllMocks();
updateField = jest.fn();
onClick = hooks.handleSocialSharingCheckboxChange({ updateField });
onClick = hooks.useTrackSocialSharingChange({ updateField });
expect(typeof onClick).toBe('function');
onClick({ target: { checked } });
});

View File

@@ -33,7 +33,7 @@ export const SocialShareWidget = ({
const isSetByCourse = allowVideoSharing.level === 'course';
const videoSharingEnabled = isLibrary ? videoSharingEnabledForAll : videoSharingEnabledForCourse;
const learnMoreLink = videoSharingLearnMoreLink || 'http://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/latest/developing_course/social_sharing.html';
const onSocialSharingCheckboxChange = hooks.handleSocialSharingCheckboxChange({ updateField });
const onSocialSharingCheckboxChange = hooks.useTrackSocialSharingChange({ updateField });
const getSubtitle = () => {
if (allowVideoSharing.value) {