From 2fd5e92d2dda3c57f830e1a4fefd8e78cad22929 Mon Sep 17 00:00:00 2001 From: Leangseu Kim Date: Mon, 27 Nov 2023 14:56:53 -0500 Subject: [PATCH] chore: fix typo for modal event --- .../sequence/Unit/hooks/useModalIFrameData.js | 4 ++-- .../sequence/Unit/hooks/useModalIFrameData.test.js | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/courseware/course/sequence/Unit/hooks/useModalIFrameData.js b/src/courseware/course/sequence/Unit/hooks/useModalIFrameData.js index b36d82080f..cf0b76878d 100644 --- a/src/courseware/course/sequence/Unit/hooks/useModalIFrameData.js +++ b/src/courseware/course/sequence/Unit/hooks/useModalIFrameData.js @@ -11,7 +11,7 @@ export const stateKeys = StrictDict({ export const DEFAULT_HEIGHT = '100vh'; -const useModalIFrameBehavior = () => { +const useModalIFrameData = () => { const [isOpen, setIsOpen] = useKeyedState(stateKeys.isOpen, false); const [options, setOptions] = useKeyedState(stateKeys.options, { height: DEFAULT_HEIGHT }); @@ -42,4 +42,4 @@ const useModalIFrameBehavior = () => { }; }; -export default useModalIFrameBehavior; +export default useModalIFrameData; diff --git a/src/courseware/course/sequence/Unit/hooks/useModalIFrameData.test.js b/src/courseware/course/sequence/Unit/hooks/useModalIFrameData.test.js index 0d0b9ec350..f91be85a20 100644 --- a/src/courseware/course/sequence/Unit/hooks/useModalIFrameData.test.js +++ b/src/courseware/course/sequence/Unit/hooks/useModalIFrameData.test.js @@ -2,7 +2,7 @@ import { mockUseKeyedState } from '@edx/react-unit-test-utils'; import { useEventListener } from '../../../../../generic/hooks'; import { messageTypes } from '../constants'; -import useModalIFrameBehavior, { stateKeys, DEFAULT_HEIGHT } from './useModalIFrameData'; +import useModalIFrameData, { stateKeys, DEFAULT_HEIGHT } from './useModalIFrameData'; jest.mock('react', () => ({ ...jest.requireActual('react'), @@ -14,7 +14,7 @@ jest.mock('../../../../../generic/hooks', () => ({ const state = mockUseKeyedState(stateKeys); -describe('useModalIFrameBehavior', () => { +describe('useModalIFrameData', () => { beforeEach(() => { jest.clearAllMocks(); state.mock(); @@ -28,17 +28,17 @@ describe('useModalIFrameBehavior', () => { }; describe('behavior', () => { it('initializes isOpen to false', () => { - useModalIFrameBehavior(); + useModalIFrameData(); state.expectInitializedWith(stateKeys.isOpen, false); }); it('initializes options with default height', () => { - useModalIFrameBehavior(); + useModalIFrameData(); state.expectInitializedWith(stateKeys.options, { height: DEFAULT_HEIGHT }); }); describe('eventListener', () => { const oldOptions = { some: 'old', options: 'yeah' }; const prepareListener = () => { - useModalIFrameBehavior(); + useModalIFrameData(); expect(useEventListener).toHaveBeenCalled(); const call = useEventListener.mock.calls[0][1]; expect(call.prereqs).toEqual([]); @@ -80,7 +80,7 @@ describe('useModalIFrameBehavior', () => { }); describe('output', () => { test('returns handleModalClose callback', () => { - testHandleModalClose({ trigger: useModalIFrameBehavior().handleModalClose }); + testHandleModalClose({ trigger: useModalIFrameData().handleModalClose }); }); it('forwards modalOptions from state values', () => { const modalOptions = { test: 'options' }; @@ -88,7 +88,7 @@ describe('useModalIFrameBehavior', () => { [stateKeys.options]: modalOptions, [stateKeys.isOpen]: true, }); - expect(useModalIFrameBehavior().modalOptions).toEqual({ + expect(useModalIFrameData().modalOptions).toEqual({ ...modalOptions, isOpen: true, });