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 () => {
1515 autohide = { false }
1616 color = "warning"
1717 delay = { 100 }
18- key = { 1 }
1918 visible = { true }
2019 //onDismiss
2120 >
@@ -41,7 +40,6 @@ test('CToast click on dismiss button', async () => {
4140 autohide = { false }
4241 color = "warning"
4342 delay = { 100 }
44- key = { 1 }
4543 visible = { true }
4644 onDismiss = { onDismiss }
4745 >
Original file line number Diff line number Diff line change 11import * 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'
35import '@testing-library/jest-dom/extend-expect'
46import { CTooltip , CLink } from '../../../index'
57
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+
620test ( 'loads and displays CTooltip component' , async ( ) => {
7- const { container } = render (
21+ ReactDOM . render (
822 < CTooltip content = "content" >
923 < CLink > Test</ CLink >
1024 </ CTooltip > ,
25+ container ,
1126 )
1227 expect ( container ) . toMatchSnapshot ( )
1328} )
1429
1530test ( '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+ } )
2139 const link = document . querySelector ( '.link' )
2240 act ( ( ) => {
2341 if ( link !== null ) {
You can’t perform that action at this time.
0 commit comments