Skip to content

Commit 381fa42

Browse files
committed
tests: update sidebar and forms tests
1 parent da5258b commit 381fa42

File tree

5 files changed

+90
-40
lines changed

5 files changed

+90
-40
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react'
22
import { render } from '@testing-library/react'
33
import '@testing-library/jest-dom/extend-expect'
4-
import { CForm, CFormLabel, CFormControl, CFormText, CFormCheck, CButton } from '../../../index'
4+
import { CForm, CFormLabel, CFormInput, CFormText, CFormCheck, CButton } from '../../../index'
55

66
test('loads and displays CForm component', async () => {
77
const { container } = render(<CForm>Test</CForm>)
@@ -23,7 +23,7 @@ test('CForm example', async () => {
2323
const { container } = render(
2424
<CForm>
2525
<CFormLabel>A</CFormLabel>
26-
<CFormControl type="email" aria-describedby="B" />
26+
<CFormInput type="email" aria-describedby="B" />
2727
<CFormText>C</CFormText>
2828
<CFormCheck label="D" />
2929
<CButton type="submit" color="primary">

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import * as React from 'react'
22
import { render, fireEvent } from '@testing-library/react'
33
import '@testing-library/jest-dom/extend-expect'
4-
import { CFormControl } from '../../../index'
4+
import { CFormInput } from '../../../index'
55

6-
test('loads and displays CFormControl component', async () => {
7-
const { container } = render(<CFormControl />)
6+
test('loads and displays CFormInput component', async () => {
7+
const { container } = render(<CFormInput />)
88
expect(container).toMatchSnapshot()
99
})
1010

11-
test('CFormControl customize', async () => {
11+
test('CFormInput customize', async () => {
1212
const { container } = render(
13-
<CFormControl
13+
<CFormInput
1414
className="bazinga"
1515
component="h3"
1616
disabled={true}
@@ -28,17 +28,15 @@ test('CFormControl customize', async () => {
2828
expect(container.firstChild).toHaveClass('form-control-lg')
2929
})
3030

31-
test('CFormControl customize classNameParent', async () => {
32-
const { container } = render(
33-
<CFormControl className="bazinga" classNameParent="classNameParent" />,
34-
)
31+
test('CFormInput customize classNameParent', async () => {
32+
const { container } = render(<CFormInput className="bazinga" classNameParent="classNameParent" />)
3533
expect(container).toMatchSnapshot()
3634
})
3735

38-
test('CFormControl change input', async () => {
36+
test('CFormInput change input', async () => {
3937
jest.useFakeTimers()
4038
const onChange = jest.fn()
41-
render(<CFormControl onChange={onChange} />)
39+
render(<CFormInput onChange={onChange} />)
4240
expect(onChange).toHaveBeenCalledTimes(0)
4341
const input = document.querySelector('input')
4442
if (input !== null) {

src/components/form/__tests__/__snapshots__/CFormControl.spec.tsx.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`CFormControl customize 1`] = `
3+
exports[`CFormInput customize 1`] = `
44
<div>
55
<h3
66
class="form-control-plaintext form-control-color form-control-lg bazinga"
@@ -11,7 +11,7 @@ exports[`CFormControl customize 1`] = `
1111
</div>
1212
`;
1313

14-
exports[`CFormControl customize classNameParent 1`] = `
14+
exports[`CFormInput customize classNameParent 1`] = `
1515
<div>
1616
<input
1717
class="classNameParent"
@@ -20,7 +20,7 @@ exports[`CFormControl customize classNameParent 1`] = `
2020
</div>
2121
`;
2222

23-
exports[`loads and displays CFormControl component 1`] = `
23+
exports[`loads and displays CFormInput component 1`] = `
2424
<div>
2525
<input
2626
class="form-control"

src/components/sidebar/__tests__/CSidebar.spec.tsx

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import '@testing-library/jest-dom/extend-expect'
44
import {
55
CSidebar /* , CSidebarNav, CNavLink, CNavGroup, CNavGroupItems, CNavItem */,
66
} from '../../../index'
7-
//import { CCreateNavItem } from '../CCreateNavItem'
8-
//import navigation from '../_nav'
97

108
test('loads and displays CSidebar component', async () => {
119
const { container } = render(<CSidebar>Test</CSidebar>)
@@ -41,25 +39,3 @@ test('CSidebar customize show', async () => {
4139
expect(container.firstChild).toHaveClass('sidebar-narrow-unfoldable')
4240
expect(container.firstChild).toHaveClass('show')
4341
})
44-
45-
/*
46-
test('CSidebar example', async () => {
47-
const { container } = render(<CSidebar>
48-
A
49-
<CSidebarNav>
50-
<CNavLink>B</CNavLink>
51-
<CCreateNavItem
52-
items={navigation}
53-
components={{
54-
CNavGroup,
55-
CNavGroupItems,
56-
CNavItem,
57-
CNavLink,
58-
}}
59-
/>
60-
<CNavLink>ccc</CNavLink>
61-
</CSidebarNav>
62-
</CSidebar>)
63-
expect(container).toMatchSnapshot()
64-
})
65-
*/
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
export default {
2+
plain: {
3+
fontFamily: 'Inconsolata',
4+
color: '#ccc',
5+
backgroundColor: '#2d2d2d',
6+
},
7+
styles: [
8+
{
9+
types: ['comment', 'block-comment', 'prolog', 'doctype', 'cdata'],
10+
style: {
11+
color: '#999',
12+
fontStyle: 'italic',
13+
},
14+
},
15+
{
16+
types: ['punctuation'],
17+
style: {
18+
color: '#ccc',
19+
},
20+
},
21+
{
22+
types: ['tag', 'attr-name', 'namespace', 'deleted'],
23+
style: {
24+
color: '#ec5975',
25+
},
26+
},
27+
{
28+
types: ['function-name'],
29+
style: {
30+
color: '#6196cc',
31+
},
32+
},
33+
{
34+
types: ['boolean', 'number', 'function'],
35+
style: {
36+
color: '#f08d49',
37+
},
38+
},
39+
{
40+
types: ['property', 'class-name', 'constant', 'symbol'],
41+
style: {
42+
color: '#f08d49',
43+
},
44+
},
45+
{
46+
types: ['property', 'class-name', 'constant', 'symbol'],
47+
style: {
48+
color: '#f8c555',
49+
},
50+
},
51+
{
52+
types: ['selector', 'important', 'atrule', 'keyword', 'builtin'],
53+
style: {
54+
color: '#cc99cd',
55+
},
56+
},
57+
{
58+
types: ['string', 'char', 'attr-value', 'regex', 'variable'],
59+
style: {
60+
color: '#7ec699',
61+
},
62+
},
63+
{
64+
types: ['string', 'char', 'attr-value', 'regex', 'variable'],
65+
style: {
66+
color: '#7ec699',
67+
},
68+
},
69+
{
70+
types: ['operator', 'entity', 'url'],
71+
style: {
72+
color: '#67cdcc',
73+
},
74+
},
75+
],
76+
}

0 commit comments

Comments
 (0)