From 491d870cd2c06c44ee25592d2b110b31b8407275 Mon Sep 17 00:00:00 2001 From: jansenk Date: Mon, 12 Jun 2023 10:25:04 -0400 Subject: [PATCH] style: quality --- .../components/SocialShareWidget/constants.js | 6 +++--- .../components/SocialShareWidget/hooks.jsx | 6 ++++-- .../components/SocialShareWidget/hooks.test.jsx | 17 ++++++++--------- .../components/SocialShareWidget/index.jsx | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/constants.js b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/constants.js index 08a42dfff..3b104e33b 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/constants.js +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/constants.js @@ -1,5 +1,5 @@ export const analyticsEvents = { - socialSharingSettingChanged: 'edx.social.video_sharing_setting.changed' -} + socialSharingSettingChanged: 'edx.social.video_sharing_setting.changed', +}; -export default analyticsEvents \ No newline at end of file +export default analyticsEvents; diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/hooks.jsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/hooks.jsx index 1b6dee43d..01ae560ae 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/hooks.jsx +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/hooks.jsx @@ -1,7 +1,7 @@ import { useSelector } from 'react-redux'; -import analyticsEvents from './constants'; import { sendTrackEvent } from '@edx/frontend-platform/analytics'; import { selectors } from '../../../../../../data/redux'; +import analyticsEvents from './constants'; export const handleSocialSharingCheckboxChange = ({ updateField }) => { const analytics = useSelector(selectors.app.analytics); @@ -12,7 +12,7 @@ export const handleSocialSharingCheckboxChange = ({ updateField }) => { { ...analytics, value: event.target.checked, - } + }, ); updateField({ allowVideoSharing: { @@ -22,3 +22,5 @@ export const handleSocialSharingCheckboxChange = ({ updateField }) => { }); }; }; + +export default handleSocialSharingCheckboxChange; diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/hooks.test.jsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/hooks.test.jsx index 3e20a74b1..0bd60ab6a 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/hooks.test.jsx +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/hooks.test.jsx @@ -1,4 +1,3 @@ -import { actions } from '../../../../../../data/redux/app'; import { sendTrackEvent } from '@edx/frontend-platform/analytics'; import analyticsEvents from './constants'; import * as hooks from './hooks'; @@ -18,25 +17,25 @@ jest.mock('@edx/frontend-platform/analytics', () => ({ sendTrackEvent: jest.fn(), })); - describe('SocialShareWidget hooks', () => { describe('handleSocialSharingCheckboxChange when', () => { - var onClick, updateField; + let onClick; + let updateField; describe.each([true, false])('box is toggled', (checked) => { beforeAll(() => { - jest.resetAllMocks() - updateField = jest.fn() + jest.resetAllMocks(); + updateField = jest.fn(); onClick = hooks.handleSocialSharingCheckboxChange({ updateField }); expect(typeof onClick).toBe('function'); onClick({ target: { checked } }); }); - it("field is updated", () => { - expect(updateField).toBeCalledWith({"allowVideoSharing": {"value": checked}}); + it('field is updated', () => { + expect(updateField).toBeCalledWith({ allowVideoSharing: { value: checked } }); }); - it("event tracking is called", () => { + it('event tracking is called', () => { expect(sendTrackEvent).toBeCalledWith( analyticsEvents.socialSharingSettingChanged, - {"value": checked} + { value: checked }, ); }); }); diff --git a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/index.jsx b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/index.jsx index 09e3de14b..66909af2a 100644 --- a/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/index.jsx +++ b/src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/index.jsx @@ -14,7 +14,7 @@ import { import { selectors, actions } from '../../../../../../data/redux'; import CollapsibleFormWidget from '../CollapsibleFormWidget'; import messages from './messages'; -import * as hooks from './hooks' +import * as hooks from './hooks'; /** * Collapsible Form widget controlling video thumbnail