@@ -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' ;
10- import React , { useState } from 'react' ;
11- import Dialog from '@rc-component/dialog' ;
11+ import React from 'react' ;
1212
1313jest . mock ( '../src/Preview' , ( ) => {
1414 const MockPreview = ( props : any ) => {
@@ -378,6 +378,26 @@ describe('Preview', () => {
378378 } ) ;
379379 } ) ;
380380
381+ it ( 'should render movable className correctly according to movable prop' , ( ) => {
382+ const { rerender } = render (
383+ < Image
384+ src = "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
385+ preview = { { open : true } }
386+ /> ,
387+ ) ;
388+
389+ expect ( document . querySelector ( '.rc-image-preview' ) ) . toHaveClass ( 'rc-image-preview-movable' ) ;
390+
391+ rerender (
392+ < Image
393+ src = "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
394+ preview = { { open : true , movable : false } }
395+ /> ,
396+ ) ;
397+
398+ expect ( document . querySelector ( '.rc-image-preview' ) ) . not . toHaveClass ( 'rc-image-preview-movable' ) ;
399+ } ) ;
400+
381401 it ( 'Mouse Event' , ( ) => {
382402 const clientWidthMock = jest
383403 . spyOn ( document . documentElement , 'clientWidth' , 'get' )
0 commit comments