File tree Expand file tree Collapse file tree 1 file changed +12
-14
lines changed
src/packages/backtop/__test__ Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -8,21 +8,19 @@ import BackTop from '@/packages/backtop'
88test ( 'backtop props test' , ( ) => {
99 const handleClick = vi . fn ( )
1010 const { container } = render (
11- < BackTop
12- target = "target"
13- threshold = { 200 }
14- style = { {
15- right : '20px' ,
16- bottom : '50px' ,
17- } }
18- onClick = { handleClick }
19- />
11+ < div id = "target" style = { { height : '100vh' } } >
12+ { new Array ( 24 ) . fill ( 0 ) . map ( ( _ , index ) => {
13+ return < div key = { index } > 我是测试数据{ index } </ div >
14+ } ) }
15+ < BackTop
16+ target = "target"
17+ className = "backtop-button"
18+ onClick = { handleClick }
19+ />
20+ </ div >
2021 )
21- expect ( container . querySelector ( '.nut-backtop' ) ) . toHaveAttribute (
22- 'style' ,
23- 'z-index: 900; right: 20px; bottom: 50px;'
24- )
25- fireEvent . click ( container )
22+ const chooseTagEle = container . querySelectorAll ( '.backtop-button' ) [ 0 ]
23+ fireEvent . click ( chooseTagEle )
2624 expect ( handleClick ) . toBeCalled
2725} )
2826
You can’t perform that action at this time.
0 commit comments