File tree Expand file tree Collapse file tree 2 files changed +25
-9
lines changed Expand file tree Collapse file tree 2 files changed +25
-9
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ test('CToast customize', async () => {
15
15
autohide = { false }
16
16
color = "warning"
17
17
delay = { 100 }
18
- key = { 1 }
19
18
visible = { true }
20
19
//onDismiss
21
20
>
@@ -41,7 +40,6 @@ test('CToast click on dismiss button', async () => {
41
40
autohide = { false }
42
41
color = "warning"
43
42
delay = { 100 }
44
- key = { 1 }
45
43
visible = { true }
46
44
onDismiss = { onDismiss }
47
45
>
Original file line number Diff line number Diff line change 1
1
import * as React from 'react'
2
- import { act , render , fireEvent } from '@testing-library/react'
2
+ import ReactDOM from 'react-dom'
3
+ import { act } from 'react-dom/test-utils'
4
+ import { fireEvent } from '@testing-library/react'
3
5
import '@testing-library/jest-dom/extend-expect'
4
6
import { CTooltip , CLink } from '../../../index'
5
7
8
+ let container : HTMLDivElement | null
9
+
10
+ beforeEach ( ( ) => {
11
+ container = document . createElement ( 'div' )
12
+ document . body . appendChild ( container )
13
+ } )
14
+
15
+ afterEach ( ( ) => {
16
+ container && document . body . removeChild ( container )
17
+ container = null
18
+ } )
19
+
6
20
test ( 'loads and displays CTooltip component' , async ( ) => {
7
- const { container } = render (
21
+ ReactDOM . render (
8
22
< CTooltip content = "content" >
9
23
< CLink > Test</ CLink >
10
24
</ CTooltip > ,
25
+ container ,
11
26
)
12
27
expect ( container ) . toMatchSnapshot ( )
13
28
} )
14
29
15
30
test ( 'CTooltip customize' , async ( ) => {
16
- const { container } = render (
17
- < CTooltip trigger = "hover" placement = "right" content = "content" >
18
- < CLink className = "link" > Test</ CLink >
19
- </ CTooltip > ,
20
- )
31
+ act ( ( ) => {
32
+ ReactDOM . render (
33
+ < CTooltip trigger = "hover" placement = "right" content = "content" >
34
+ < CLink className = "link" > Test</ CLink >
35
+ </ CTooltip > ,
36
+ container ,
37
+ )
38
+ } )
21
39
const link = document . querySelector ( '.link' )
22
40
act ( ( ) => {
23
41
if ( link !== null ) {
You can’t perform that action at this time.
0 commit comments