style: quality
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
export const analyticsEvents = {
|
||||
socialSharingSettingChanged: 'edx.social.video_sharing_setting.changed'
|
||||
}
|
||||
socialSharingSettingChanged: 'edx.social.video_sharing_setting.changed',
|
||||
};
|
||||
|
||||
export default analyticsEvents
|
||||
export default analyticsEvents;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 },
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user