Skip to content

Commit ab0c9ed

Browse files
committed
tests: update tests
2 parents 161110e + cd2aa89 commit ab0c9ed

File tree

93 files changed

+3875
-740
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+3875
-740
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import React from 'react'
2+
import { render, screen } from '@testing-library/react'
3+
import '@testing-library/jest-dom/extend-expect'
4+
import { CAccordion } from '../../../index'
5+
6+
test('loads and displays CAccordion component', async () => {
7+
const { container } = render(<CAccordion>Test</CAccordion>)
8+
expect(container).toMatchSnapshot()
9+
})
10+
11+
test('CAccordion customize', async () => {
12+
const { container } = render(<CAccordion className="bazinga">Test</CAccordion>)
13+
expect(container.firstChild).toHaveClass('bazinga')
14+
expect(container).toMatchSnapshot()
15+
})
16+
17+
test('CAccordion use case test', async () => {
18+
jest.useFakeTimers()
19+
const { rerender } = render(<CAccordion flush={false}>Test</CAccordion>)
20+
expect(screen.getByText('Test')).toHaveClass('accordion')
21+
expect(screen.getByText('Test')).not.toHaveClass('accordion-flush')
22+
rerender(<CAccordion flush={true}>Test</CAccordion>)
23+
expect(screen.getByText('Test')).toHaveClass('accordion')
24+
expect(screen.getByText('Test')).toHaveClass('accordion-flush')
25+
jest.runAllTimers()
26+
expect(screen.getByText('Test')).toHaveClass('accordion')
27+
expect(screen.getByText('Test')).toHaveClass('accordion-flush')
28+
rerender(<CAccordion flush={false}>Test</CAccordion>)
29+
expect(screen.getByText('Test')).toHaveClass('accordion')
30+
expect(screen.getByText('Test')).not.toHaveClass('accordion-flush')
31+
jest.runAllTimers()
32+
expect(screen.getByText('Test')).toHaveClass('accordion')
33+
expect(screen.getByText('Test')).not.toHaveClass('accordion-flush')
34+
jest.runAllTimers()
35+
jest.useRealTimers()
36+
})
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react'
2+
import { render } from '@testing-library/react'
3+
import '@testing-library/jest-dom/extend-expect'
4+
import { CAccordionBody } from '../../../index'
5+
6+
test('loads and displays CAccordionBody component', async () => {
7+
const { container } = render(<CAccordionBody>Test</CAccordionBody>)
8+
expect(container).toMatchSnapshot()
9+
})
10+
11+
test('CAccordionBody customize', async () => {
12+
const { container } = render(<CAccordionBody className="bazinga">Test</CAccordionBody>)
13+
expect(container.firstChild).toHaveClass('bazinga')
14+
expect(container.firstChild).toHaveClass('accordion-body')
15+
expect(container).toMatchSnapshot()
16+
})
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react'
2+
import { render } from '@testing-library/react'
3+
import '@testing-library/jest-dom/extend-expect'
4+
import { CAccordionButton } from '../../../index'
5+
6+
test('loads and displays CAccordionButton component', async () => {
7+
const { container } = render(<CAccordionButton>Test</CAccordionButton>)
8+
expect(container).toMatchSnapshot()
9+
})
10+
11+
test('CAccordionButton customize', async () => {
12+
const { container } = render(
13+
<CAccordionButton className="bazinga" collapsed={true}>
14+
Test
15+
</CAccordionButton>,
16+
)
17+
expect(container.firstChild).toHaveClass('bazinga')
18+
expect(container.firstChild).toHaveClass('accordion-button')
19+
expect(container.firstChild).toHaveClass('collapsed')
20+
expect(container).toMatchSnapshot()
21+
})
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react'
2+
import { render } from '@testing-library/react'
3+
import '@testing-library/jest-dom/extend-expect'
4+
import { CAccordionCollapse } from '../../../index'
5+
6+
test('loads and displays CAccordionCollapse component', async () => {
7+
const { container } = render(<CAccordionCollapse>Test</CAccordionCollapse>)
8+
expect(container.firstChild).toHaveClass('accordion-collapse')
9+
expect(container).toMatchSnapshot()
10+
})
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react'
2+
import { render } from '@testing-library/react'
3+
import '@testing-library/jest-dom/extend-expect'
4+
import { CAccordionHeader } from '../../../index'
5+
6+
test('loads and displays CAccordionHeader component', async () => {
7+
const { container } = render(<CAccordionHeader>Test</CAccordionHeader>)
8+
expect(container).toMatchSnapshot()
9+
})
10+
11+
test('CAccordionHeader customize', async () => {
12+
const { container } = render(<CAccordionHeader className="bazinga">Test</CAccordionHeader>)
13+
expect(container.firstChild).toHaveClass('bazinga')
14+
expect(container.firstChild).toHaveClass('accordion-header')
15+
expect(container).toMatchSnapshot()
16+
})
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react'
2+
import { render } from '@testing-library/react'
3+
import '@testing-library/jest-dom/extend-expect'
4+
import { CAccordionItem } from '../../../index'
5+
6+
test('loads and displays CAccordionItem component', async () => {
7+
const { container } = render(<CAccordionItem>Test</CAccordionItem>)
8+
expect(container).toMatchSnapshot()
9+
})
10+
11+
test('CAccordionItem customize', async () => {
12+
const { container } = render(<CAccordionItem className="bazinga">Test</CAccordionItem>)
13+
expect(container.firstChild).toHaveClass('bazinga')
14+
expect(container.firstChild).toHaveClass('accordion-item')
15+
expect(container).toMatchSnapshot()
16+
})
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`CAccordion customize 1`] = `
4+
<div>
5+
<div
6+
class="accordion bazinga"
7+
>
8+
Test
9+
</div>
10+
</div>
11+
`;
12+
13+
exports[`loads and displays CAccordion component 1`] = `
14+
<div>
15+
<div
16+
class="accordion"
17+
>
18+
Test
19+
</div>
20+
</div>
21+
`;
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`CAccordionBody customize 1`] = `
4+
<div>
5+
<div
6+
class="accordion-body bazinga"
7+
>
8+
Test
9+
</div>
10+
</div>
11+
`;
12+
13+
exports[`loads and displays CAccordionBody component 1`] = `
14+
<div>
15+
<div
16+
class="accordion-body"
17+
>
18+
Test
19+
</div>
20+
</div>
21+
`;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`CAccordionButton customize 1`] = `
4+
<div>
5+
<button
6+
aria-expanded="false"
7+
class="accordion-button collapsed bazinga"
8+
>
9+
Test
10+
</button>
11+
</div>
12+
`;
13+
14+
exports[`loads and displays CAccordionButton component 1`] = `
15+
<div>
16+
<button
17+
aria-expanded="true"
18+
class="accordion-button"
19+
>
20+
Test
21+
</button>
22+
</div>
23+
`;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`loads and displays CAccordionCollapse component 1`] = `
4+
<div>
5+
<div
6+
class="accordion-collapse collapse"
7+
>
8+
Test
9+
</div>
10+
</div>
11+
`;

0 commit comments

Comments
 (0)