File tree Expand file tree Collapse file tree 5 files changed +20
-5
lines changed Expand file tree Collapse file tree 5 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { spyElementPrototype } from '@rc-component/util/lib/test/domHook';
33import React from 'react' ;
44import { act } from 'react-dom/test-utils' ;
55// eslint-disable-next-line @typescript-eslint/no-unused-vars
6- import RcResizeObserver from 'rc-resize-observer' ;
6+ import RcResizeObserver from '@ rc-component/ resize-observer' ;
77import Table from '../src' ;
88
99vi . mock ( '@rc-component/util/lib/Dom/styleChecker' , ( ) => {
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import { mount } from 'enzyme' ;
33import { render } from '@testing-library/react' ;
4- import RcResizeObserver , { _rs } from 'rc-resize-observer' ;
4+ import RcResizeObserver , { _rs } from '@ rc-component/ resize-observer' ;
55import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook' ;
66import { act } from 'react-dom/test-utils' ;
77import Table , { type ColumnsType } from '../src' ;
Original file line number Diff line number Diff line change 11import { mount } from 'enzyme' ;
2- import RcResizeObserver from 'rc-resize-observer' ;
2+ import RcResizeObserver from '@ rc-component/ resize-observer' ;
33import { spyElementPrototype } from '@rc-component/util/lib/test/domHook' ;
44import React from 'react' ;
55import { act } from 'react-dom/test-utils' ;
Original file line number Diff line number Diff line change 11import { act , fireEvent , render } from '@testing-library/react' ;
2- import { _rs as onEsResize } from 'rc-resize-observer/es/utils/observerUtil' ;
3- import { _rs as onLibResize } from 'rc-resize-observer/lib/utils/observerUtil' ;
2+ import { _rs as onEsResize } from '@ rc-component/ resize-observer/es/utils/observerUtil' ;
3+ import { _rs as onLibResize } from '@ rc-component/ resize-observer/lib/utils/observerUtil' ;
44import { spyElementPrototypes } from '@rc-component/util/lib/test/domHook' ;
55import { resetWarned } from '@rc-component/util/lib/warning' ;
66import React from 'react' ;
Original file line number Diff line number Diff line change @@ -13,3 +13,18 @@ const Enzyme = require('enzyme');
1313const Adapter = require ( 'enzyme-adapter-react-16' ) ;
1414
1515Enzyme . configure ( { adapter : new Adapter ( ) } ) ;
16+
17+ // Mock ResizeObserver
18+ global . ResizeObserver = class ResizeObserver implements ResizeObserver {
19+ callback : ResizeObserverCallback ;
20+
21+ constructor ( callback : ResizeObserverCallback ) {
22+ this . callback = callback ;
23+ }
24+ observe ( ele ) {
25+ // Mock trigger first time
26+ this . callback ( [ { target : ele } ] as any , this ) ;
27+ }
28+ unobserve ( ) { }
29+ disconnect ( ) { }
30+ } ;
You can’t perform that action at this time.
0 commit comments