style: rename function
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 } });
|
||||
});
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user