Skip to content

Commit 6d54142

Browse files
committed
test: update tests
1 parent 18dc65e commit 6d54142

File tree

4 files changed

+42
-32
lines changed

4 files changed

+42
-32
lines changed

src/components/backdrop/__tests__/CBackdrop.spec.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ test('CBackdrop customize', async () => {
1919

2020
test('CBackdrop customize 2', async () => {
2121
jest.useFakeTimers()
22-
const { container } = render(<CBackdrop className="bazinga" visible={true}>Test</CBackdrop>)
22+
const { container } = render(
23+
<CBackdrop className="bazinga" visible={true}>
24+
Test
25+
</CBackdrop>,
26+
)
2327
jest.runAllTimers()
2428
expect(container).toMatchSnapshot()
2529
expect(container.firstChild).toHaveClass('bazinga')

src/components/form/__tests__/CFormInput.spec.tsx

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,34 @@ test('loads and displays CFormInput component', async () => {
99
})
1010

1111
test('CFormInput customize one', async () => {
12-
const { container } = render(
13-
<CFormInput/>
14-
)
12+
const { container } = render(<CFormInput />)
1513
expect(container).toMatchSnapshot()
1614
expect(container.firstChild).toHaveClass('form-control')
1715
})
1816

1917
test('CFormInput customize two', async () => {
20-
const { container } = render(
21-
<CFormInput
22-
className="bazinga"
23-
disabled={true}
24-
invalid={true}
25-
plainText={true}
26-
readOnly={true}
27-
size="lg"
28-
type="color"
29-
valid={true}
30-
value="#888888"
31-
/>
32-
)
33-
expect(container).toMatchSnapshot()
34-
expect(container.firstChild).toHaveClass('form-control-lg')
35-
expect(container.firstChild).toHaveClass('form-control-color')
36-
expect(container.firstChild).toHaveClass('is-invalid')
37-
expect(container.firstChild).toHaveClass('is-valid')
38-
expect(container.firstChild).toHaveClass('form-control-plaintext')
39-
expect(container.firstChild).toHaveClass('bazinga')
40-
expect(container.firstChild).toHaveAttribute('value', '#888888')
41-
expect(container.firstChild).toHaveAttribute('type', 'color')
42-
expect(container.firstChild).toHaveAttribute('disabled', '')
43-
expect(container.firstChild).toHaveAttribute('readonly', '')
44-
})
18+
const { container } = render(
19+
<CFormInput
20+
className="bazinga"
21+
disabled={true}
22+
invalid={true}
23+
plainText={true}
24+
readOnly={true}
25+
size="lg"
26+
type="color"
27+
valid={true}
28+
value="#888888"
29+
/>,
30+
)
31+
expect(container).toMatchSnapshot()
32+
expect(container.firstChild).toHaveClass('form-control-lg')
33+
expect(container.firstChild).toHaveClass('form-control-color')
34+
expect(container.firstChild).toHaveClass('is-invalid')
35+
expect(container.firstChild).toHaveClass('is-valid')
36+
expect(container.firstChild).toHaveClass('form-control-plaintext')
37+
expect(container.firstChild).toHaveClass('bazinga')
38+
expect(container.firstChild).toHaveAttribute('value', '#888888')
39+
expect(container.firstChild).toHaveAttribute('type', 'color')
40+
expect(container.firstChild).toHaveAttribute('disabled', '')
41+
expect(container.firstChild).toHaveAttribute('readonly', '')
42+
})

src/components/toast/__tests__/CToast.spec.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ test('CToast click on dismiss button', async () => {
3434
jest.useFakeTimers()
3535
const onDismiss = jest.fn()
3636
const { container } = render(
37-
<CToast className="bazinga" autohide={false} color="warning" delay={100} key={1} visible={true} onDismiss={onDismiss}>
37+
<CToast
38+
className="bazinga"
39+
autohide={false}
40+
color="warning"
41+
delay={100}
42+
key={1}
43+
visible={true}
44+
onDismiss={onDismiss}
45+
>
3846
<CToastHeader close>
3947
<svg
4048
className="rounded me-2"

src/components/toast/__tests__/CToaster.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import React from // useState,
2-
'react'
1+
import React from 'react' // useState,
32
import { render, fireEvent } from '@testing-library/react'
43
import '@testing-library/jest-dom/extend-expect'
54
import { CToast, CToaster, CToastBody, CToastHeader, CButton } from '../../../index'
@@ -12,6 +11,7 @@ test('loads and displays CToaster component', async () => {
1211
test('CToaster customize', async () => {
1312
jest.useFakeTimers()
1413
let toast = <></>
14+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1515
const addToast = function (t: any) {
1616
toast = t
1717
}

0 commit comments

Comments
 (0)