1- import React from 'react' ;
21import { mount } from 'enzyme' ;
3- import { act } from 'react-dom/test-utils' ;
4- import { resetWarned } from 'rc-util/lib/warning' ;
52import { spyElementPrototype } from 'rc-util/lib/test/domHook' ;
3+ import { resetWarned } from 'rc-util/lib/warning' ;
4+ import React from 'react' ;
5+ import { act } from 'react-dom/test-utils' ;
66import Table from '../src' ;
77
88describe ( 'Table.Expand' , ( ) => {
@@ -22,7 +22,7 @@ describe('Table.Expand', () => {
2222
2323 it ( 'renders expand row correctly' , ( ) => {
2424 resetWarned ( ) ;
25- const errorSpy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
25+ const errorSpy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
2626 const wrapper = mount ( createTable ( { expandedRowRender } ) ) ;
2727 expect ( wrapper . find ( 'tbody tr' ) ) . toHaveLength ( 2 ) ;
2828 expect ( errorSpy ) . toHaveBeenCalledWith (
@@ -32,7 +32,7 @@ describe('Table.Expand', () => {
3232 } ) ;
3333
3434 it ( 'pass proper parameters to expandedRowRender' , ( ) => {
35- const rowRender = jest . fn ( ( ) => < div > expanded row</ div > ) ;
35+ const rowRender = vi . fn ( ( ) => < div > expanded row</ div > ) ;
3636 const expandableProps = props => ( { expandable : { expandedRowRender : rowRender , ...props } } ) ;
3737 const wrapper = mount ( createTable ( expandableProps ( ) ) ) ;
3838 wrapper . setProps ( expandableProps ( { expandedRowKeys : [ 0 ] } ) ) ;
@@ -232,7 +232,7 @@ describe('Table.Expand', () => {
232232 describe ( 'config expand column index' , ( ) => {
233233 it ( 'not show EXPAND_COLUMN if expandable is false' , ( ) => {
234234 resetWarned ( ) ;
235- const errorSpy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
235+ const errorSpy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
236236
237237 const wrapper = mount (
238238 createTable ( {
@@ -250,7 +250,7 @@ describe('Table.Expand', () => {
250250
251251 it ( 'renders expand icon to the specify column' , ( ) => {
252252 resetWarned ( ) ;
253- const errorSpy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
253+ const errorSpy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
254254
255255 const wrapper = mount (
256256 createTable ( {
@@ -287,7 +287,7 @@ describe('Table.Expand', () => {
287287
288288 it ( 'de-duplicate of EXPAND_COLUMN' , ( ) => {
289289 resetWarned ( ) ;
290- const errorSpy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
290+ const errorSpy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
291291
292292 const wrapper = mount (
293293 createTable ( {
@@ -400,7 +400,7 @@ describe('Table.Expand', () => {
400400 } ) ;
401401
402402 it ( 'renders expend row class correctly' , ( ) => {
403- const expandedRowClassName = jest . fn ( ) . mockReturnValue ( 'expand-row-test-class-name' ) ;
403+ const expandedRowClassName = vi . fn ( ) . mockReturnValue ( 'expand-row-test-class-name' ) ;
404404 const wrapper = mount (
405405 createTable ( {
406406 expandable : {
@@ -431,7 +431,7 @@ describe('Table.Expand', () => {
431431 } ) ;
432432
433433 it ( 'fires expand change event' , ( ) => {
434- const onExpand = jest . fn ( ) ;
434+ const onExpand = vi . fn ( ) ;
435435 const wrapper = mount (
436436 createTable ( {
437437 expandable : {
@@ -448,7 +448,7 @@ describe('Table.Expand', () => {
448448 } ) ;
449449
450450 it ( 'fires onExpandedRowsChange event' , ( ) => {
451- const onExpandedRowsChange = jest . fn ( ) ;
451+ const onExpandedRowsChange = vi . fn ( ) ;
452452 const wrapper = mount (
453453 createTable ( {
454454 expandedRowRender,
@@ -473,7 +473,7 @@ describe('Table.Expand', () => {
473473 } ) ;
474474
475475 it ( 'expandRowByClick' , ( ) => {
476- const onExpand = jest . fn ( ) ;
476+ const onExpand = vi . fn ( ) ;
477477 const wrapper = mount (
478478 createTable ( {
479479 expandable : {
@@ -533,7 +533,7 @@ describe('Table.Expand', () => {
533533 // https://github.com/ant-design/ant-design/issues/23894
534534 it ( 'should be collapsible when use `expandIcon` & `expandRowByClick`' , ( ) => {
535535 const data = [ { key : 0 , name : 'Lucy' , age : 27 } ] ;
536- const onExpand = jest . fn ( ) ;
536+ const onExpand = vi . fn ( ) ;
537537 const wrapper = mount (
538538 createTable ( {
539539 expandable : {
@@ -561,7 +561,7 @@ describe('Table.Expand', () => {
561561 // https://github.com/ant-design/ant-design/issues/23894
562562 it ( 'should be collapsible when `expandRowByClick` without custom `expandIcon`' , ( ) => {
563563 const data = [ { key : 0 , name : 'Lucy' , age : 27 } ] ;
564- const onExpand = jest . fn ( ) ;
564+ const onExpand = vi . fn ( ) ;
565565 const wrapper = mount (
566566 createTable ( {
567567 expandable : {
@@ -582,7 +582,7 @@ describe('Table.Expand', () => {
582582
583583 it ( 'should be collapsible when `expandRowByClick` with custom `expandIcon` and event.stopPropagation' , ( ) => {
584584 const data = [ { key : 0 , name : 'Lucy' , age : 27 } ] ;
585- const onExpand = jest . fn ( ) ;
585+ const onExpand = vi . fn ( ) ;
586586 const wrapper = mount (
587587 createTable ( {
588588 expandable : {
@@ -612,7 +612,7 @@ describe('Table.Expand', () => {
612612
613613 it ( 'support invalid expandIcon' , ( ) => {
614614 const data = [ { key : 0 , name : 'Lucy' , age : 27 } ] ;
615- const onExpand = jest . fn ( ) ;
615+ const onExpand = vi . fn ( ) ;
616616 const wrapper = mount (
617617 createTable ( {
618618 expandable : {
@@ -629,7 +629,7 @@ describe('Table.Expand', () => {
629629
630630 it ( 'warning for use `expandedRowRender` and nested table in the same time' , ( ) => {
631631 resetWarned ( ) ;
632- const errorSpy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
632+ const errorSpy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
633633 mount ( createTable ( { expandedRowRender, data : [ { children : [ ] } ] } ) ) ;
634634 expect ( errorSpy ) . toHaveBeenCalledWith (
635635 'Warning: `expandedRowRender` should not use with nested Table' ,
0 commit comments