@@ -5,10 +5,10 @@ import RotateLeftOutlined from '@ant-design/icons/RotateLeftOutlined';
55import RotateRightOutlined from '@ant-design/icons/RotateRightOutlined' ;
66import ZoomInOutlined from '@ant-design/icons/ZoomInOutlined' ;
77import ZoomOutOutlined from '@ant-design/icons/ZoomOutOutlined' ;
8+ import Dialog from '@rc-component/dialog' ;
89import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook' ;
910import { act , createEvent , fireEvent , render } from '@testing-library/react' ;
1011import React from 'react' ;
11- import Dialog from '@rc-component/dialog' ;
1212
1313jest . mock ( '../src/Preview' , ( ) => {
1414 const MockPreview = ( props : any ) => {
@@ -383,6 +383,26 @@ describe('Preview', () => {
383383 } ) ;
384384 } ) ;
385385
386+ it ( 'should render movable className correctly according to movable prop' , ( ) => {
387+ const { rerender } = render (
388+ < Image
389+ src = "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
390+ preview = { { open : true } }
391+ /> ,
392+ ) ;
393+
394+ expect ( document . querySelector ( '.rc-image-preview' ) ) . toHaveClass ( 'rc-image-preview-movable' ) ;
395+
396+ rerender (
397+ < Image
398+ src = "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
399+ preview = { { open : true , movable : false } }
400+ /> ,
401+ ) ;
402+
403+ expect ( document . querySelector ( '.rc-image-preview' ) ) . not . toHaveClass ( 'rc-image-preview-movable' ) ;
404+ } ) ;
405+
386406 it ( 'Mouse Event' , ( ) => {
387407 const clientWidthMock = jest
388408 . spyOn ( document . documentElement , 'clientWidth' , 'get' )
0 commit comments