1- import React , { useState } from 'react' ;
1+ import React from 'react' ;
22import { render , unmountComponentAtNode } from 'react-dom' ;
33import useDynTabs from './index.js' ;
44import { act } from 'react-dom/test-utils' ;
@@ -35,7 +35,7 @@ beforeEach(() => {
3535 beforeSelect : jest . fn ( function ( ) { } ) ,
3636 onDestroy : jest . fn ( function ( ) { } ) ,
3737 } ;
38- App = function ( props ) {
38+ App = function App ( ) {
3939 const [ Tablist , Panellist , readyFunction ] = useDynTabs ( op ) ;
4040 ready = readyFunction ;
4141 readyFunction ( ( instanceParam ) => {
@@ -72,8 +72,8 @@ describe('apply multiple actions : ', () => {
7272 expect . assertions ( 1 ) ;
7373 renderApp ( ) ;
7474 return act ( ( ) => {
75- return instance . select ( '2' ) . then ( ( result ) => {
76- return instance . close ( '2' ) . then ( ( result ) => {
75+ return instance . select ( '2' ) . then ( ( ) => {
76+ return instance . close ( '2' ) . then ( ( ) => {
7777 expect ( document . querySelector ( '[tab-id="1"]' ) . className . includes ( 'rc-dyn-tabs-selected' ) ) . toBe ( true ) ;
7878 } ) ;
7979 } ) ;
@@ -82,7 +82,7 @@ describe('apply multiple actions : ', () => {
8282 test ( 'opening new tab and closing selected tab' , ( ) => {
8383 let _api ;
8484 act ( ( ) => {
85- const App = function ( props ) {
85+ const App = function ( ) {
8686 const [ Tablist , Panellist , api ] = useDynTabs ( op ) ;
8787 _api = api ;
8888 return (
@@ -122,13 +122,13 @@ describe('apply multiple actions : ', () => {
122122 return (
123123 < a { ...props . tabProps } >
124124 { props . children }
125- { props . hasOwnProperty ( 'iconProps' ) && < span { ...props . iconProps } > </ span > }
125+ { Object . prototype . hasOwnProperty . call ( props , 'iconProps' ) && < span { ...props . iconProps } > </ span > }
126126 </ a >
127127 ) ;
128128 } ) ;
129129 instance . one ( 'onInit' , function ( ) {
130130 this . setTab ( '1' , {
131- panelComponent : function ( props ) {
131+ panelComponent : function panelComponent ( ) {
132132 return < div id = "updatedPanel1" > </ div > ;
133133 } ,
134134 } ) . refresh ( ) ;
@@ -215,7 +215,7 @@ describe('select method : ', () => {
215215 expect . assertions ( 2 ) ;
216216 renderApp ( ) ;
217217 return act ( ( ) => {
218- return instance . select ( '1' ) . then ( ( result ) => {
218+ return instance . select ( '1' ) . then ( ( ) => {
219219 expect ( op . onChange . mock . calls . length === 0 ) . toBe ( true ) ;
220220 expect ( op . onInit . mock . calls . length === 2 ) . toBe ( true ) ;
221221 } ) ;
@@ -225,7 +225,7 @@ describe('select method : ', () => {
225225 expect . assertions ( 4 ) ;
226226 renderApp ( ) ;
227227 return act ( ( ) => {
228- return instance . select ( '3' ) . then ( ( result ) => {
228+ return instance . select ( '3' ) . then ( ( ) => {
229229 expect ( document . querySelector ( '.rc-dyn-tabs-selected' ) == null ) . toBe ( true ) ;
230230 expect ( instance . getCopyData ( ) . selectedTabID === '3' ) . toBe ( true ) ;
231231 expect ( op . onChange . mock . calls . length === 1 ) . toBe ( true ) ;
@@ -268,7 +268,7 @@ describe('close method : ', () => {
268268 expect . assertions ( 2 ) ;
269269 renderApp ( ) ;
270270 return act ( ( ) => {
271- return instance . close ( '4' ) . then ( ( result ) => {
271+ return instance . close ( '4' ) . then ( ( ) => {
272272 expect ( op . onChange . mock . calls . length === 0 ) . toBe ( true ) ;
273273 expect ( op . onInit . mock . calls . length === 2 ) . toBe ( true ) ;
274274 } ) ;
@@ -320,7 +320,7 @@ describe('open method : ', () => {
320320 expect . assertions ( 3 ) ;
321321 renderApp ( ) ;
322322 return act ( ( ) => {
323- return instance . open ( op . tabs [ 0 ] ) . then ( ( result ) => {
323+ return instance . open ( op . tabs [ 0 ] ) . then ( ( ) => {
324324 expect ( op . onChange . mock . calls . length === 0 ) . toBe ( true ) ;
325325 expect ( op . onInit . mock . calls . length === 2 ) . toBe ( true ) ;
326326 expect ( instance . getCopyData ( ) . openTabIDs . length === 2 ) . toBe ( true ) ;
@@ -362,7 +362,7 @@ describe('ready function : ', () => {
362362 ready ( ( instance ) => {
363363 instance . one ( 'onLoad' , onLoad ) . one ( 'onInit' , onInit ) ;
364364 } ) ;
365- return instance . refresh ( ) . then ( ( result ) => {
365+ return instance . refresh ( ) . then ( ( ) => {
366366 expect ( op . onLoad . mock . calls . length === 1 ) . toBe ( true ) ;
367367 expect ( op . onInit . mock . calls . length === 2 ) . toBe ( true ) ;
368368 expect ( onInit . mock . calls . length === 1 ) . toBe ( true ) ;
0 commit comments