Skip to content

Commit

Permalink
fix(withZoomPanPinchHOC): renaming & test fix
Browse files Browse the repository at this point in the history
Co-Authored-By: Aybüke Ceylan <[email protected]>
  • Loading branch information
ozsirmajotform and aybukeceylan committed Mar 1, 2023
1 parent 708a3a9 commit f70566e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/__tests__/unit-tests/StaticComponents/staticScene.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { PresentationProvider } from '../../../utils/presentationContext';
import { selectors } from '../../../__test_helpers__/constants';
import StaticPage from '../../../components/Preview/StaticPage';
import {StaticPageWithZoomPanPinch} from '../../../components/Preview/StaticPage';
import StaticScene from '../../../components/Preview/StaticScene';
import ZoomControls from '../../../components/Builder/ZoomControls';

Expand All @@ -23,7 +23,7 @@ describe('StaticScene Component Tree', () => {

it('Should Not Render StaticPage If Pages Prop Not Defined', () => {
const staticSceneShallow = shallow(<StaticScene {...StaticScene.defaultProps} />);
expect(staticSceneShallow.find(StaticPage).exists()).toBeFalsy();
expect(staticSceneShallow.find(StaticPageWithZoomPanPinch).exists()).toBeFalsy();
});

it('Should Render StaticPage According Pages Prop', () => {
Expand All @@ -43,7 +43,7 @@ describe('StaticScene Component Tree', () => {
],
};
const staticSceneShallow = shallow(<StaticScene {...props} />);
expect(staticSceneShallow.find(StaticPage)).toHaveLength(2);
expect(staticSceneShallow.find(StaticPageWithZoomPanPinch)).toHaveLength(2);
});

it('Should Render ZoomControl If isFullscreen Prop Value is False', () => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/Preview/StaticPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as classNames from '../../constants/classNames';
import ReportItemRenderer from '../Builder/ReportItemRenderer';
import StaticItem from './StaticItem';
import getMergedItem from '../../utils/getMergedItem';
import withZoomPanPinchHOC from '../withZoomPanPinchHOC';

const StaticPage = ({
acceptedItems,
Expand Down Expand Up @@ -67,3 +68,4 @@ StaticPage.defaultProps = {
};

export default memo(StaticPage);
export const StaticPageWithZoomPanPinch = withZoomPanPinchHOC(StaticPage);
5 changes: 1 addition & 4 deletions src/components/Preview/StaticScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@ import {
import PropTypes from 'prop-types';
import cNames from 'classnames';
import * as classNames from '../../constants/classNames';
import StaticPage from './StaticPage';
import { StaticPageWithZoomPanPinch } from './StaticPage';
import { usePropContext } from '../../utils/propContext';
import { useBuilderContext } from '../../utils/builderContext';
import { slugify } from '../../utils/string';
import { usePageTransition } from '../../utils/hooks';
import { usePresentationContext } from '../../utils/presentationContext';
import ZoomControls from '../Builder/ZoomControls';
import withZoomPanPinchHOC from '../Presentation/TransformHOC';

const StaticPageWithZoomPanPinch = withZoomPanPinchHOC(StaticPage);

const StaticScene = ({
additionalPageItems,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import {
string, func, any, oneOfType, shape,
} from 'prop-types';
import { TransformWrapper, TransformComponent } from 'react-zoom-pan-pinch';
import { useBuilderContext } from '../../utils/builderContext';
import { usePresentationContext } from '../../utils/presentationContext';
import { useBuilderContext } from '../utils/builderContext';
import { usePresentationContext } from '../utils/presentationContext';

const withZoomPanPinchHOC = WrappedComponent => {
const ZoomPanPinchHOC = props => {
Expand Down

0 comments on commit f70566e

Please sign in to comment.